<jupyter_start><jupyter_text>Pycaret Install<jupyter_code>!pip install pycaret<jupyter_output>Collecting pycaret
  Downloading pycaret-2.3.5-py3-none-any.whl (288 kB)
[?25l
[K     |█▏                              | 10 kB 22.7 MB/s eta 0:00:01
[K     |██▎                             | 20 kB 26.1 MB/s eta 0:00:01
[K     |███▍                            | 30 kB 27.5 MB/s eta 0:00:01
[K     |████▌                           | 40 kB 28.1 MB/s eta 0:00:01
[K     |█████▊                          | 51 kB 30.1 MB/s eta 0:00:01
[K     |██████▉                         | 61 kB 32.1 MB/s eta 0:00:01
[K     |████████                        | 71 kB 32.2 MB/s eta 0:00:01
[K     |█████████                       | 81 kB 32.7 MB/s eta 0:00:01
[K     |██████████▏                     | 92 kB 34.3 MB/s eta 0:00:01
[K     |███████████▍                    | 102 kB 35.9 MB/s eta 0:00:01
[K     |████████████▌                   | 112 kB 35.9 MB/s eta 0:00:01
[K     |█████████████▋                  | 122 kB 35.9 MB/s eta 0:00:01
[K     |██████████████▊                 | 133 kB 35.9 MB/s eta 0[...]<jupyter_text>Data Load Import King-Rook vs. King-Pawn Dataset10% removed as unseen data to later test the model<jupyter_code># <NAME> - 991324091
# December 12th 2021
# Sheridan College

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from pycaret.utils import enable_colab
from pycaret.classification import *
from pycaret.datasets import get_data

enable_colab()
df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/chess/king-rook-vs-king-pawn/kr-vs-kp.data')

data = df.sample(frac=0.9)
data_unseen = df.drop(data.index)

data.reset_index(drop=True, inplace=True)
data_unseen.reset_index(drop=True, inplace=True)

print('Data for Modeling: ' + str(data.shape))
print('Unseen Data For Predictions: ' + str(data_unseen.shape))
class_setup = setup(data=data, target='won')<jupyter_output><empty_output><jupyter_text>All models Comparing all models<jupyter_code>best = compare_models()<jupyter_output><empty_output><jupyter_text>K-Nearest Neighbour<jupyter_code># K-Nearest Neighbour Algorithm Model

knn = create_model('knn')
print(knn)
# Tuned KNN Model

tuned_knn = tune_model(knn)
evaluate_model(tuned_knn)<jupyter_output><empty_output><jupyter_text>Decision Tree<jupyter_code># Decision Tree Algorithm Model

dt = create_model('dt')
print(dt)
# Tuned DT

tuned_dt = tune_model(dt)
evaluate_model(tuned_dt)<jupyter_output><empty_output><jupyter_text>Logistic Regression<jupyter_code># Logistic Regression Algorithm Model

lr = create_model('lr')
print(lr)
# Tuned LR

tuned_lr = tune_model(lr)
evaluate_model(tuned_lr)<jupyter_output><empty_output><jupyter_text>Naive Bayes<jupyter_code># Naive Bayes Algorithm

nb = create_model('nb')
# Tuned NB

tuned_nb = tune_model(nb)
evaluate_model(tuned_nb)<jupyter_output><empty_output><jupyter_text>Finalized Models<jupyter_code>final_knn = finalize_model(tuned_knn)
final_dt = finalize_model(tuned_dt)
final_lr = finalize_model(tuned_lr)
final_nb = finalize_model(tuned_nb)<jupyter_output><empty_output><jupyter_text>Unseen Data Prediction KNN<jupyter_code>unseen_predictions_knn = predict_model(final_knn, data = data_unseen)
unseen_predictions_knn.head()<jupyter_output><empty_output><jupyter_text>Decision Tree<jupyter_code>unseen_predictions_dt = predict_model(final_dt, data = data_unseen)
unseen_predictions_dt.head()<jupyter_output><empty_output><jupyter_text>Logistic Regression<jupyter_code>unseen_predictions_lr = predict_model(final_lr, data = data_unseen)
unseen_predictions_lr.head()<jupyter_output><empty_output><jupyter_text>Naive Bayes<jupyter_code>unseen_predictions_nb = predict_model(final_nb, data = data_unseen)
unseen_predictions_nb.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13638743455497382, 'fraction_numerical': 0.041361256544502616, 'mean_word_length': 4.014435695538058, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '284349', 'license': 'MIT', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1488, 'n_words': 259, 'path': 'Research_Paper.ipynb', 'repo_name': 'JacobHazzard/AI-Chess-Classification', 'size': '3827'}