-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgather_21.py
72 lines (66 loc) · 2.22 KB
/
gather_21.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
from strlearn.streams import StreamGenerator
import numpy as np
# Variables
clfs = ["GNB", "HT", "KNN", "SVM"]
methods = ["NON-KNORAU2", "ROS-KNORAU2", "B2-KNORAU2", "NON-KNORAE2", "ROS-KNORAE2", "B2-KNORAE2"]
random_states = [1994, 1410]
distributions = [[0.97, 0.03]]
label_noises = [
0.01,
0.03,
0.05,
]
drifttype = [(5, False), (5, True), (None, False)]
n_chunks = 199
metrics = ["BAC", "geometric_mean_score", "f_score", "precision", "recall", "specificity"]
scores = np.zeros(
(
len(clfs),
len(random_states),
len(drifttype),
# len(incremental),
len(distributions),
len(label_noises),
# len(css),
len(methods),
n_chunks,
len(metrics),
)
)
print(scores.shape)
# Prepare streams
streams = {}
for i, clf in enumerate(clfs):
for j, random_state in enumerate(random_states):
for k, kurwa in enumerate(drifttype):
for l, distribution in enumerate(distributions):
for m, flip_y in enumerate(label_noises):
# for n, spacing in enumerate(css):
spacing, drift_type = kurwa
stream = StreamGenerator(
incremental=drift_type,
weights=distribution,
random_state=random_state,
y_flip=flip_y,
concept_sigmoid_spacing=spacing,
n_drifts=1,
n_chunks=200,
chunk_size=250,
n_clusters_per_class = 1,
n_features = 8,
n_informative= 8,
n_redundant= 0,
n_repeated = 0,
)
if spacing == None and drift_type == True:
pass
else:
results = np.load(
"results/experiment21_%s/%s.npy" % (clf, stream)
)
scores[i, j, k, l, m] = results
scores_metrics_21 = scores
np.save("scores_metrics_21", scores_metrics_21)
scores = np.mean(scores, axis=1)
np.save("scores_21", scores)
print(scores, scores.shape)