-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
140 lines (113 loc) · 4.68 KB
/
test.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# from SmartMachineLearning import SmartML
# print(dir(SmartML))
# from SmartMachineLearning.SmartML import SmartLog
# print(dir(SmartLog))
# from SmartMachineLearning.Metrics.Classification import cm
# print(dir(cm))
# from SmartMachineLearning.Metrics.Classification.cm import CM, deep_analysis, overall_analysis
# print(dir(CM))
# print(dir(deep_analysis))
# print(dir(overall_analysis))
# from SmartMachineLearning.Metrics.Classification.report import Report
# print(dir(Report))
# from SmartMachineLearning.Metrics.Classification.roc_curve import roc_curve_score
# print(dir(roc_curve_score))
# from SmartMachineLearning.Others.utils import to_categorical
# print(dir(to_categorical))
# from SmartMachineLearning.Others.roc_curve_drawing import roc_curve_drawing
# print(dir(roc_curve_drawing))
# from SmartMachineLearning.SmartML import SmartLog
# from random import randint
# import numpy as np
# sl = SmartLog(2, 1, 5, classes=[0, 1])
# y_true = np.array([randint(0, 1) for x in range(100)])
# y_pred = np.array([randint(0, 1) for x in range(100)])
# for x in range(6):
# for y in range(3):
# sl.add_results(y_true=y_true, y_pred=y_pred, params_dict={0 : 1, 1 : 0})
# sl.to_json()
# from SmartMachineLearning.Training import Monitor
# print(dir(Monitor))
# from SmartMachineLearning.Training.Monitor import SmartTraining
# print(dir(SmartTraining))
# from SmartMachineLearning.Training.Classification.ensemble import SmartRandomForest
# from sklearn.datasets import make_classification
# X, y = make_classification(n_samples=1000,
# n_features=10,
# n_classes=2)
# test_params_dict = {
# "n_estimators" : [50, 100],
# "criterion" : ["gini"],
# "max_features" : ["sqrt"],
# "bootstrap" : [True],
# "class_weight" : ["balanced", "balanced_subsample"]}
# srf = SmartRandomForest(number_class=2,
# number_label=1,
# number_fold=5,
# classes=[0, 1],
# X_data=X,
# y_data=y,
# params_dict=test_params_dict)
# srf.smartfit()
# srf.to_json()
# from SmartMachineLearning.Training.Classification.linear_poly import SmartLogisticRegression
# from sklearn.datasets import make_classification
# X, y = make_classification(n_samples=1000,
# n_features=10,
# n_classes=2)
# test_params_dict = {
# "penalty" : ["l2"],
# "fit_intercept" : [True, False],
# "class_weight" : ["balanced", None],
# "solver" : ["newton-cg", "lbfgs", "liblinear", "sag", "saga"]}
# srf = SmartLogisticRegression(number_class=2,
# number_label=1,
# number_fold=5,
# classes=[0, 1],
# X_data=X,
# y_data=y,
# params_dict=test_params_dict)
# srf.smartfit()
# srf.to_json()
# from SmartMachineLearning.Training.Classification.linear_poly import SmartSupportVectorMachine
# from sklearn.datasets import make_classification
# X, y = make_classification(n_samples=1000,
# n_features=10,
# n_classes=2)
# srf = SmartSupportVectorMachine(number_class=2,
# number_label=1,
# number_fold=5,
# classes=[0, 1],
# X_data=X,
# y_data=y)
# srf.smartfit()
# srf.to_json()
# from SmartMachineLearning.Training.Classification.ensemble import SmartDecisionTree
# from sklearn.datasets import make_classification
# X, y = make_classification(n_samples=1000,
# n_features=10,
# n_classes=2)
# srf = SmartDecisionTree(number_class=2,
# number_label=1,
# number_fold=5,
# classes=[0, 1],
# X_data=X,
# y_data=y)
# srf.smartfit()
# srf.to_json()
from ctypes.wintypes import HINSTANCE
from turtle import hideturtle
from SmartMachineLearning.Others.roc_curve_drawing import roc_curve_drawing
from SmartMachineLearning.Training.Classification.ensemble import SmartDecisionTree
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=100,
n_features=10,
n_classes=2)
srf = SmartDecisionTree(number_class=2,
number_label=1,
number_fold=5,
classes=[0, 1],
X_data=X,
y_data=y)
srf.smartfit()
history = srf.get_history()