-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecisionTree.py
More file actions
45 lines (25 loc) · 907 Bytes
/
DecisionTree.py
File metadata and controls
45 lines (25 loc) · 907 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
__author__ = 'CFWLoader'
def load_employee_data(path):
src_data = open(path, 'r')
data_collection = []
for line in src_data:
record = line.split(',')
trans_rec = {}
trans_rec['department'] = record[0]
trans_rec['status'] = record[1]
trans_rec['min age'] = int(record[2])
trans_rec['max age'] = int(record[3])
trans_rec['min salary'] = int(record[4])
trans_rec['max salary'] = int(record[5])
trans_rec['count'] = int(record[6])
data_collection.append(trans_rec)
src_data.close()
return data_collection
def generate_decision_tree(data_coll):
pass
if __name__ == '__main__':
data_collection = load_employee_data('./employees.data')
for record in data_collection:
for key, val in record.items():
print('(', key, ':', val, ')', sep='', end=' ')
print()