noshot 13.0.0__tar.gz → 14.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {noshot-13.0.0 → noshot-14.0.0}/PKG-INFO +1 -1
  2. {noshot-13.0.0 → noshot-14.0.0}/noshot.egg-info/PKG-INFO +1 -1
  3. {noshot-13.0.0 → noshot-14.0.0}/noshot.egg-info/SOURCES.txt +18 -0
  4. {noshot-13.0.0 → noshot-14.0.0}/setup.py +1 -1
  5. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/input.txt +1 -0
  6. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/mapper.py +6 -0
  7. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/reducer.py +22 -0
  8. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/Weatherdataset.csv +200 -0
  9. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/mapper.py +20 -0
  10. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/reducer.py +32 -0
  11. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/BF_Map.py +11 -0
  12. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/BF_Red.py +30 -0
  13. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter.py +71 -0
  14. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter_mapper.py +71 -0
  15. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter_reducer.py +71 -0
  16. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/weblog.csv +100 -0
  17. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/FMA_mapper.py +14 -0
  18. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/FMA_reducer.py +14 -0
  19. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/Tweets.csv +92 -0
  20. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Instructions.txt +56 -0
  21. noshot-14.0.0/src/noshot/data/DLE FSD BDA/BDA/BDA Lab.iso +0 -0
  22. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/3 Bounding Boxes.ipynb +109 -0
  23. {noshot-13.0.0 → noshot-14.0.0}/LICENSE.txt +0 -0
  24. {noshot-13.0.0 → noshot-14.0.0}/README.md +0 -0
  25. {noshot-13.0.0 → noshot-14.0.0}/noshot.egg-info/dependency_links.txt +0 -0
  26. {noshot-13.0.0 → noshot-14.0.0}/noshot.egg-info/not-zip-safe +0 -0
  27. {noshot-13.0.0 → noshot-14.0.0}/noshot.egg-info/top_level.txt +0 -0
  28. {noshot-13.0.0 → noshot-14.0.0}/setup.cfg +0 -0
  29. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/__init__.py +0 -0
  30. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/1. DNN (Image Classification).ipynb +0 -0
  31. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/2. DNN vs CNN.ipynb +0 -0
  32. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/3. CNN (Object Detecrion).ipynb +0 -0
  33. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/4. FCN (Image Segmentaion).ipynb +0 -0
  34. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.1 DNN (Pytorch).ipynb +0 -0
  35. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.2 DNN (Tensorflow).ipynb +0 -0
  36. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.3 DNN (Image Classification).ipynb +0 -0
  37. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.1 DNN vs CNN.ipynb +0 -0
  38. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.2 DNN vs CNN.ipynb +0 -0
  39. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/4. FCNN (Image Segmentation).ipynb +0 -0
  40. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Lab Excercise (Training DNN).ipynb +0 -0
  41. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Load-Images.ipynb +0 -0
  42. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex1.ipynb +0 -0
  43. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex2.ipynb +0 -0
  44. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex3.ipynb +0 -0
  45. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex4.ipynb +0 -0
  46. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/DNN Ex No 1.ipynb +0 -0
  47. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Ex No 1 Build in dataset.ipynb +0 -0
  48. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Exp1-Short-DL_ANN_ImageClassification.ipynb +0 -0
  49. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/OR GATE .ipynb +0 -0
  50. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp02/Exp2-Short-DL_CNN_ImageClassification.ipynb +0 -0
  51. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp03/DL-Ex3-RNN.ipynb +0 -0
  52. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp04/Ex no 4.ipynb +0 -0
  53. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/main.py +0 -0
  54. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/utils/__init__.py +0 -0
  55. {noshot-13.0.0 → noshot-14.0.0}/src/noshot/utils/shell_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: noshot
3
- Version: 13.0.0
3
+ Version: 14.0.0
4
4
  Summary: Support library for Artificial Intelligence, Machine Learning and Data Science tools
5
5
  Author: Tim Stan S
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: noshot
3
- Version: 13.0.0
3
+ Version: 14.0.0
4
4
  Summary: Support library for Artificial Intelligence, Machine Learning and Data Science tools
5
5
  Author: Tim Stan S
6
6
  License: MIT
@@ -8,6 +8,23 @@ noshot.egg-info/not-zip-safe
8
8
  noshot.egg-info/top_level.txt
9
9
  src/noshot/__init__.py
10
10
  src/noshot/main.py
11
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab.iso
12
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Instructions.txt
13
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/input.txt
14
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/mapper.py
15
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex1/reducer.py
16
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/Weatherdataset.csv
17
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/mapper.py
18
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex2/reducer.py
19
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/BF_Map.py
20
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/BF_Red.py
21
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter.py
22
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter_mapper.py
23
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/bloom_filter_reducer.py
24
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex3/weblog.csv
25
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/FMA_mapper.py
26
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/FMA_reducer.py
27
+ src/noshot/data/DLE FSD BDA/BDA/BDA Lab/Ex4/Tweets.csv
11
28
  src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/1. DNN (Image Classification).ipynb
12
29
  src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/2. DNN vs CNN.ipynb
13
30
  src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/3. CNN (Object Detecrion).ipynb
@@ -17,6 +34,7 @@ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.2 DNN (Tensorflow).ipynb
17
34
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.3 DNN (Image Classification).ipynb
18
35
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.1 DNN vs CNN.ipynb
19
36
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.2 DNN vs CNN.ipynb
37
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/3 Bounding Boxes.ipynb
20
38
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/4. FCNN (Image Segmentation).ipynb
21
39
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Lab Excercise (Training DNN).ipynb
22
40
  src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Load-Images.ipynb
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="noshot",
8
- version="13.0.0",
8
+ version="14.0.0",
9
9
  author="Tim Stan S",
10
10
  description="Support library for Artificial Intelligence, Machine Learning and Data Science tools",
11
11
  long_description=long_description,
@@ -0,0 +1 @@
1
+ The Apache Hadoop software library is a framework that allows for the distributed processing of large data sets across clusters of computers using simple programming models. It is designed to scale up from single servers to thousands of machines, each offering local computation and storage. Rather than rely on hardware to deliver high-availability, the library itself is designed to detect and handle failures at the application layer, so delivering a highly-available service on top of a cluster of computers, each of which may be prone to failures.
@@ -0,0 +1,6 @@
1
+ import sys
2
+ for line in sys.stdin:
3
+ line=line.strip()
4
+ words=line.split()
5
+ for word in words:
6
+ print '%s\t%s' % (word,1)
@@ -0,0 +1,22 @@
1
+ from operator import itemgetter
2
+ import sys
3
+ current_word=None
4
+ current_count=0
5
+ word=None
6
+ for line in sys.stdin:
7
+ line=line.strip()
8
+ word,count=line.split('\t',1)
9
+ try:
10
+ count=int(count)
11
+ except ValueError:
12
+ continue
13
+ if current_word==word:
14
+ current_count+=count
15
+ else:
16
+ if current_word:
17
+ print '%s\t%s' % (current_word,current_count)
18
+ current_count=count
19
+ current_word=word
20
+
21
+ if current_word==word:
22
+ print '%s\t%s' % (current_word,current_count)
@@ -0,0 +1,200 @@
1
+ ,dt,AverageTemperature,AverageTemperatureUncertainty,City,Country,Latitude,Longitude
2
+ 0,1849-01-01,26.704,1.435,Abidjan,Côte D'Ivoire,5.63N,3.23W
3
+ 1,1849-02-01,27.434,1.362,Abidjan,Côte D'Ivoire,5.63N,3.23W
4
+ 2,1849-03-01,28.101,1.612,Abidjan,Côte D'Ivoire,5.63N,3.23W
5
+ 3,1849-04-01,26.14,1.3869999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
6
+ 4,1849-05-01,25.427,1.2,Abidjan,Côte D'Ivoire,5.63N,3.23W
7
+ 5,1849-06-01,24.844,1.402,Abidjan,Côte D'Ivoire,5.63N,3.23W
8
+ 6,1849-07-01,24.058000000000003,1.254,Abidjan,Côte D'Ivoire,5.63N,3.23W
9
+ 7,1849-08-01,23.576,1.265,Abidjan,Côte D'Ivoire,5.63N,3.23W
10
+ 8,1849-09-01,23.662,1.226,Abidjan,Côte D'Ivoire,5.63N,3.23W
11
+ 9,1849-10-01,25.263,1.175,Abidjan,Côte D'Ivoire,5.63N,3.23W
12
+ 10,1849-11-01,26.332,1.507,Abidjan,Côte D'Ivoire,5.63N,3.23W
13
+ 11,1849-12-01,25.45,1.838,Abidjan,Côte D'Ivoire,5.63N,3.23W
14
+ 12,1850-01-01,25.803,1.943,Abidjan,Côte D'Ivoire,5.63N,3.23W
15
+ 13,1850-02-01,27.89,1.43,Abidjan,Côte D'Ivoire,5.63N,3.23W
16
+ 14,1850-03-01,27.852,2.173,Abidjan,Côte D'Ivoire,5.63N,3.23W
17
+ 15,1850-04-01,26.547,1.662,Abidjan,Côte D'Ivoire,5.63N,3.23W
18
+ 16,1850-05-01,25.379,1.355,Abidjan,Côte D'Ivoire,5.63N,3.23W
19
+ 17,1850-06-01,24.903,1.178,Abidjan,Côte D'Ivoire,5.63N,3.23W
20
+ 18,1850-07-01,24.040000000000006,1.301,Abidjan,Côte D'Ivoire,5.63N,3.23W
21
+ 19,1850-08-01,23.758000000000003,1.2819999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
22
+ 20,1850-09-01,24,1.22,Abidjan,Côte D'Ivoire,5.63N,3.23W
23
+ 21,1850-10-01,24.491,1.178,Abidjan,Côte D'Ivoire,5.63N,3.23W
24
+ 22,1850-11-01,25.542,1.719,Abidjan,Côte D'Ivoire,5.63N,3.23W
25
+ 23,1850-12-01,26.014,1.6030000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
26
+ 24,1851-01-01,26.789,1.249,Abidjan,Côte D'Ivoire,5.63N,3.23W
27
+ 25,1851-02-01,27.363000000000003,1.218,Abidjan,Côte D'Ivoire,5.63N,3.23W
28
+ 26,1851-03-01,27.181,1.4280000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
29
+ 27,1851-04-01,26.604,1.654,Abidjan,Côte D'Ivoire,5.63N,3.23W
30
+ 28,1851-05-01,26.212,1.195,Abidjan,Côte D'Ivoire,5.63N,3.23W
31
+ 29,1851-06-01,24.898000000000003,1.329,Abidjan,Côte D'Ivoire,5.63N,3.23W
32
+ 30,1851-07-01,24.318,1.463,Abidjan,Côte D'Ivoire,5.63N,3.23W
33
+ 31,1851-08-01,23.752,1.394,Abidjan,Côte D'Ivoire,5.63N,3.23W
34
+ 32,1851-09-01,24.083,1.121,Abidjan,Côte D'Ivoire,5.63N,3.23W
35
+ 33,1851-10-01,25.138,1.505,Abidjan,Côte D'Ivoire,5.63N,3.23W
36
+ 34,1851-11-01,25.527,1.409,Abidjan,Côte D'Ivoire,5.63N,3.23W
37
+ 35,1851-12-01,26.203000000000003,2.358,Abidjan,Côte D'Ivoire,5.63N,3.23W
38
+ 84,1856-01-01,26.689,1.27,Abidjan,Côte D'Ivoire,5.63N,3.23W
39
+ 85,1856-02-01,26.597,1.7719999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
40
+ 86,1856-03-01,27.297,1.071,Abidjan,Côte D'Ivoire,5.63N,3.23W
41
+ 87,1856-04-01,26.998,1.199,Abidjan,Côte D'Ivoire,5.63N,3.23W
42
+ 88,1856-05-01,26.052,1.526,Abidjan,Côte D'Ivoire,5.63N,3.23W
43
+ 90,1856-07-01,24.031,1.274,Abidjan,Côte D'Ivoire,5.63N,3.23W
44
+ 96,1857-01-01,26.549000000000003,1.749,Abidjan,Côte D'Ivoire,5.63N,3.23W
45
+ 98,1857-03-01,27.299,1.263,Abidjan,Côte D'Ivoire,5.63N,3.23W
46
+ 99,1857-04-01,26.06900000000001,1.206,Abidjan,Côte D'Ivoire,5.63N,3.23W
47
+ 100,1857-05-01,25.256,1.213,Abidjan,Côte D'Ivoire,5.63N,3.23W
48
+ 101,1857-06-01,24.358,1.161,Abidjan,Côte D'Ivoire,5.63N,3.23W
49
+ 102,1857-07-01,24.09,1.257,Abidjan,Côte D'Ivoire,5.63N,3.23W
50
+ 103,1857-08-01,23.264,1.274,Abidjan,Côte D'Ivoire,5.63N,3.23W
51
+ 104,1857-09-01,23.71,1.218,Abidjan,Côte D'Ivoire,5.63N,3.23W
52
+ 105,1857-10-01,24.577,1.227,Abidjan,Côte D'Ivoire,5.63N,3.23W
53
+ 106,1857-11-01,25.778,1.158,Abidjan,Côte D'Ivoire,5.63N,3.23W
54
+ 107,1857-12-01,25.91,1.388,Abidjan,Côte D'Ivoire,5.63N,3.23W
55
+ 108,1858-01-01,26.454,1.964,Abidjan,Côte D'Ivoire,5.63N,3.23W
56
+ 109,1858-02-01,26.783,1.2009999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
57
+ 110,1858-03-01,27.285,1.236,Abidjan,Côte D'Ivoire,5.63N,3.23W
58
+ 111,1858-04-01,27.161,1.27,Abidjan,Côte D'Ivoire,5.63N,3.23W
59
+ 112,1858-05-01,25.925,1.235,Abidjan,Côte D'Ivoire,5.63N,3.23W
60
+ 113,1858-06-01,25.014,1.253,Abidjan,Côte D'Ivoire,5.63N,3.23W
61
+ 114,1858-07-01,23.531,1.16,Abidjan,Côte D'Ivoire,5.63N,3.23W
62
+ 115,1858-08-01,23.475,1.325,Abidjan,Côte D'Ivoire,5.63N,3.23W
63
+ 116,1858-09-01,23.712,1.166,Abidjan,Côte D'Ivoire,5.63N,3.23W
64
+ 117,1858-10-01,25.17,1.198,Abidjan,Côte D'Ivoire,5.63N,3.23W
65
+ 118,1858-11-01,26.417,1.279,Abidjan,Côte D'Ivoire,5.63N,3.23W
66
+ 119,1858-12-01,24.914,1.824,Abidjan,Côte D'Ivoire,5.63N,3.23W
67
+ 120,1859-01-01,26.176,1.514,Abidjan,Côte D'Ivoire,5.63N,3.23W
68
+ 121,1859-02-01,27.094,1.445,Abidjan,Côte D'Ivoire,5.63N,3.23W
69
+ 122,1859-03-01,28.034,1.2990000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
70
+ 123,1859-04-01,28.273000000000003,1.419,Abidjan,Côte D'Ivoire,5.63N,3.23W
71
+ 124,1859-05-01,27.137,1.5759999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
72
+ 125,1859-06-01,25.361,1.32,Abidjan,Côte D'Ivoire,5.63N,3.23W
73
+ 126,1859-07-01,23.975,1.264,Abidjan,Côte D'Ivoire,5.63N,3.23W
74
+ 127,1859-08-01,23.515,1.272,Abidjan,Côte D'Ivoire,5.63N,3.23W
75
+ 128,1859-09-01,23.785,1.199,Abidjan,Côte D'Ivoire,5.63N,3.23W
76
+ 129,1859-10-01,25.31600000000001,1.304,Abidjan,Côte D'Ivoire,5.63N,3.23W
77
+ 130,1859-11-01,26.163,1.389,Abidjan,Côte D'Ivoire,5.63N,3.23W
78
+ 131,1859-12-01,26.222,1.587,Abidjan,Côte D'Ivoire,5.63N,3.23W
79
+ 132,1860-01-01,26.532,1.372,Abidjan,Côte D'Ivoire,5.63N,3.23W
80
+ 133,1860-02-01,27.19,1.295,Abidjan,Côte D'Ivoire,5.63N,3.23W
81
+ 134,1860-03-01,26.825,1.278,Abidjan,Côte D'Ivoire,5.63N,3.23W
82
+ 136,1860-05-01,26.11,1.158,Abidjan,Côte D'Ivoire,5.63N,3.23W
83
+ 137,1860-06-01,25.404,1.196,Abidjan,Côte D'Ivoire,5.63N,3.23W
84
+ 138,1860-07-01,24.275,1.217,Abidjan,Côte D'Ivoire,5.63N,3.23W
85
+ 139,1860-08-01,23.96,1.2819999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
86
+ 140,1860-09-01,24.52,1.175,Abidjan,Côte D'Ivoire,5.63N,3.23W
87
+ 141,1860-10-01,25.158,1.123,Abidjan,Côte D'Ivoire,5.63N,3.23W
88
+ 142,1860-11-01,25.324,1.146,Abidjan,Côte D'Ivoire,5.63N,3.23W
89
+ 143,1860-12-01,24.81,1.329,Abidjan,Côte D'Ivoire,5.63N,3.23W
90
+ 144,1861-01-01,25.189,1.648,Abidjan,Côte D'Ivoire,5.63N,3.23W
91
+ 145,1861-02-01,26.443,1.402,Abidjan,Côte D'Ivoire,5.63N,3.23W
92
+ 146,1861-03-01,27.542,1.224,Abidjan,Côte D'Ivoire,5.63N,3.23W
93
+ 147,1861-04-01,27.034,1.288,Abidjan,Côte D'Ivoire,5.63N,3.23W
94
+ 148,1861-05-01,25.984,1.211,Abidjan,Côte D'Ivoire,5.63N,3.23W
95
+ 149,1861-06-01,25.176,1.426,Abidjan,Côte D'Ivoire,5.63N,3.23W
96
+ 150,1861-07-01,24.084,1.317,Abidjan,Côte D'Ivoire,5.63N,3.23W
97
+ 151,1861-08-01,23.648000000000003,1.253,Abidjan,Côte D'Ivoire,5.63N,3.23W
98
+ 154,1861-11-01,25.762,1.476,Abidjan,Côte D'Ivoire,5.63N,3.23W
99
+ 155,1861-12-01,25.856,1.656,Abidjan,Côte D'Ivoire,5.63N,3.23W
100
+ 156,1862-01-01,25.427,1.396,Abidjan,Côte D'Ivoire,5.63N,3.23W
101
+ 157,1862-02-01,26.064,1.339,Abidjan,Côte D'Ivoire,5.63N,3.23W
102
+ 158,1862-03-01,27.177,1.527,Abidjan,Côte D'Ivoire,5.63N,3.23W
103
+ 159,1862-04-01,26.656,1.554,Abidjan,Côte D'Ivoire,5.63N,3.23W
104
+ 161,1862-06-01,24.912,1.435,Abidjan,Côte D'Ivoire,5.63N,3.23W
105
+ 162,1862-07-01,24.211,1.376,Abidjan,Côte D'Ivoire,5.63N,3.23W
106
+ 163,1862-08-01,23.681,1.509,Abidjan,Côte D'Ivoire,5.63N,3.23W
107
+ 164,1862-09-01,23.987,1.436,Abidjan,Côte D'Ivoire,5.63N,3.23W
108
+ 165,1862-10-01,24.933000000000003,1.367,Abidjan,Côte D'Ivoire,5.63N,3.23W
109
+ 167,1862-12-01,24.687,1.4480000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
110
+ 290,1873-03-01,27.658,1.245,Abidjan,Côte D'Ivoire,5.63N,3.23W
111
+ 292,1873-05-01,26.526,1.1740000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
112
+ 293,1873-06-01,25.815,1.271,Abidjan,Côte D'Ivoire,5.63N,3.23W
113
+ 294,1873-07-01,24.645,1.133,Abidjan,Côte D'Ivoire,5.63N,3.23W
114
+ 295,1873-08-01,24.116,1.06,Abidjan,Côte D'Ivoire,5.63N,3.23W
115
+ 296,1873-09-01,24.689,1.3259999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
116
+ 297,1873-10-01,25.158,1.006,Abidjan,Côte D'Ivoire,5.63N,3.23W
117
+ 299,1873-12-01,26.341,1.074,Abidjan,Côte D'Ivoire,5.63N,3.23W
118
+ 300,1874-01-01,26.501,1.629,Abidjan,Côte D'Ivoire,5.63N,3.23W
119
+ 301,1874-02-01,27.216,1.18,Abidjan,Côte D'Ivoire,5.63N,3.23W
120
+ 302,1874-03-01,27.022,1.4,Abidjan,Côte D'Ivoire,5.63N,3.23W
121
+ 303,1874-04-01,27.298,1.014,Abidjan,Côte D'Ivoire,5.63N,3.23W
122
+ 304,1874-05-01,25.925,1.15,Abidjan,Côte D'Ivoire,5.63N,3.23W
123
+ 306,1874-07-01,23.974,1.022,Abidjan,Côte D'Ivoire,5.63N,3.23W
124
+ 307,1874-08-01,23.546,1.145,Abidjan,Côte D'Ivoire,5.63N,3.23W
125
+ 308,1874-09-01,24.491,0.924,Abidjan,Côte D'Ivoire,5.63N,3.23W
126
+ 309,1874-10-01,25.103,1.304,Abidjan,Côte D'Ivoire,5.63N,3.23W
127
+ 310,1874-11-01,25.643,1.32,Abidjan,Côte D'Ivoire,5.63N,3.23W
128
+ 311,1874-12-01,25.781,1.356,Abidjan,Côte D'Ivoire,5.63N,3.23W
129
+ 312,1875-01-01,25.56600000000001,1.213,Abidjan,Côte D'Ivoire,5.63N,3.23W
130
+ 313,1875-02-01,26.84,1.018,Abidjan,Côte D'Ivoire,5.63N,3.23W
131
+ 314,1875-03-01,27.147,0.931,Abidjan,Côte D'Ivoire,5.63N,3.23W
132
+ 315,1875-04-01,26.767,0.929,Abidjan,Côte D'Ivoire,5.63N,3.23W
133
+ 316,1875-05-01,25.889,0.809,Abidjan,Côte D'Ivoire,5.63N,3.23W
134
+ 317,1875-06-01,24.916,0.893,Abidjan,Côte D'Ivoire,5.63N,3.23W
135
+ 318,1875-07-01,23.711,1.3,Abidjan,Côte D'Ivoire,5.63N,3.23W
136
+ 319,1875-08-01,23.32,0.989,Abidjan,Côte D'Ivoire,5.63N,3.23W
137
+ 320,1875-09-01,23.907,0.823,Abidjan,Côte D'Ivoire,5.63N,3.23W
138
+ 321,1875-10-01,24.725,0.8740000000000001,Abidjan,Côte D'Ivoire,5.63N,3.23W
139
+ 322,1875-11-01,25.026,0.7879999999999999,Abidjan,Côte D'Ivoire,5.63N,3.23W
140
+ 323,1875-12-01,25.16,1.11,Abidjan,Côte D'Ivoire,5.63N,3.23W
141
+ 324,1876-01-01,25.608,1.357,Abidjan,Côte D'Ivoire,5.63N,3.23W
142
+ 325,1876-02-01,26.391,1.608,Abidjan,Côte D'Ivoire,5.63N,3.23W
143
+ 326,1876-03-01,27.006,1.453,Abidjan,Côte D'Ivoire,5.63N,3.23W
144
+ 327,1876-04-01,26.385,2.202,Abidjan,Côte D'Ivoire,5.63N,3.23W
145
+ 328,1876-05-01,25.593,0.871,Abidjan,Côte D'Ivoire,5.63N,3.23W
146
+ 329,1876-06-01,24.919,1.183,Abidjan,Côte D'Ivoire,5.63N,3.23W
147
+ 330,1876-07-01,23.705,1.64,Abidjan,Côte D'Ivoire,5.63N,3.23W
148
+ 331,1876-08-01,23.015,1.5830000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
149
+ 332,1876-09-01,23.644,1.324,Abidjan,Côte D'Ivoire,5.63N,3.23W
150
+ 333,1876-10-01,24.959,1.228,Abidjan,Côte D'Ivoire,5.63N,3.23W
151
+ 334,1876-11-01,25.252,1.288,Abidjan,Côte D'Ivoire,5.63N,3.23W
152
+ 335,1876-12-01,25.253,1.147,Abidjan,Côte D'Ivoire,5.63N,3.23W
153
+ 336,1877-01-01,25.845,1.636,Abidjan,Côte D'Ivoire,5.63N,3.23W
154
+ 337,1877-02-01,26.925,1.555,Abidjan,Côte D'Ivoire,5.63N,3.23W
155
+ 338,1877-03-01,27.607,1.386,Abidjan,Côte D'Ivoire,5.63N,3.23W
156
+ 339,1877-04-01,26.978,0.991,Abidjan,Côte D'Ivoire,5.63N,3.23W
157
+ 340,1877-05-01,26.21,0.769,Abidjan,Côte D'Ivoire,5.63N,3.23W
158
+ 341,1877-06-01,25.217,1.513,Abidjan,Côte D'Ivoire,5.63N,3.23W
159
+ 342,1877-07-01,24.578000000000003,0.7929999999999999,Abidjan,Côte D'Ivoire,5.63N,3.23W
160
+ 343,1877-08-01,24.14,0.916,Abidjan,Côte D'Ivoire,5.63N,3.23W
161
+ 344,1877-09-01,24.569000000000003,0.747,Abidjan,Côte D'Ivoire,5.63N,3.23W
162
+ 345,1877-10-01,25.363000000000003,0.858,Abidjan,Côte D'Ivoire,5.63N,3.23W
163
+ 346,1877-11-01,26.413,0.938,Abidjan,Côte D'Ivoire,5.63N,3.23W
164
+ 347,1877-12-01,26.313,2.066,Abidjan,Côte D'Ivoire,5.63N,3.23W
165
+ 348,1878-01-01,26.433000000000003,1.293,Abidjan,Côte D'Ivoire,5.63N,3.23W
166
+ 349,1878-02-01,27.785,1.404,Abidjan,Côte D'Ivoire,5.63N,3.23W
167
+ 350,1878-03-01,28.674,1.693,Abidjan,Côte D'Ivoire,5.63N,3.23W
168
+ 351,1878-04-01,27.558000000000003,1.388,Abidjan,Côte D'Ivoire,5.63N,3.23W
169
+ 352,1878-05-01,26.078000000000003,0.841,Abidjan,Côte D'Ivoire,5.63N,3.23W
170
+ 353,1878-06-01,25.087,2.164,Abidjan,Côte D'Ivoire,5.63N,3.23W
171
+ 354,1878-07-01,23.668000000000006,2.186,Abidjan,Côte D'Ivoire,5.63N,3.23W
172
+ 355,1878-08-01,23.475,1.602,Abidjan,Côte D'Ivoire,5.63N,3.23W
173
+ 356,1878-09-01,24.348000000000003,0.787,Abidjan,Côte D'Ivoire,5.63N,3.23W
174
+ 357,1878-10-01,25.398000000000003,0.736,Abidjan,Côte D'Ivoire,5.63N,3.23W
175
+ 358,1878-11-01,26.207,1.225,Abidjan,Côte D'Ivoire,5.63N,3.23W
176
+ 359,1878-12-01,25.781,1.177,Abidjan,Côte D'Ivoire,5.63N,3.23W
177
+ 360,1879-01-01,25.803,1.4169999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
178
+ 361,1879-02-01,27.402,0.978,Abidjan,Côte D'Ivoire,5.63N,3.23W
179
+ 362,1879-03-01,27.148000000000003,1.129,Abidjan,Côte D'Ivoire,5.63N,3.23W
180
+ 363,1879-04-01,26.662,1.182,Abidjan,Côte D'Ivoire,5.63N,3.23W
181
+ 364,1879-05-01,25.592,1.319,Abidjan,Côte D'Ivoire,5.63N,3.23W
182
+ 365,1879-06-01,25.147,0.919,Abidjan,Côte D'Ivoire,5.63N,3.23W
183
+ 366,1879-07-01,23.265,1.804,Abidjan,Côte D'Ivoire,5.63N,3.23W
184
+ 367,1879-08-01,22.912,1.3159999999999998,Abidjan,Côte D'Ivoire,5.63N,3.23W
185
+ 368,1879-09-01,23.926,0.847,Abidjan,Côte D'Ivoire,5.63N,3.23W
186
+ 369,1879-10-01,25.197,0.985,Abidjan,Côte D'Ivoire,5.63N,3.23W
187
+ 370,1879-11-01,25.897,0.885,Abidjan,Côte D'Ivoire,5.63N,3.23W
188
+ 371,1879-12-01,25.657,1.285,Abidjan,Côte D'Ivoire,5.63N,3.23W
189
+ 372,1880-01-01,26.109,1.095,Abidjan,Côte D'Ivoire,5.63N,3.23W
190
+ 373,1880-02-01,26.922,1.249,Abidjan,Côte D'Ivoire,5.63N,3.23W
191
+ 374,1880-03-01,27.514,1.204,Abidjan,Côte D'Ivoire,5.63N,3.23W
192
+ 375,1880-04-01,26.65,0.955,Abidjan,Côte D'Ivoire,5.63N,3.23W
193
+ 376,1880-05-01,26.566,1.262,Abidjan,Côte D'Ivoire,5.63N,3.23W
194
+ 377,1880-06-01,25.232,1.027,Abidjan,Côte D'Ivoire,5.63N,3.23W
195
+ 378,1880-07-01,24.614,1.069,Abidjan,Côte D'Ivoire,5.63N,3.23W
196
+ 379,1880-08-01,24.542,1.534,Abidjan,Côte D'Ivoire,5.63N,3.23W
197
+ 380,1880-09-01,24.199,0.91,Abidjan,Côte D'Ivoire,5.63N,3.23W
198
+ 381,1880-10-01,25.99,1.975,Abidjan,Côte D'Ivoire,5.63N,3.23W
199
+ 382,1880-11-01,26.607,1.7380000000000002,Abidjan,Côte D'Ivoire,5.63N,3.23W
200
+ 383,1880-12-01,26.54,1.491,Abidjan,Côte D'Ivoire,5.63N,3.23W
@@ -0,0 +1,20 @@
1
+ import sys
2
+ from datetime import datetime
3
+ i = 0
4
+ for line in sys.stdin:
5
+ if 1-i:
6
+ i+=1
7
+ continue
8
+ line = line.strip().split(',')
9
+ date = line[1].split('-')
10
+ date = datetime(int(date[0]), int(date[1]), int(date[2]))
11
+ temp = float(line[2])
12
+ if not line:
13
+ continue
14
+
15
+ try:
16
+ year = date.year
17
+ temp = float(temp)
18
+ print str(year)+ "\t" +str(temp)+ "\t"+str(1)
19
+ except ValueError:
20
+ continue
@@ -0,0 +1,32 @@
1
+ import sys
2
+
3
+ def reducer():
4
+ yearly_min = {}
5
+
6
+ for line in sys.stdin:
7
+ line = line.strip()
8
+ if not line:
9
+ continue
10
+ try:
11
+ year, temp, _ = line.split('\t')
12
+ temp = float(temp)
13
+ if year in yearly_min:
14
+ if temp < yearly_min[year]:
15
+ yearly_min[year] = temp
16
+ else:
17
+ yearly_min[year] = temp
18
+
19
+ except ValueError:
20
+ continue
21
+ coolest_year = None
22
+ coolest_temp = float('inf')
23
+ for year, temp in yearly_min.items():
24
+ if temp < coolest_temp:
25
+ coolest_temp = temp
26
+ coolest_year = year
27
+
28
+ if coolest_year:
29
+ print("coolest year ",str(coolest_year)," Minimum Temperature ",str(coolest_temp))
30
+
31
+ if __name__ == "__main__":
32
+ reducer()
@@ -0,0 +1,11 @@
1
+ import sys
2
+ for line in sys.stdin:
3
+ line = line.strip()
4
+ if not line:
5
+ contine
6
+ ip = line.split(',')[0]
7
+ try:
8
+ int(ip.split('.')[0])
9
+ except:
10
+ continue
11
+ print str(ip)+"\t"+str(1)
@@ -0,0 +1,30 @@
1
+ import sys
2
+
3
+ Bloom_size = 100000
4
+ hashc = 2
5
+
6
+ bit_array = 0
7
+ def get_hashes(item, size, count):
8
+ ip = item.split('.')
9
+ h1 = sum(int(x) for x in ip)%size
10
+ h2 = sum(2*int(ip[i])*i-5 for i in range(len(ip)))
11
+ return [h1,h2]
12
+
13
+
14
+ def add_to_bloom(item):
15
+ global bit_array
16
+ for h in get_hashes(item, Bloom_size, hashc):
17
+ bit_array |= 1<<h
18
+
19
+ def is_in_bloom(item):
20
+ for h in get_hashes(item, Bloom_size, hashc):
21
+ if bit_array & (1<<h) == 0:
22
+ return False
23
+ return True
24
+
25
+ for line in sys.stdin:
26
+ ip = line.strip().split('\t')[0]
27
+ if ip and not is_in_bloom(ip):
28
+ add_to_bloom(ip)
29
+ print(ip)
30
+
@@ -0,0 +1,71 @@
1
+ import math
2
+
3
+ class BloomFilter:
4
+ def __init__(self, size=13):
5
+ self.size = size
6
+ self.bit_array = [0] * size
7
+
8
+ def h1(self, x):
9
+ return (2*x) % self.size
10
+
11
+ def h2(self, x):
12
+ return (x+10) % self.size
13
+
14
+ def h3(self, x):
15
+ return (x + 15) % self.size
16
+
17
+ def add(self, element, hash_count):
18
+ positions = []
19
+ collisions = 0
20
+ if hash_count >= 1:
21
+ positions.append(self.h1(element))
22
+ if hash_count >= 2:
23
+ positions.append(self.h2(element))
24
+ if hash_count >= 3:
25
+ positions.append(self.h3(element))
26
+
27
+ for pos in positions:
28
+ if self.bit_array[pos] == 1:
29
+ collisions += 1
30
+ self.bit_array[pos] = 1
31
+ return collisions
32
+
33
+ def count_ones(self):
34
+ return sum(self.bit_array)
35
+ def calculate_error_rate(x, y, z):
36
+ return (1 - math.exp(-z * y / x)) ** z
37
+
38
+ def main():
39
+ # Input parameters
40
+ y = 13 # Number of bits in array
41
+ elements = [142,87,95,153]
42
+ x = len(elements) # Number of elements
43
+
44
+ print "Number of Elements (x):\t%d" % x
45
+ print "Bit Array Size (y):\t%d\n" % y
46
+
47
+ optimal_z = 1
48
+ min_error = 1.0 # Initialize with maximum possible error
49
+ for z in [1, 2, 3]: # Test 1, 2, and 3 hash functions
50
+ bf = BloomFilter(y)
51
+ total_collisions = 0
52
+
53
+ for element in elements:
54
+ total_collisions += bf.add(element, z)
55
+
56
+ ones = bf.count_ones()
57
+ error = calculate_error_rate(x, y, z)
58
+ print "Case %d: Using %d hash function(s)" % (z, z)
59
+ print "Collisions:\t%d" % total_collisions
60
+ print "Ones in array:\t%d/%d" % (ones, y)
61
+ print "Error rate:\t%.4f" % error
62
+ print "Bit array:\t%s\n" % bf.bit_array
63
+ if error < min_error:
64
+ min_error = error
65
+ optimal_z = z
66
+
67
+ print "Optimal number of hash functions: %d" % optimal_z
68
+ print "Minimum error rate achieved: %.4f" % min_error
69
+
70
+ if __name__ == "__main__":
71
+ main()
@@ -0,0 +1,71 @@
1
+ import math
2
+
3
+ class BloomFilter:
4
+ def __init__(self, size=13):
5
+ self.size = size
6
+ self.bit_array = [0] * size
7
+
8
+ def h1(self, x):
9
+ return (2*x) % self.size
10
+
11
+ def h2(self, x):
12
+ return (x+10) % self.size
13
+
14
+ def h3(self, x):
15
+ return (x + 15) % self.size
16
+
17
+ def add(self, element, hash_count):
18
+ positions = []
19
+ collisions = 0
20
+ if hash_count >= 1:
21
+ positions.append(self.h1(element))
22
+ if hash_count >= 2:
23
+ positions.append(self.h2(element))
24
+ if hash_count >= 3:
25
+ positions.append(self.h3(element))
26
+
27
+ for pos in positions:
28
+ if self.bit_array[pos] == 1:
29
+ collisions += 1
30
+ self.bit_array[pos] = 1
31
+ return collisions
32
+
33
+ def count_ones(self):
34
+ return sum(self.bit_array)
35
+ def calculate_error_rate(x, y, z):
36
+ return (1 - math.exp(-z * y / x)) ** z
37
+
38
+ def main():
39
+ # Input parameters
40
+ y = 13 # Number of bits in array
41
+ elements = [142,87,95,153]
42
+ x = len(elements) # Number of elements
43
+
44
+ print "Number of Elements (x):\t%d" % x
45
+ print "Bit Array Size (y):\t%d\n" % y
46
+
47
+ optimal_z = 1
48
+ min_error = 1.0 # Initialize with maximum possible error
49
+ for z in [1, 2, 3]: # Test 1, 2, and 3 hash functions
50
+ bf = BloomFilter(y)
51
+ total_collisions = 0
52
+
53
+ for element in elements:
54
+ total_collisions += bf.add(element, z)
55
+
56
+ ones = bf.count_ones()
57
+ error = calculate_error_rate(x, y, z)
58
+ print "Case %d: Using %d hash function(s)" % (z, z)
59
+ print "Collisions:\t%d" % total_collisions
60
+ print "Ones in array:\t%d/%d" % (ones, y)
61
+ print "Error rate:\t%.4f" % error
62
+ print "Bit array:\t%s\n" % bf.bit_array
63
+ if error < min_error:
64
+ min_error = error
65
+ optimal_z = z
66
+
67
+ print "Optimal number of hash functions: %d" % optimal_z
68
+ print "Minimum error rate achieved: %.4f" % min_error
69
+
70
+ if __name__ == "__main__":
71
+ main()
@@ -0,0 +1,71 @@
1
+ import math
2
+
3
+ class BloomFilter:
4
+ def __init__(self, size=13):
5
+ self.size = size
6
+ self.bit_array = [0] * size
7
+
8
+ def h1(self, x):
9
+ return (2*x) % self.size
10
+
11
+ def h2(self, x):
12
+ return (x+10) % self.size
13
+
14
+ def h3(self, x):
15
+ return (x + 15) % self.size
16
+
17
+ def add(self, element, hash_count):
18
+ positions = []
19
+ collisions = 0
20
+ if hash_count >= 1:
21
+ positions.append(self.h1(element))
22
+ if hash_count >= 2:
23
+ positions.append(self.h2(element))
24
+ if hash_count >= 3:
25
+ positions.append(self.h3(element))
26
+
27
+ for pos in positions:
28
+ if self.bit_array[pos] == 1:
29
+ collisions += 1
30
+ self.bit_array[pos] = 1
31
+ return collisions
32
+
33
+ def count_ones(self):
34
+ return sum(self.bit_array)
35
+ def calculate_error_rate(x, y, z):
36
+ return (1 - math.exp(-z * y / x)) ** z
37
+
38
+ def main():
39
+ # Input parameters
40
+ y = 13 # Number of bits in array
41
+ elements = [142,87,95,153]
42
+ x = len(elements) # Number of elements
43
+
44
+ print "Number of Elements (x):\t%d" % x
45
+ print "Bit Array Size (y):\t%d\n" % y
46
+
47
+ optimal_z = 1
48
+ min_error = 1.0 # Initialize with maximum possible error
49
+ for z in [1, 2, 3]: # Test 1, 2, and 3 hash functions
50
+ bf = BloomFilter(y)
51
+ total_collisions = 0
52
+
53
+ for element in elements:
54
+ total_collisions += bf.add(element, z)
55
+
56
+ ones = bf.count_ones()
57
+ error = calculate_error_rate(x, y, z)
58
+ print "Case %d: Using %d hash function(s)" % (z, z)
59
+ print "Collisions:\t%d" % total_collisions
60
+ print "Ones in array:\t%d/%d" % (ones, y)
61
+ print "Error rate:\t%.4f" % error
62
+ print "Bit array:\t%s\n" % bf.bit_array
63
+ if error < min_error:
64
+ min_error = error
65
+ optimal_z = z
66
+
67
+ print "Optimal number of hash functions: %d" % optimal_z
68
+ print "Minimum error rate achieved: %.4f" % min_error
69
+
70
+ if __name__ == "__main__":
71
+ main()
@@ -0,0 +1,100 @@
1
+ IP,Time,URL,Staus
2
+ 10.128.2.1,[29/Nov/2017:06:58:55,GET /login.php HTTP/1.1,200
3
+ 10.128.2.1,[29/Nov/2017:06:59:02,POST /process.php HTTP/1.1,302
4
+ 10.128.2.1,[29/Nov/2017:06:59:03,GET /home.php HTTP/1.1,200
5
+ 10.131.2.1,[29/Nov/2017:06:59:04,GET /js/vendor/moment.min.js HTTP/1.1,200
6
+ 10.130.2.1,[29/Nov/2017:06:59:06,GET /bootstrap-3.3.7/js/bootstrap.js HTTP/1.1,200
7
+ 10.130.2.1,[29/Nov/2017:06:59:19,GET /profile.php?user=bala HTTP/1.1,200
8
+ 10.128.2.1,[29/Nov/2017:06:59:19,GET /js/jquery.min.js HTTP/1.1,200
9
+ 10.131.2.1,[29/Nov/2017:06:59:19,GET /js/chart.min.js HTTP/1.1,200
10
+ 10.131.2.1,[29/Nov/2017:06:59:30,GET /edit.php?name=bala HTTP/1.1,200
11
+ 10.131.2.1,[29/Nov/2017:06:59:37,GET /logout.php HTTP/1.1,302
12
+ 10.131.2.1,[29/Nov/2017:06:59:37,GET /login.php HTTP/1.1,200
13
+ 10.130.2.1,[29/Nov/2017:07:00:19,GET /login.php HTTP/1.1,200
14
+ 10.130.2.1,[29/Nov/2017:07:00:21,GET /login.php HTTP/1.1,200
15
+ 10.130.2.1,[29/Nov/2017:13:31:27,GET / HTTP/1.1,302
16
+ 10.130.2.1,[29/Nov/2017:13:31:28,GET /login.php HTTP/1.1,200
17
+ 10.129.2.1,[29/Nov/2017:13:38:03,POST /process.php HTTP/1.1,302
18
+ 10.131.0.1,[29/Nov/2017:13:38:04,GET /home.php HTTP/1.1,200
19
+ 10.131.0.1,[29/Nov/2017:13:38:07,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
20
+ 10.130.2.1,[29/Nov/2017:13:38:19,GET / HTTP/1.1,302
21
+ 10.131.2.1,[29/Nov/2017:13:38:20,GET /login.php HTTP/1.1,200
22
+ 10.131.2.1,[29/Nov/2017:13:38:20,GET /css/bootstrap.min.css HTTP/1.1,200
23
+ 10.128.2.1,[29/Nov/2017:13:38:20,GET /css/font-awesome.min.css HTTP/1.1,200
24
+ 10.131.0.1,[29/Nov/2017:13:38:20,GET /css/normalize.css HTTP/1.1,200
25
+ 10.128.2.1,[29/Nov/2017:13:38:20,GET /css/style.css HTTP/1.1,200
26
+ 10.131.0.1,[29/Nov/2017:13:38:20,GET /js/vendor/modernizr-2.8.3.min.js HTTP/1.1,200
27
+ 10.129.2.1,[29/Nov/2017:13:38:20,GET /css/main.css HTTP/1.1,200
28
+ 10.131.0.1,[29/Nov/2017:13:38:21,GET /js/vendor/jquery-1.12.0.min.js HTTP/1.1,200
29
+ 10.128.2.1,[29/Nov/2017:13:38:21,GET /bootstrap-3.3.7/js/bootstrap.min.js HTTP/1.1,200
30
+ 10.131.2.1,[29/Nov/2017:13:38:23,GET /fonts/fontawesome-webfont.woff2?v=4.6.3 HTTP/1.1,200
31
+ 10.131.2.1,[29/Nov/2017:13:46:46,GET / HTTP/1.1,200
32
+ 10.131.2.1,[29/Nov/2017:13:46:50,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
33
+ 10.131.2.1,[29/Nov/2017:13:46:53,GET /logout.php HTTP/1.1,302
34
+ 10.131.2.1,[29/Nov/2017:13:46:54,GET /login.php HTTP/1.1,200
35
+ 10.131.2.1,[29/Nov/2017:13:47:04,POST /process.php HTTP/1.1,302
36
+ 10.131.2.1,[29/Nov/2017:13:47:05,GET /login.php?value=fail HTTP/1.1,200
37
+ 10.131.2.1,[29/Nov/2017:13:47:16,POST /process.php HTTP/1.1,302
38
+ 10.131.2.1,[29/Nov/2017:13:47:16,GET /home.php HTTP/1.1,200
39
+ 10.131.2.1,[29/Nov/2017:13:47:19,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,302
40
+ 10.130.2.1,[29/Nov/2017:13:47:20,GET /countdown.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
41
+ 10.129.2.1,[29/Nov/2017:13:49:25,GET /details.php?id=44 HTTP/1.1,302
42
+ 10.128.2.1,[29/Nov/2017:13:49:26,GET /countdown.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
43
+ 10.128.2.1,[29/Nov/2017:13:49:32,GET /home.php HTTP/1.1,200
44
+ 10.128.2.1,[29/Nov/2017:13:49:34,GET /compiler.php HTTP/1.1,200
45
+ 10.128.2.1,[29/Nov/2017:13:49:37,GET /compiler.php HTTP/1.1,200
46
+ 10.131.2.1,[29/Nov/2017:13:51:40,GET /logout.php HTTP/1.1,302
47
+ 10.129.2.1,[29/Nov/2017:13:51:41,GET /login.php HTTP/1.1,200
48
+ 10.129.2.1,[29/Nov/2017:13:51:44,POST /process.php HTTP/1.1,302
49
+ 10.131.2.1,[29/Nov/2017:13:51:44,GET /home.php HTTP/1.1,200
50
+ 10.131.2.1,[29/Nov/2017:13:51:46,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
51
+ 10.131.2.1,[29/Nov/2017:13:51:49,GET /details.php?id=44 HTTP/1.1,200
52
+ 10.128.2.1,[29/Nov/2017:13:57:04,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
53
+ 10.131.2.1,[29/Nov/2017:14:04:57,GET /details.php?id=44 HTTP/1.1,200
54
+ 10.131.2.1,[29/Nov/2017:14:05:10,GET /contest.php HTTP/1.1,200
55
+ 10.131.2.1,[29/Nov/2017:14:05:12,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
56
+ 10.131.2.1,[29/Nov/2017:14:05:16,GET /details.php?id=46 HTTP/1.1,200
57
+ 10.131.2.1,[29/Nov/2017:14:05:22,GET /contest.php HTTP/1.1,200
58
+ 10.131.2.1,[29/Nov/2017:14:05:24,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
59
+ 10.131.2.1,[29/Nov/2017:14:05:28,GET /details.php?id=42 HTTP/1.1,200
60
+ 10.131.2.1,[29/Nov/2017:14:05:35,GET /contest.php HTTP/1.1,200
61
+ 10.131.2.1,[29/Nov/2017:14:05:37,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
62
+ 10.131.2.1,[29/Nov/2017:14:06:05,GET /details.php?id=45 HTTP/1.1,200
63
+ 10.128.2.1,[29/Nov/2017:14:06:10,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
64
+ 10.131.0.1,[29/Nov/2017:14:31:33,GET / HTTP/1.1,200
65
+ 10.131.2.1,[29/Nov/2017:14:33:21,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
66
+ 10.131.2.1,[29/Nov/2017:14:33:22,GET /css/bootstrap.min.css HTTP/1.1,304
67
+ 10.128.2.1,[29/Nov/2017:14:33:22,GET /css/font-awesome.min.css HTTP/1.1,304
68
+ 10.131.0.1,[29/Nov/2017:14:33:22,GET /css/normalize.css HTTP/1.1,304
69
+ 10.131.2.1,[29/Nov/2017:14:33:22,GET /css/main.css HTTP/1.1,304
70
+ 10.131.0.1,[29/Nov/2017:14:33:22,GET /css/style.css HTTP/1.1,304
71
+ 10.128.2.1,[29/Nov/2017:14:33:23,GET /js/vendor/modernizr-2.8.3.min.js HTTP/1.1,304
72
+ 10.131.2.1,[29/Nov/2017:14:33:23,GET /js/vendor/jquery-1.12.0.min.js HTTP/1.1,304
73
+ 10.131.2.1,[29/Nov/2017:14:33:23,GET /bootstrap-3.3.7/js/bootstrap.min.js HTTP/1.1,304
74
+ 10.128.2.1,[29/Nov/2017:14:33:23,GET /js/vendor/moment.min.js HTTP/1.1,304
75
+ 10.131.2.1,[29/Nov/2017:14:33:26,GET / HTTP/1.1,200
76
+ 10.130.2.1,[29/Nov/2017:14:38:07,GET /compiler.php HTTP/1.1,200
77
+ 10.130.2.1,[29/Nov/2017:14:38:08,GET /home.php HTTP/1.1,200
78
+ 10.130.2.1,[29/Nov/2017:14:38:09,GET /bootstrap-3.3.7/js/bootstrap.js HTTP/1.1,304
79
+ 10.130.2.1,[29/Nov/2017:14:38:13,GET /compiler.php HTTP/1.1,200
80
+ 10.128.2.1,[29/Nov/2017:14:38:40,GET /contest.php HTTP/1.1,200
81
+ 10.128.2.1,[29/Nov/2017:14:38:43,GET /home.php HTTP/1.1,200
82
+ 10.129.2.1,[29/Nov/2017:14:52:51,GET /home.php HTTP/1.1,200
83
+ 10.129.2.1,[29/Nov/2017:14:53:22,GET /compiler.php HTTP/1.1,200
84
+ 10.129.2.1,[29/Nov/2017:14:53:24,GET /home.php HTTP/1.1,200
85
+ 10.131.0.1,[29/Nov/2017:14:54:55,GET /home.php HTTP/1.1,200
86
+ 10.128.2.1,[29/Nov/2017:14:55:46,GET /home.php HTTP/1.1,200
87
+ 10.128.2.1,[29/Nov/2017:14:55:53,GET /contestproblem.php?name=RUET%20OJ%20TLE%20Testing%20Contest HTTP/1.1,200
88
+ 10.128.2.1,[29/Nov/2017:14:55:56,GET /home.php HTTP/1.1,200
89
+ 10.128.2.1,[29/Nov/2017:14:56:00,GET /contest.php HTTP/1.1,200
90
+ 10.128.2.1,[29/Nov/2017:14:56:04,GET /contestproblem.php?name=RUET%20OJ%20Server%20Testing%20Contest HTTP/1.1,200
91
+ 10.128.2.1,[29/Nov/2017:14:56:08,GET /logout.php HTTP/1.1,302
92
+ 10.129.2.1,[29/Nov/2017:14:56:08,GET /login.php HTTP/1.1,200
93
+ 10.129.2.1,[29/Nov/2017:14:56:17,POST /process.php HTTP/1.1,302
94
+ 10.129.2.1,[29/Nov/2017:14:56:18,GET /home.php HTTP/1.1,200
95
+ 10.131.0.1,[29/Nov/2017:15:00:05,GET /contest.php HTTP/1.1,200
96
+ 10.131.2.1,[29/Nov/2017:15:00:53,GET / HTTP/1.1,200
97
+ 10.131.2.1,[29/Nov/2017:15:00:53,GET /fonts/fontawesome-webfont.woff2?v=4.6.3 HTTP/1.1,304
98
+ 10.131.2.1,[29/Nov/2017:15:00:55,GET /contest.php HTTP/1.1,200
99
+ 10.131.2.1,[29/Nov/2017:15:01:00,GET /home.php HTTP/1.1,200
100
+ 10.130.2.1,[29/Nov/2017:15:01:04,GET /contest.php HTTP/1.1,200
@@ -0,0 +1,14 @@
1
+ #usr/bin/env python
2
+
3
+ import sys
4
+
5
+ line= sys.stdin
6
+
7
+ for row in sys.stdin:
8
+ row=row.strip().split(',')
9
+ if len(row) > 7 :
10
+ user_name = row[7].strip()
11
+ binary = str(bin(abs(hash(user_name))))[2:]
12
+ t_zeros = len(binary) - len(binary.rstrip('0'))
13
+ print('%d' % t_zeros)
14
+
@@ -0,0 +1,14 @@
1
+ #usr/bin/env python
2
+ import sys
3
+
4
+ max_trail = 0
5
+ for line in sys.stdin :
6
+ line = line.strip()
7
+ if not line : continue
8
+ try :
9
+ trail = int(line)
10
+ if max_trail < trail :
11
+ max_trail = trail
12
+ except : continue
13
+ else:
14
+ print("Total number of unique uids are : ",2**max_trail)
@@ -0,0 +1,92 @@
1
+ tweet_id,airline_sentiment,airline_sentiment_confidence,negativereason,negativereason_confidence,airline,airline_sentiment_gold,name,negativereason_gold,retweet_count,text,tweet_coord,tweet_created,tweet_location,user_timezone
2
+ 570306133677760513,neutral,1,,,Virgin America,,cairdin,,0,@VirginAmerica What @dhepburn said.,,2/24/2015 11:35,,Eastern Time (US & Canada)
3
+ 570301130888122368,positive,0.3486,,0,Virgin America,,jnardino,,0,@VirginAmerica plus you've added commercials to the experience... tacky.,,2/24/2015 11:15,,Pacific Time (US & Canada)
4
+ 570301083672813571,neutral,0.6837,,,Virgin America,,yvonnalynn,,0,@VirginAmerica I didn't today... Must mean I need to take another trip!,,2/24/2015 11:15,Lets Play,Central Time (US & Canada)
5
+ 570301031407624196,negative,1,Bad Flight,0.7033,Virgin America,,jnardino,,0,"@VirginAmerica it's really aggressive to blast obnoxious ""entertainment"" in your guests' faces &amp; they have little recourse",,2/24/2015 11:15,,Pacific Time (US & Canada)
6
+ 570300817074462722,negative,1,Can't Tell,1,Virgin America,,jnardino,,0,@VirginAmerica and it's a really big bad thing about it,,2/24/2015 11:14,,Pacific Time (US & Canada)
7
+ ,,,,,,,,,,,,,,
8
+ ,,,,,,,,,,,,,,
9
+ ,,,,,,,,,,,,,,
10
+ ,,,,,,,,,,,,,,
11
+ ,,,,,,,,,,,,,,
12
+ ,,,,,,,,,,,,,,
13
+ ,,,,,,,,,,,,,,
14
+ ,,,,,,,,,,,,,,
15
+ ,,,,,,,,,,,,,,
16
+ ,,,,,,,,,,,,,,
17
+ ,,,,,,,,,,,,,,
18
+ ,,,,,,,,,,,,,,
19
+ ,,,,,,,,,,,,,,
20
+ ,,,,,,,,,,,,,,
21
+ ,,,,,,,,,,,,,,
22
+ ,,,,,,,,,,,,,,
23
+ ,,,,,,,,,,,,,,
24
+ ,,,,,,,,,,,,,,
25
+ ,,,,,,,,,,,,,,
26
+ ,,,,,,,,,,,,,,
27
+ ,,,,,,,,,,,,,,
28
+ ,,,,,,,,,,,,,,
29
+ ,,,,,,,,,,,,,,
30
+ ,,,,,,,,,,,,,,
31
+ ,,,,,,,,,,,,,,
32
+ ,,,,,,,,,,,,,,
33
+ ,,,,,,,,,,,,,,
34
+ ,,,,,,,,,,,,,,
35
+ ,,,,,,,,,,,,,,
36
+ ,,,,,,,,,,,,,,
37
+ ,,,,,,,,,,,,,,
38
+ ,,,,,,,,,,,,,,
39
+ ,,,,,,,,,,,,,,
40
+ ,,,,,,,,,,,,,,
41
+ ,,,,,,,,,,,,,,
42
+ ,,,,,,,,,,,,,,
43
+ ,,,,,,,,,,,,,,
44
+ ,,,,,,,,,,,,,,
45
+ ,,,,,,,,,,,,,,
46
+ ,,,,,,,,,,,,,,
47
+ ,,,,,,,,,,,,,,
48
+ ,,,,,,,,,,,,,,
49
+ ,,,,,,,,,,,,,,
50
+ ,,,,,,,,,,,,,,
51
+ ,,,,,,,,,,,,,,
52
+ ,,,,,,,,,,,,,,
53
+ ,,,,,,,,,,,,,,
54
+ ,,,,,,,,,,,,,,
55
+ ,,,,,,,,,,,,,,
56
+ ,,,,,,,,,,,,,,
57
+ ,,,,,,,,,,,,,,
58
+ ,,,,,,,,,,,,,,
59
+ ,,,,,,,,,,,,,,
60
+ ,,,,,,,,,,,,,,
61
+ ,,,,,,,,,,,,,,
62
+ ,,,,,,,,,,,,,,
63
+ ,,,,,,,,,,,,,,
64
+ ,,,,,,,,,,,,,,
65
+ ,,,,,,,,,,,,,,
66
+ ,,,,,,,,,,,,,,
67
+ ,,,,,,,,,,,,,,
68
+ ,,,,,,,,,,,,,,
69
+ ,,,,,,,,,,,,,,
70
+ ,,,,,,,,,,,,,,
71
+ ,,,,,,,,,,,,,,
72
+ ,,,,,,,,,,,,,,
73
+ ,,,,,,,,,,,,,,
74
+ ,,,,,,,,,,,,,,
75
+ ,,,,,,,,,,,,,,
76
+ ,,,,,,,,,,,,,,
77
+ ,,,,,,,,,,,,,,
78
+ ,,,,,,,,,,,,,,
79
+ ,,,,,,,,,,,,,,
80
+ ,,,,,,,,,,,,,,
81
+ ,,,,,,,,,,,,,,
82
+ ,,,,,,,,,,,,,,
83
+ ,,,,,,,,,,,,,,
84
+ ,,,,,,,,,,,,,,
85
+ ,,,,,,,,,,,,,,
86
+ ,,,,,,,,,,,,,,
87
+ ,,,,,,,,,,,,,,
88
+ ,,,,,,,,,,,,,,
89
+ ,,,,,,,,,,,,,,
90
+ ,,,,,,,,,,,,,,
91
+ ,,,,,,,,,,,,,,
92
+ ,,,,,,,,,,,,,,
@@ -0,0 +1,56 @@
1
+ Go to cloudera's Home
2
+ Create a folder named Lab
3
+ Copy the mapper.py & reducer.py into the folder
4
+ ==========================================================
5
+ Run The Commands In The Folder Containing Mapper & Reducer
6
+ ==========================================================
7
+
8
+ =====================
9
+ To Create & Edit File
10
+ =====================
11
+ gedit input.txt
12
+ gedit mapper.py
13
+ gedit reducer.py
14
+
15
+ ==========================
16
+ To View Contents Of A File
17
+ ==========================
18
+ cat input.txt
19
+
20
+ ======================
21
+ To Demonstarte Locally
22
+ ======================
23
+ cat input.txt | python3 mapper.py | sort | python3 reducer.py
24
+
25
+ =============================================================
26
+ Add Files To Hadoop FS (use different name if already exists)
27
+ =============================================================
28
+ hdfs fs -put input.txt
29
+
30
+ =================
31
+ To List The Files
32
+ =================
33
+ hdfs fs -ls
34
+
35
+
36
+ (Note: Change the paths for mapper, reducer, input, output as in your system)
37
+ (output path should be unique)
38
+ ================
39
+ To Execute A Job
40
+ ================
41
+ hadoop jar /usr/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.6.0-mr1-cdh5.4.2.jar \
42
+ -file /home/cloudera/Lab/mapper.py \
43
+ -file /home/cloudera/Lab/reducer.py \
44
+ -mapper "python mapper.py" \
45
+ -reducer "python reducer.py" \
46
+ -input /user/cloudera/input.txt \
47
+ -output /user/cloudera/laboutput
48
+
49
+ hadoop fs -ls /user/cloudera/laboutput
50
+
51
+ hadoop fs -cat /user/cloudera/laboutput/part-00000
52
+
53
+
54
+
55
+
56
+
@@ -0,0 +1,109 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "1c5ce2ae-0abb-45b4-a94a-7548d9af6b6a",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import torch\n",
11
+ "import torchvision\n",
12
+ "from torchvision.models.detection.faster_rcnn import FastRCNNPredictor\n",
13
+ "from torchvision.datasets import VOCDetection\n",
14
+ "from torch.utils.data import DataLoader\n",
15
+ "import torchvision.transforms as T\n",
16
+ "import matplotlib.pyplot as plt\n",
17
+ "import matplotlib.patches as patches\n",
18
+ "\n",
19
+ "classes = [\"__background__\", \"apple\", \"banana\", \"orange\"]\n",
20
+ "\n",
21
+ "def get_model(num_classes):\n",
22
+ " model = torchvision.models.detection.fasterrcnn_resnet50_fpn(weights=\"DEFAULT\")\n",
23
+ " in_features = model.roi_heads.box_predictor.cls_score.in_features\n",
24
+ " model.roi_heads.box_predictor = FastRCNNPredictor(in_features, num_classes)\n",
25
+ " return model\n",
26
+ "\n",
27
+ "def collate_fn(batch):\n",
28
+ " return tuple(zip(*batch))\n",
29
+ "\n",
30
+ "transform = T.Compose([T.ToTensor()])\n",
31
+ "\n",
32
+ "def target_transform(target):\n",
33
+ " objs = target[\"annotation\"][\"object\"]\n",
34
+ " if not isinstance(objs, list):\n",
35
+ " objs = [objs]\n",
36
+ " boxes = []\n",
37
+ " labels = []\n",
38
+ " for obj in objs:\n",
39
+ " name = obj[\"name\"]\n",
40
+ " bbox = obj[\"bndbox\"]\n",
41
+ " xmin, ymin, xmax, ymax = int(bbox[\"xmin\"]), int(bbox[\"ymin\"]), int(bbox[\"xmax\"]), int(bbox[\"ymax\"])\n",
42
+ " boxes.append([xmin, ymin, xmax, ymax])\n",
43
+ " labels.append(classes.index(name) if name in classes else 0)\n",
44
+ " return {\"boxes\": torch.tensor(boxes, dtype=torch.float32), \"labels\": torch.tensor(labels, dtype=torch.int64)}\n",
45
+ "\n",
46
+ "train_dataset = VOCDetection(\"./\", year=\"2012\", image_set=\"train\", download=True, transform=transform, target_transform=target_transform)\n",
47
+ "train_loader = DataLoader(train_dataset, batch_size=2, shuffle=True, collate_fn=collate_fn)\n",
48
+ "\n",
49
+ "model = get_model(len(classes))\n",
50
+ "device = torch.device(\"cpu\")\n",
51
+ "model.to(device)\n",
52
+ "\n",
53
+ "params = [p for p in model.parameters() if p.requires_grad]\n",
54
+ "optimizer = torch.optim.SGD(params, lr=0.005, momentum=0.9, weight_decay=0.0005)\n",
55
+ "\n",
56
+ "num_epochs = 1\n",
57
+ "for epoch in range(num_epochs):\n",
58
+ " model.train()\n",
59
+ " for images, targets in train_loader:\n",
60
+ " images = [img.to(device) for img in images]\n",
61
+ " targets = [{k: v.to(device) for k, v in t.items()} for t in targets]\n",
62
+ " loss_dict = model(images, targets)\n",
63
+ " losses = sum(loss for loss in loss_dict.values())\n",
64
+ " optimizer.zero_grad()\n",
65
+ " losses.backward()\n",
66
+ " optimizer.step()\n",
67
+ " print(f\"Epoch {epoch+1}, Loss: {losses.item():.4f}\")\n",
68
+ "\n",
69
+ "model.eval()\n",
70
+ "images, _ = next(iter(train_loader))\n",
71
+ "img = images[0].to(device)\n",
72
+ "with torch.no_grad():\n",
73
+ " prediction = model([img])\n",
74
+ "\n",
75
+ "img_np = img.permute(1, 2, 0).numpy()\n",
76
+ "fig, ax = plt.subplots(1)\n",
77
+ "ax.imshow(img_np)\n",
78
+ "for box, label, score in zip(prediction[0][\"boxes\"], prediction[0][\"labels\"], prediction[0][\"scores\"]):\n",
79
+ " if score > 0.5:\n",
80
+ " xmin, ymin, xmax, ymax = box\n",
81
+ " rect = patches.Rectangle((xmin, ymin), xmax - xmin, ymax - ymin, linewidth=2, edgecolor='r', facecolor='none')\n",
82
+ " ax.add_patch(rect)\n",
83
+ " ax.text(xmin, ymin, classes[label], bbox=dict(facecolor='yellow', alpha=0.5))\n",
84
+ "plt.show()\n"
85
+ ]
86
+ }
87
+ ],
88
+ "metadata": {
89
+ "kernelspec": {
90
+ "display_name": "Python 3 (ipykernel)",
91
+ "language": "python",
92
+ "name": "python3"
93
+ },
94
+ "language_info": {
95
+ "codemirror_mode": {
96
+ "name": "ipython",
97
+ "version": 3
98
+ },
99
+ "file_extension": ".py",
100
+ "mimetype": "text/x-python",
101
+ "name": "python",
102
+ "nbconvert_exporter": "python",
103
+ "pygments_lexer": "ipython3",
104
+ "version": "3.12.4"
105
+ }
106
+ },
107
+ "nbformat": 4,
108
+ "nbformat_minor": 5
109
+ }
File without changes
File without changes
File without changes
File without changes
File without changes