pip install pycaret
From Jupyter lab
!pip install pycaret
Please be careful as you will get an error if the version of scikit-learn is not 0.22
This time we will use the existing diabetes data. It can be obtained in a data frame directly from get_data of PyCaret.
from pycaret.datasets import get_data
df = get_data("diabetes")
For regression problems
from pycaret.regression import *
For classification problems
from pycaret.classification import *
setup () will encode the category data, handle missing values, and split the data (train_test_split). Specify the target with target =.
experiment = setup(df, target="Class variable")
You can compare models simply by doing the following: It's convenient. k-fold is 10 by default. You can specify the number of folds, etc.
compare_models()
It will highlight the best results in yellow.
This is also easy and can be modeled in one line:
model = create_model("ada")
This time I chose Ada Boost Classifier.
Tuning is also a line! It's too easy.
tuned_model = tune_model("ada")
You can also get the parameters.
tuned_model.get_params
It can be evaluated, visualized and interpreted in order from the top. You can get another graph by putting plot = "boundary" etc. in plot and interpret.
evaluate_model(tuned_model)
plot_model(tuned_model)
interpret_model(tuned_model)
model_pred = predict_model(tuned_model)
It returns the predicted value for the split data.
predictions = predict_model(tuned_model,data=df)
You can make predictions with new data with data =.
I tried using PyCaret at the fastest speed
Recommended Posts