39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/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)
|