-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
49 lines (39 loc) · 1.57 KB
/
main.py
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
46
47
48
49
import tests
from databaseConnection import DBConnection
import pandas as pd
connection = DBConnection()
connection.database_connection()
# age, workclass, education, maritalstatus, occupation, relationship, race, sex, capitalgain, capitalloss, hoursperweek, nativecountry, income
query_x = "select * from censusdata where id < 100"
query_y = "select age, sex from censusdata where id = 3 or (id > 6 and id < 30) or id = 88"
x = pd.DataFrame(connection.query(query_x))
y = pd.DataFrame(connection.query(query_y))
print('\nInput the max tree depth (None = 0): ')
select = input()
max_depth = int(select)
if max_depth == 0:
max_depth = None
print('\nDo you want to compare all the methods? (y/n)')
select = input()
if select == 'y':
tests.test_all(x, y, query_x, query_y, max_depth)
exit()
print('\nDo you prefer a-priori (pr) or a-posteriory (po) free tuples selection?')
select = input()
if select == 'pr':
print('\nDo you prefer a random or a cluster choice of the free tuples? (r / c)')
selection = input()
if selection == 'c':
tuples_selection_mode = 'c'
else:
tuples_selection_mode = 'r'
tests.test_a_priori_free_tuples_selection(x, y, tuples_selection_mode, max_depth)
else:
print('\nDo you prefer a min_altitude_first(min) approach or a most_important_node_firts(most) approach?')
selection = input()
if selection == 'min':
tuples_selection_mode = 'min'
else:
tuples_selection_mode = 'most'
tests.test_a_posteriori_free_tuples_selection(x, y, tuples_selection_mode, max_depth)
connection.close_connection()