noshot 12.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 (56) hide show
  1. {noshot-12.0.0 → noshot-14.0.0}/PKG-INFO +1 -1
  2. {noshot-12.0.0 → noshot-14.0.0}/noshot.egg-info/PKG-INFO +1 -1
  3. noshot-14.0.0/noshot.egg-info/SOURCES.txt +53 -0
  4. {noshot-12.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)/1.1 DNN (Pytorch).ipynb +164 -0
  23. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.2 DNN (Tensorflow).ipynb +94 -0
  24. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.3 DNN (Image Classification).ipynb +134 -0
  25. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.1 DNN vs CNN.ipynb +127 -0
  26. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.2 DNN vs CNN.ipynb +123 -0
  27. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/3 Bounding Boxes.ipynb +109 -0
  28. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/4. FCNN (Image Segmentation).ipynb +108 -0
  29. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Lab Excercise (Training DNN).ipynb +646 -0
  30. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Load-Images.ipynb +553 -0
  31. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex1.ipynb +216 -0
  32. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex2.ipynb +195 -0
  33. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex3.ipynb +427 -0
  34. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex4.ipynb +186 -0
  35. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/DNN Ex No 1.ipynb +398 -0
  36. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Ex No 1 Build in dataset.ipynb +171 -0
  37. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Exp1-Short-DL_ANN_ImageClassification.ipynb +401 -0
  38. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/OR GATE .ipynb +8511 -0
  39. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp02/Exp2-Short-DL_CNN_ImageClassification.ipynb +737 -0
  40. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp03/DL-Ex3-RNN.ipynb +591 -0
  41. noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp04/Ex no 4.ipynb +551 -0
  42. noshot-12.0.0/noshot.egg-info/SOURCES.txt +0 -16
  43. {noshot-12.0.0 → noshot-14.0.0}/LICENSE.txt +0 -0
  44. {noshot-12.0.0 → noshot-14.0.0}/README.md +0 -0
  45. {noshot-12.0.0 → noshot-14.0.0}/noshot.egg-info/dependency_links.txt +0 -0
  46. {noshot-12.0.0 → noshot-14.0.0}/noshot.egg-info/not-zip-safe +0 -0
  47. {noshot-12.0.0 → noshot-14.0.0}/noshot.egg-info/top_level.txt +0 -0
  48. {noshot-12.0.0 → noshot-14.0.0}/setup.cfg +0 -0
  49. {noshot-12.0.0 → noshot-14.0.0}/src/noshot/__init__.py +0 -0
  50. {noshot-12.0.0/src/noshot/data/DLE FSD BDA/DLE → noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)}/1. DNN (Image Classification).ipynb +0 -0
  51. {noshot-12.0.0/src/noshot/data/DLE FSD BDA/DLE → noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)}/2. DNN vs CNN.ipynb +0 -0
  52. {noshot-12.0.0/src/noshot/data/DLE FSD BDA/DLE → noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)}/3. CNN (Object Detecrion).ipynb +0 -0
  53. {noshot-12.0.0/src/noshot/data/DLE FSD BDA/DLE → noshot-14.0.0/src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)}/4. FCN (Image Segmentaion).ipynb +0 -0
  54. {noshot-12.0.0 → noshot-14.0.0}/src/noshot/main.py +0 -0
  55. {noshot-12.0.0 → noshot-14.0.0}/src/noshot/utils/__init__.py +0 -0
  56. {noshot-12.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: 12.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: 12.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
@@ -0,0 +1,53 @@
1
+ LICENSE.txt
2
+ README.md
3
+ setup.py
4
+ noshot.egg-info/PKG-INFO
5
+ noshot.egg-info/SOURCES.txt
6
+ noshot.egg-info/dependency_links.txt
7
+ noshot.egg-info/not-zip-safe
8
+ noshot.egg-info/top_level.txt
9
+ src/noshot/__init__.py
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
28
+ src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/1. DNN (Image Classification).ipynb
29
+ src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/2. DNN vs CNN.ipynb
30
+ src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/3. CNN (Object Detecrion).ipynb
31
+ src/noshot/data/DLE FSD BDA/DLE/DLE 1 (Json)/4. FCN (Image Segmentaion).ipynb
32
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.1 DNN (Pytorch).ipynb
33
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.2 DNN (Tensorflow).ipynb
34
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/1.3 DNN (Image Classification).ipynb
35
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/2.1 DNN vs CNN.ipynb
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
38
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/4. FCNN (Image Segmentation).ipynb
39
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Lab Excercise (Training DNN).ipynb
40
+ src/noshot/data/DLE FSD BDA/DLE/DLE 2 (tim stan s)/Load-Images.ipynb
41
+ src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex1.ipynb
42
+ src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex2.ipynb
43
+ src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex3.ipynb
44
+ src/noshot/data/DLE FSD BDA/DLE/DLE 3 (sonic boy)/Ex4.ipynb
45
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/DNN Ex No 1.ipynb
46
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Ex No 1 Build in dataset.ipynb
47
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/Exp1-Short-DL_ANN_ImageClassification.ipynb
48
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp01/OR GATE .ipynb
49
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp02/Exp2-Short-DL_CNN_ImageClassification.ipynb
50
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp03/DL-Ex3-RNN.ipynb
51
+ src/noshot/data/DLE FSD BDA/DLE/DLE 4 (senior)/Exp04/Ex no 4.ipynb
52
+ src/noshot/utils/__init__.py
53
+ src/noshot/utils/shell_utils.py
@@ -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="12.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()