-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathconfig.py
112 lines (107 loc) · 3.57 KB
/
config.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
from model_zoo.torch import (TorchLinearRegression, TorchLogisticRegression,
TorchLSTMClassifier, TorchLSTMRegressor,
TorchMLPClassifier, TorchMLPRegressor)
from river import (dummy, evaluate, linear_model, neural_net, optim,
preprocessing, stats)
from deep_river.classification import Classifier as TorchClassifier
from deep_river.classification import \
RollingClassifier as TorchRollingClassifier
from deep_river.regression import Regressor as TorchRegressor
from deep_river.regression import RollingRegressor as TorchRollingRegressor
N_CHECKPOINTS = 50
LEARNING_RATE = 0.005
TRACKS = [
evaluate.BinaryClassificationTrack(),
evaluate.MultiClassClassificationTrack(),
evaluate.RegressionTrack(),
]
MODELS = {
"Binary classification": {
"Logistic regression": (
preprocessing.StandardScaler()
| linear_model.LogisticRegression(
optimizer=optim.SGD(LEARNING_RATE)
)
)
},
"Multiclass classification": {
"Torch Logistic Regression": (
preprocessing.StandardScaler()
| TorchClassifier(
module=TorchLogisticRegression,
loss_fn="binary_cross_entropy",
optimizer_fn="sgd",
is_class_incremental=True,
lr=LEARNING_RATE,
)
),
"Torch MLP": (
preprocessing.StandardScaler()
| TorchClassifier(
module=TorchMLPClassifier,
loss_fn="binary_cross_entropy",
optimizer_fn="sgd",
is_class_incremental=True,
lr=LEARNING_RATE,
)
),
"Torch LSTM": (
preprocessing.StandardScaler()
| TorchRollingClassifier(
module=TorchLSTMClassifier,
loss_fn="binary_cross_entropy",
optimizer_fn="sgd",
is_class_incremental=True,
lr=LEARNING_RATE,
window_size=20,
append_predict=False,
hidden_size=10,
)
),
"[baseline] Last Class": dummy.NoChangeClassifier(),
},
"Regression": {
"Torch Linear Regression": (
preprocessing.StandardScaler()
| TorchRegressor(
module=TorchLinearRegression,
loss_fn="mse",
optimizer_fn="sgd",
lr=LEARNING_RATE,
)
),
"Torch MLP": (
preprocessing.StandardScaler()
| TorchRegressor(
module=TorchMLPRegressor,
loss_fn="mse",
optimizer_fn="sgd",
lr=LEARNING_RATE,
)
),
"River MLP": preprocessing.StandardScaler()
| neural_net.MLPRegressor(
hidden_dims=(5,),
activations=(
neural_net.activations.ReLU,
neural_net.activations.ReLU,
neural_net.activations.Identity,
),
optimizer=optim.SGD(1e-3),
seed=42,
),
"Torch LSTM": (
preprocessing.StandardScaler()
| TorchRollingRegressor(
module=TorchLSTMRegressor,
loss_fn="mse",
optimizer_fn="sgd",
lr=LEARNING_RATE,
window_size=20,
append_predict=False,
hidden_size=10,
)
),
"[baseline] Mean predictor": dummy.StatisticRegressor(stats.Mean()),
},
}