# Install PyCaret 2.0 !pip install pycaret==2.0 # Import pandas for data loading and manipulation import pandas as pd # To render interactive plots in Google Colab from pycaret.utils import enable_colab enable_colab() # Load the data data = pd.read_csv('penguins.csv') data.head() # View the data description data.info() from pycaret.classification import * clf = setup( data=data, target='sex', train_size=0.8, normalize=True, session_id=123 ) # Compare and sort models by AUC compare_models(sort='AUC') # Get the ID of the models help(create_model) # Create an Extra Trees Classifier et = create_model('et') # Tune the classifier tuned_et = tune_model(et, optimize='AUC') tuned_et plot_model(tuned_et) plot_model(tuned_et, plot = 'confusion_matrix') # Precision Recall Curve plot_model(tuned_et, plot = 'pr') plot_model(tuned_et, plot = 'class_report') plot_model(tuned_et, plot='feature') evaluate_model(tuned_et) # Interpret the model using SHAP values interpret_model(tuned_et) # Make predictions on the test set predict_model(tuned_et) # Finalize the model finalize_model(tuned_et) # Save the model save_model(tuned_et, 'et_model_05082020')