-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
lazy_custom_deep_regression.py
58 lines (48 loc) · 2.26 KB
/
lazy_custom_deep_regression.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
import os
import nnetsauce as ns
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
print(f"\n ----- Running: {os.path.basename(__file__)}... ----- \n")
# without preprocessing
print("\n\nWithout preprocessing")
data = load_diabetes()
X = data.data
y= data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = .2,
random_state = 123)
regr2 = ns.LazyDeepRegressor(n_layers=3, n_hidden_features=2,
verbose=0, ignore_warnings=True, estimators=["ExtraTreesRegressor",
"RandomForestRegressor",
"LassoLarsIC"])
models = regr2.fit(X_train, X_test, y_train, y_test)
model_dictionary = regr2.provide_models(X_train, X_test, y_train, y_test)
print(models)
print(model_dictionary["DeepCustomRegressor(LassoLarsIC)"])
regr = ns.LazyDeepRegressor(n_layers=3, n_hidden_features=2,
verbose=0, ignore_warnings=True)
models = regr.fit(X_train, X_test, y_train, y_test)
model_dictionary = regr.provide_models(X_train, X_test, y_train, y_test)
print(models)
print(model_dictionary["DeepCustomRegressor(LassoLarsIC)"])
# with preprocessing
print("\n\nWith preprocessing")
data = load_diabetes()
X = data.data
y= data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = .2,
random_state = 123)
regr2 = ns.LazyDeepRegressor(n_layers=3, n_hidden_features=2,
verbose=0, ignore_warnings=True, estimators=["ExtraTreesRegressor",
"RandomForestRegressor",
"LassoLarsIC"],
preprocess=True)
models = regr2.fit(X_train, X_test, y_train, y_test)
model_dictionary = regr2.provide_models(X_train, X_test, y_train, y_test)
print(models)
print(model_dictionary["DeepCustomRegressor(LassoLarsIC)"])
regr = ns.LazyDeepRegressor(n_layers=3, n_hidden_features=2,
verbose=0, ignore_warnings=True, preprocess=True)
models = regr.fit(X_train, X_test, y_train, y_test)
model_dictionary = regr.provide_models(X_train, X_test, y_train, y_test)
print(models)
print(model_dictionary["DeepCustomRegressor(LassoLarsIC)"])