-
Notifications
You must be signed in to change notification settings - Fork 2
/
gather_test.py
70 lines (64 loc) · 2.08 KB
/
gather_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
from strlearn.streams import StreamGenerator
import numpy as np
# Variables
clfs = ["HT"]
methods = ["SEA", "KNORAU1"]
random_states = [1994]
distributions = [[0.95, 0.05]]
label_noises = [
0.01,
]
# css = [5, None]
# incremental = [False, True]
drifttype = [(5, False), (5, True), (None, False)]
n_chunks = 24
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=25,
chunk_size=500,
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/experiment_%s/%s.npy" % (clf, stream)
)
scores[i, j, k, l, m] = results
scores = np.mean(scores, axis=1)
np.save("scores2", scores)
print(scores, scores.shape)