-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclassifier.py
More file actions
29 lines (23 loc) · 788 Bytes
/
Copy pathclassifier.py
File metadata and controls
29 lines (23 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import division
import features
import compare
def main():
below50k = features.Features("below50k")
above50k = features.Features("above50k")
with open("sample.txt", 'rb') as f:
for line in f:
feature = line.split(',')
outcome = feature[14].rstrip()
if (outcome == ' <=50K'):
below50k.takeFeatures(feature)
if (outcome == ' >50K'):
above50k.takeFeatures(feature)
below50k.calculateNumericAverages()
below50k.calculateDiscreteAverages()
above50k.calculateNumericAverages()
above50k.calculateDiscreteAverages()
comparer = compare.CompareFeatures(below50k, above50k)
comparer.Compare()
comparer.Print()
if __name__ == '__main__':
main()