- from IPython.display import clear_output
- !pip3 install pycaret --user
- clear_output()
!pip install numpy==1.20.0
- import numpy as np
- import pandas as pd
-
- import random
- import os
-
- from pycaret.classification import *
- TRAIN_PATH = "../input/titanic/train.csv"
- TEST_PATH = "../input/titanic/test.csv"
- SAMPLE_SUBMISSION_PATH = "../input/titanic/gender_submission.csv"
- SUBMISSION_PATH = "submission.csv"
-
- ID = "PassengerId"
- TARGET = "Survived"
-
- SEED = 2022
-
- def seed_everything(seed: int = SEED):
- random.seed(seed)
- np.random.seed(seed)
- os.environ["PYTHONHASHSEED"] = str(seed)
-
- seed_everything()
- import pandas as pd
- train = pd.read_csv(TRAIN_PATH)
- test = pd.read_csv(TEST_PATH)
- test
- setup(
- data=train,
- target=TARGET,
- silent=True
- )
({'lr':, 'knn': , 'nb': , 'dt': , 'svm': , 'rbfsvm': , 'gpc': , 'mlp': , 'ridge': , 'rf': , 'qda': , 'ada': , 'gbc': , 'lda': , 'et': , 'xgboost': , 'lightgbm': , 'catboost': , 'dummy': }, True, 150 0 547 1 125 1 779 1 183 1 .. 370 1 317 0 351 0 339 0 289 1 Name: Survived, Length: 623, dtype: int64, 10, 8860, '88e1', Pipeline(memory=None, steps=[('empty_step', 'passthrough')], verbose=False), False, Age Fare Pclass_1 Pclass_2 Pclass_3 \ 0 22.000000 7.250000 0.0 0.0 1.0 1 38.000000 71.283302 1.0 0.0 0.0 2 26.000000 7.925000 0.0 0.0 1.0 3 35.000000 53.099998 1.0 0.0 0.0 4 35.000000 8.050000 0.0 0.0 1.0 .. ... ... ... ... ... 886 27.000000 13.000000 0.0 1.0 0.0 887 19.000000 30.000000 1.0 0.0 0.0 888 29.466112 23.450001 0.0 0.0 1.0 889 26.000000 30.000000 1.0 0.0 0.0 890 32.000000 7.750000 0.0 0.0 1.0 Name_Aks Mrs. Sam (Leah Rosen) Name_Albimona Mr. Nassef Cassem \ 0 0.0 0.0 1 0.0 0.0 2 0.0 0.0 3 0.0 0.0 4 0.0 0.0 .. ... ... 886 0.0 0.0 887 0.0 0.0 888 0.0 0.0 889 0.0 0.0 890 0.0 0.0 Name_Ali Mr. Ahmed Name_Allen Mr. William Henry \ 0 0.0 0.0 1 0.0 0.0 2 0.0 0.0 3 0.0 0.0 4 0.0 1.0 .. ... ... 886 0.0 0.0 887 0.0 0.0 888 0.0 0.0 889 0.0 0.0 890 0.0 0.0
model = create_model('lightgbm')
tuneModel = tune_model(model,optimize = 'AUC')
plot_model(tuneModel)
plot_model(tuneModel, plot='feature')