added testing_lazypredict that runs 30 ML models in one go
This commit is contained in:
parent
de05652ef6
commit
ab1508e9fb
1 changed files with 39 additions and 0 deletions
39
testing_lazypredict_p1.py
Normal file
39
testing_lazypredict_p1.py
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Mon Mar 14 10:46:44 2022
|
||||
|
||||
@author: tanu
|
||||
"""
|
||||
# Link: https://laptrinhx.com/how-to-run-30-machine-learning-models-with-2-lines-of-code-1521663246/
|
||||
import pyforest
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore")
|
||||
from sklearn import metrics
|
||||
from sklearn.metrics import accuracy_score
|
||||
import lazypredict
|
||||
from lazypredict.Supervised import LazyClassifier
|
||||
|
||||
#%%
|
||||
target = target1
|
||||
#target = target3
|
||||
X_trainN, X_testN, y_trainN, y_testN = train_test_split(numerical_features_df,
|
||||
target,
|
||||
test_size = 0.33,
|
||||
random_state = 42)
|
||||
|
||||
|
||||
#%%
|
||||
clf = LazyClassifier(verbose=0,ignore_warnings=True)
|
||||
modelsN, predictionsN = clf.fit(X_trainN, X_testN, y_trainN, y_testN)
|
||||
mm_lpN = modelsN
|
||||
|
||||
#%%
|
||||
# DOESN't work as need to incorporate pipeline(one hot encoder)
|
||||
models, predictions = clf.fit(X_train, X_test, y_train, y_test)
|
||||
mm_lp = models
|
||||
|
||||
model1 = Pipeline(steps = [('preprocess', MinMaxScaler())
|
||||
, ('multiModels', clf) ])
|
||||
|
||||
models, predictions = model1.fit(X_trainN, X_testN, y_trainN, y_testN)
|
Loading…
Add table
Add a link
Reference in a new issue