-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
lazy_custom_regression.py
33 lines (28 loc) · 1.38 KB
/
lazy_custom_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
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")
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)
regr = ns.LazyRegressor(verbose=0, ignore_warnings=True, custom_metric=None,
preprocess=True,
estimators=["RandomForestRegressor", "ExtraTreesRegressor"])
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["CustomRegressor(RandomForestRegressor)"])
regr = ns.LazyRegressor(verbose=0, ignore_warnings=True, custom_metric=None,
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["CustomRegressor(RandomForestRegressor)"])
regr2 = ns.LazyRegressor(verbose=0, ignore_warnings=True, custom_metric=None,
preprocess=False)
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["CustomRegressor(RandomForestRegressor)"])