#Import des différentes librairies
import pandas as pd
import numpy as np
import plotly.express as px
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import preprocessing
from sklearn.linear_model import RidgeClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import cross_validate, cross_val_score, validation_curve, train_test_split
from sklearn.metrics import confusion_matrix, plot_confusion_matrix
pogo = pd.read_csv("pogo_meta_data.csv")
pogo
#somme des valeurs null
pogo.isnull().sum()
new_pogo = pogo
new_pogo = new_pogo.drop(columns=['Pokemon', 'Fast Move', 'Charged Move 1','Charged Move 2'])
new_pogo = new_pogo.drop(columns=['Attack'])
new_pogo = new_pogo.drop(columns=['Defense'])
new_pogo = new_pogo.drop(columns=['Stamina'])
new_pogo = new_pogo.drop(columns=['Damage_CM_1'])
new_pogo = new_pogo.drop(columns=['Energy_CM_1'])
new_pogo = new_pogo.drop(columns=['Damage_CM_2'])
new_pogo = new_pogo.drop(columns=['Energy_CM_2'])
new_pogo = new_pogo.drop(columns=['Level'])
for i in range(len(pogo['Type 1'])) :
if (new_pogo['Type 1'][i] == 'bug'):
new_pogo['Type 1'][i] = 1
elif (new_pogo['Type 1'][i] == 'dark'):
new_pogo['Type 1'][i] = 2
if (new_pogo['Type 1'][i] == 'dragon'):
new_pogo['Type 1'][i] = 3
elif (new_pogo['Type 1'][i] == 'electric'):
new_pogo['Type 1'][i] = 4
elif (new_pogo['Type 1'][i] == 'fairy'):
new_pogo['Type 1'][i] = 5
elif (new_pogo['Type 1'][i] == 'fighting'):
new_pogo['Type 1'][i] = 6
elif (new_pogo['Type 1'][i] == 'fire'):
new_pogo['Type 1'][i] = 7
elif (new_pogo['Type 1'][i] == 'flying'):
new_pogo['Type 1'][i] = 8
elif (new_pogo['Type 1'][i] == 'ghost'):
new_pogo['Type 1'][i] = 9
elif (new_pogo['Type 1'][i] == 'grass'):
new_pogo['Type 1'][i] = 10
elif (new_pogo['Type 1'][i] == 'ground'):
new_pogo['Type 1'][i] = 11
elif (new_pogo['Type 1'][i] == 'ice'):
new_pogo['Type 1'][i] = 12
elif (new_pogo['Type 1'][i] == 'normal'):
new_pogo['Type 1'][i] = 13
elif (new_pogo['Type 1'][i] == 'poison'):
new_pogo['Type 1'][i] = 14
elif (new_pogo['Type 1'][i] == 'psychic'):
new_pogo['Type 1'][i] = 15
elif (new_pogo['Type 1'][i] == 'rock'):
new_pogo['Type 1'][i] = 16
elif (new_pogo['Type 1'][i] == 'steel'):
new_pogo['Type 1'][i] = 17
elif (new_pogo['Type 1'][i] == 'water'):
new_pogo['Type 1'][i] = 18
new_pogo['Type 1'] = new_pogo['Type 1'].astype(int)
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:13: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
del sys.path[0]
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:31: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:37: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:23: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:7: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
import sys
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:5: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
"""
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:27: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:33: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:35: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:21: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
This is separate from the ipykernel package so we can avoid doing imports until
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:25: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:9: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
if __name__ == '__main__':
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:19: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:11: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
# This is added back by InteractiveShellApp.init_path()
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:15: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
from ipykernel import kernelapp as app
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:29: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:17: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
for i in range(len(pogo['Type 2'])) :
if (new_pogo['Type 2'][i] == 'bug'):
new_pogo['Type 2'][i] = 1
elif (new_pogo['Type 2'][i] == 'dark'):
new_pogo['Type 2'][i] = 2
elif (new_pogo['Type 2'][i] == 'dragon'):
new_pogo['Type 2'][i] = 3
elif (new_pogo['Type 2'][i] == 'electric'):
new_pogo['Type 2'][i] = 4
elif (new_pogo['Type 2'][i] == 'fairy'):
new_pogo['Type 2'][i] = 5
elif (new_pogo['Type 2'][i] == 'fighting'):
new_pogo['Type 2'][i] = 6
elif (new_pogo['Type 2'][i] == 'fire'):
new_pogo['Type 2'][i] = 7
elif (new_pogo['Type 2'][i] == 'flying'):
new_pogo['Type 2'][i] = 8
elif (new_pogo['Type 2'][i] == 'ghost'):
new_pogo['Type 2'][i] = 9
elif (new_pogo['Type 2'][i] == 'grass'):
new_pogo['Type 2'][i] = 10
elif (new_pogo['Type 2'][i] == 'ground'):
new_pogo['Type 2'][i] = 11
elif (new_pogo['Type 2'][i] == 'ice'):
new_pogo['Type 2'][i] = 12
elif (new_pogo['Type 2'][i] == 'normal'):
new_pogo['Type 2'][i] = 13
elif (new_pogo['Type 2'][i] == 'poison'):
new_pogo['Type 2'][i] = 14
elif (new_pogo['Type 2'][i] == 'psychic'):
new_pogo['Type 2'][i] = 15
elif (new_pogo['Type 2'][i] == 'rock'):
new_pogo['Type 2'][i] = 16
elif (new_pogo['Type 2'][i] == 'steel'):
new_pogo['Type 2'][i] = 17
elif (new_pogo['Type 2'][i] == 'water'):
new_pogo['Type 2'][i] = 18
else :
new_pogo['Type 2'][i] = 0
new_pogo['Type 2'] = new_pogo['Type 2'].astype(int)
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:31: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:39: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:11: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
# This is added back by InteractiveShellApp.init_path()
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:35: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:17: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:19: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:23: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:13: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
del sys.path[0]
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:7: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
import sys
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:25: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:29: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:9: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
if __name__ == '__main__':
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:5: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
"""
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:27: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:21: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:37: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:33: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:15: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
from ipykernel import kernelapp as app
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:3: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
This is separate from the ipykernel package so we can avoid doing imports until
for i in range(len(new_pogo)) :
new_pogo['Score'][i] = 0
for i in range(100) :
new_pogo['Score'][i] = 1
new_pogo.Score = new_pogo.Score.astype(int)
new_pogo = new_pogo.rename(columns={'Score':'Top 100'})
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:2: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:4: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
after removing the cwd from sys.path.
new_pogo
corr = pogo.corr()
print(corr)
plt.subplots(figsize=(8,8))
ax = plt.axes()
ax.set_title("Matrice de corrélation")
sns.heatmap(corr,
xticklabels=corr.columns.values,
yticklabels=corr.columns.values)
Score Attack Defense Stamina Stat Product Level \
Score 1.000000 -0.113979 0.282940 0.153467 0.535324 -0.238684
Attack -0.113979 1.000000 -0.547015 -0.525488 -0.507613 -0.465828
Defense 0.282940 -0.547015 1.000000 -0.190551 0.642976 0.042498
Stamina 0.153467 -0.525488 -0.190551 1.000000 0.404024 0.254344
Stat Product 0.535324 -0.507613 0.642976 0.404024 1.000000 -0.064741
Level -0.238684 -0.465828 0.042498 0.254344 -0.064741 1.000000
Damage_CM_1 -0.002871 -0.028875 0.114613 0.024145 0.130398 -0.180574
Energy_CM_1 0.142997 0.090662 -0.155997 -0.059984 -0.162322 0.066640
DPE_CM_1 0.133515 0.045956 0.019249 -0.014058 0.044885 -0.225004
Damage_CM_2 0.098027 -0.037465 0.102632 0.067702 0.218223 -0.185613
Energy_CM_2 0.007311 0.142522 -0.103984 -0.165245 -0.223000 0.048467
DPE_CM_2 0.185503 0.086771 0.057926 -0.043602 0.139686 -0.279983
Damage_FM -0.078074 -0.048694 0.048968 -0.023492 -0.022074 -0.057693
Turns_FM -0.104647 -0.007350 0.062810 -0.051350 0.010877 -0.094079
Energy_FM 0.066375 0.055777 0.054567 -0.092619 0.018328 -0.133009
CD_FM -0.106030 -0.006853 0.063134 -0.052326 0.009903 -0.094061
DPT_FM -0.025216 -0.056409 -0.026055 0.033080 -0.069206 0.033730
EPT_FM 0.329813 0.123698 0.029056 -0.116075 0.027020 -0.130273
Damage_CM_1 Energy_CM_1 DPE_CM_1 Damage_CM_2 Energy_CM_2 \
Score -0.002871 0.142997 0.133515 0.098027 0.007311
Attack -0.028875 0.090662 0.045956 -0.037465 0.142522
Defense 0.114613 -0.155997 0.019249 0.102632 -0.103984
Stamina 0.024145 -0.059984 -0.014058 0.067702 -0.165245
Stat Product 0.130398 -0.162322 0.044885 0.218223 -0.223000
Level -0.180574 0.066640 -0.225004 -0.185613 0.048467
Damage_CM_1 1.000000 -0.814837 0.791948 -0.031377 0.054774
Energy_CM_1 -0.814837 1.000000 -0.302243 -0.016811 0.065090
DPE_CM_1 0.791948 -0.302243 1.000000 -0.069179 0.149114
Damage_CM_2 -0.031377 -0.016811 -0.069179 1.000000 -0.867229
Energy_CM_2 0.054774 0.065090 0.149114 -0.867229 1.000000
DPE_CM_2 -0.004455 0.058615 0.044341 0.820571 -0.446475
Damage_FM 0.099915 -0.111782 0.055382 0.084872 -0.048102
Turns_FM 0.108827 -0.126687 0.054651 0.116035 -0.089320
Energy_FM 0.096032 -0.110231 0.048418 0.109695 -0.094183
CD_FM 0.110811 -0.127374 0.057124 0.113847 -0.089477
DPT_FM 0.008401 0.006400 0.024173 -0.020806 0.040438
EPT_FM 0.028892 -0.044379 -0.001181 0.052617 -0.059969
DPE_CM_2 Damage_FM Turns_FM Energy_FM CD_FM DPT_FM \
Score 0.185503 -0.078074 -0.104647 0.066375 -0.106030 -0.025216
Attack 0.086771 -0.048694 -0.007350 0.055777 -0.006853 -0.056409
Defense 0.057926 0.048968 0.062810 0.054567 0.063134 -0.026055
Stamina -0.043602 -0.023492 -0.051350 -0.092619 -0.052326 0.033080
Stat Product 0.139686 -0.022074 0.010877 0.018328 0.009903 -0.069206
Level -0.279983 -0.057693 -0.094079 -0.133009 -0.094061 0.033730
Damage_CM_1 -0.004455 0.099915 0.108827 0.096032 0.110811 0.008401
Energy_CM_1 0.058615 -0.111782 -0.126687 -0.110231 -0.127374 0.006400
DPE_CM_1 0.044341 0.055382 0.054651 0.048418 0.057124 0.024173
Damage_CM_2 0.820571 0.084872 0.116035 0.109695 0.113847 -0.020806
Energy_CM_2 -0.446475 -0.048102 -0.089320 -0.094183 -0.089477 0.040438
DPE_CM_2 1.000000 0.110856 0.113444 0.091178 0.109513 0.027102
Damage_FM 0.110856 1.000000 0.777560 0.411128 0.776794 0.682434
Turns_FM 0.113444 0.777560 1.000000 0.856398 0.999028 0.116153
Energy_FM 0.091178 0.411128 0.856398 1.000000 0.857986 -0.298992
CD_FM 0.109513 0.776794 0.999028 0.857986 1.000000 0.116100
DPT_FM 0.027102 0.682434 0.116153 -0.298992 0.116100 1.000000
EPT_FM 0.013604 -0.475533 -0.015197 0.471976 -0.012878 -0.807526
EPT_FM
Score 0.329813
Attack 0.123698
Defense 0.029056
Stamina -0.116075
Stat Product 0.027020
Level -0.130273
Damage_CM_1 0.028892
Energy_CM_1 -0.044379
DPE_CM_1 -0.001181
Damage_CM_2 0.052617
Energy_CM_2 -0.059969
DPE_CM_2 0.013604
Damage_FM -0.475533
Turns_FM -0.015197
Energy_FM 0.471976
CD_FM -0.012878
DPT_FM -0.807526
EPT_FM 1.000000
corr = new_pogo.corr()
print(corr)
plt.subplots(figsize=(8,8))
ax = plt.axes()
ax.set_title("Matrice de corrélation")
sns.heatmap(corr,
xticklabels=corr.columns.values,
yticklabels=corr.columns.values)
Top 100 Type 1 Type 2 Stat Product DPE_CM_1 DPE_CM_2 \
Top 100 1.000000 0.013708 0.060412 0.368534 0.128203 0.110829
Type 1 0.013708 1.000000 -0.041182 0.190996 0.009389 0.038259
Type 2 0.060412 -0.041182 1.000000 0.123787 0.009723 -0.044982
Stat Product 0.368534 0.190996 0.123787 1.000000 0.044885 0.139686
DPE_CM_1 0.128203 0.009389 0.009723 0.044885 1.000000 0.044341
DPE_CM_2 0.110829 0.038259 -0.044982 0.139686 0.044341 1.000000
Damage_FM -0.070637 0.085976 0.063265 -0.022074 0.055382 0.110856
Turns_FM -0.069127 0.071432 0.043044 0.010877 0.054651 0.113444
Energy_FM 0.012773 0.004264 0.035857 0.018328 0.048418 0.091178
CD_FM -0.068714 0.071098 0.042580 0.009903 0.057124 0.109513
DPT_FM -0.041348 0.008319 0.021209 -0.069206 0.024173 0.027102
EPT_FM 0.174814 -0.076898 0.026652 0.027020 -0.001181 0.013604
Damage_FM Turns_FM Energy_FM CD_FM DPT_FM EPT_FM
Top 100 -0.070637 -0.069127 0.012773 -0.068714 -0.041348 0.174814
Type 1 0.085976 0.071432 0.004264 0.071098 0.008319 -0.076898
Type 2 0.063265 0.043044 0.035857 0.042580 0.021209 0.026652
Stat Product -0.022074 0.010877 0.018328 0.009903 -0.069206 0.027020
DPE_CM_1 0.055382 0.054651 0.048418 0.057124 0.024173 -0.001181
DPE_CM_2 0.110856 0.113444 0.091178 0.109513 0.027102 0.013604
Damage_FM 1.000000 0.777560 0.411128 0.776794 0.682434 -0.475533
Turns_FM 0.777560 1.000000 0.856398 0.999028 0.116153 -0.015197
Energy_FM 0.411128 0.856398 1.000000 0.857986 -0.298992 0.471976
CD_FM 0.776794 0.999028 0.857986 1.000000 0.116100 -0.012878
DPT_FM 0.682434 0.116153 -0.298992 0.116100 1.000000 -0.807526
EPT_FM -0.475533 -0.015197 0.471976 -0.012878 -0.807526 1.000000
sns.distplot(new_pogo['Stat Product'])
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
sns.distplot(new_pogo['Type 1'])
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
sns.distplot(new_pogo['Type 2'])
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
fig, ( ax1, ax2) = plt.subplots(ncols=2,figsize=(19,5), sharey=True)
fig.suptitle("Répartition des Type")
ax1.hist(pogo['Type 1'],bins = 18, color = 'red', edgecolor='black')
ax1.set(ylabel="Nombre d'individus ", xlabel="Noms des Type 1")
ax1.tick_params(labelrotation=45)
ax2.hist(pogo['Type 2'],bins = 19, edgecolor='black')
ax2.set(xlabel="Noms des Type 2")
ax2.tick_params(labelrotation=45)
plt.show()
Type1 = pogo['Type 1'].value_counts()
Type2 = pogo['Type 2'].value_counts()
(Type1, Type2)
sns.distplot(new_pogo.DPE_CM_1)
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
sns.distplot(new_pogo.DPE_CM_2)
/shared-libs/python3.7/py/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
warnings.warn(msg, FutureWarning)
best_pogo = pogo.iloc[1:100]
best_pogo
best_pogo.max()
np.mean(best_pogo)
best_pogo.min()
#séparation de la variable score et des autres variables
X = new_pogo.drop(columns=['Top 100'])
y = new_pogo['Top 100']
#séparation aléatoire en deux sous-ensembles
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)
values, counts = np.unique(y_train, return_counts=True)
all_values, all_counts = np.unique(y, return_counts=True)
#On verfie que le nombre d'individu de chaque classe est suffisant
ok = True
while ok :
for c in range(len(counts)) :
if (all_counts[c] - counts[c] < 5) :
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)
values, counts = np.unique(y_train, return_counts=True)
c = 0
ok = True
else :
ok = False
print(counts)
[0 1]
[467 76]
[579 100]
[467 76]
score_array = []
#Retourne le tuple avec le nom et les scores d'un classifier
def compute_scores(name, classifier, X, y):
s = cross_validate (classifier, X, y)
sco = {'label' : t, 'fit_time' : s['fit_time'], 'score_time' : s['score_time'], 'test_score' : s["test_score"].mean()}
return sco
n_neighbors = [1, 2, 3, 5]
weights = ['uniform', 'distance']
algorithm = ['ball_tree', 'kd_tree', 'brute']
for n in n_neighbors:
for w in weights:
for a in algorithm:
t = "kneighbors_" + str(n) + "_" + w + "_" + a
sco = compute_scores(t, KNeighborsClassifier(n_neighbors=n, weights=w, algorithm=a), x_test, y_test)
score_array.append(sco)
print(sco)
{'label': 'kneighbors_1_uniform_ball_tree', 'fit_time': array([0.00412893, 0.00249887, 0.00343847, 0.00242209, 0.00425768]), 'score_time': array([0.00528669, 0.00319576, 0.00311661, 0.00594497, 0.00489259]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_1_uniform_kd_tree', 'fit_time': array([0.00374985, 0.00584149, 0.00284672, 0.00270295, 0.00237966]), 'score_time': array([0.00478554, 0.00797391, 0.00342488, 0.00310421, 0.00308156]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_1_uniform_brute', 'fit_time': array([0.00231147, 0.00221539, 0.00220251, 0.0021894 , 0.00221372]), 'score_time': array([0.00295877, 0.00286412, 0.00283098, 0.00305676, 0.00279665]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_1_distance_ball_tree', 'fit_time': array([0.00252509, 0.00232291, 0.00233603, 0.00229907, 0.00230956]), 'score_time': array([0.00237513, 0.00233507, 0.00229502, 0.00233912, 0.0024507 ]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_1_distance_kd_tree', 'fit_time': array([0.00242376, 0.00230718, 0.0023675 , 0.00237155, 0.00267386]), 'score_time': array([0.00234437, 0.00232697, 0.00243878, 0.00230265, 0.0023694 ]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_1_distance_brute', 'fit_time': array([0.0022192 , 0.00248051, 0.00268435, 0.00242567, 0.00279737]), 'score_time': array([0.0021944 , 0.00228667, 0.00278807, 0.0025425 , 0.00224257]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_2_uniform_ball_tree', 'fit_time': array([0.00238466, 0.00233865, 0.00236058, 0.00233579, 0.00233293]), 'score_time': array([0.00317287, 0.00302386, 0.0030508 , 0.00311494, 0.00300026]), 'test_score': 0.8013227513227512}
{'label': 'kneighbors_2_uniform_kd_tree', 'fit_time': array([0.00242043, 0.00285792, 0.00285482, 0.00298381, 0.00244236]), 'score_time': array([0.00313115, 0.00320983, 0.00408745, 0.00325966, 0.00312233]), 'test_score': 0.8013227513227512}
{'label': 'kneighbors_2_uniform_brute', 'fit_time': array([0.00241232, 0.00225663, 0.00244594, 0.00230837, 0.00227571]), 'score_time': array([0.00313854, 0.00289536, 0.00291657, 0.00291395, 0.00298357]), 'test_score': 0.8013227513227512}
{'label': 'kneighbors_2_distance_ball_tree', 'fit_time': array([0.0024929 , 0.00239968, 0.00234699, 0.00234771, 0.00244093]), 'score_time': array([0.0024159 , 0.00255322, 0.00236535, 0.00235868, 0.0023458 ]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_2_distance_kd_tree', 'fit_time': array([0.00236106, 0.00235009, 0.00234962, 0.00232005, 0.00234818]), 'score_time': array([0.00248146, 0.00230527, 0.00235987, 0.00233626, 0.00232673]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_2_distance_brute', 'fit_time': array([0.00220037, 0.0021596 , 0.0022552 , 0.00221086, 0.0022068 ]), 'score_time': array([0.00217772, 0.0022018 , 0.00214314, 0.00219846, 0.00212407]), 'test_score': 0.7288359788359788}
{'label': 'kneighbors_3_uniform_ball_tree', 'fit_time': array([0.00239897, 0.00233531, 0.00229406, 0.00233483, 0.00234103]), 'score_time': array([0.00321698, 0.00300717, 0.00300527, 0.00304794, 0.00490427]), 'test_score': 0.8015873015873016}
{'label': 'kneighbors_3_uniform_kd_tree', 'fit_time': array([0.00322366, 0.00240445, 0.00234008, 0.00235081, 0.00234246]), 'score_time': array([0.00314903, 0.00304651, 0.00318289, 0.00311494, 0.00306129]), 'test_score': 0.8015873015873016}
{'label': 'kneighbors_3_uniform_brute', 'fit_time': array([0.00228405, 0.00226927, 0.00217152, 0.00222754, 0.00225019]), 'score_time': array([0.00290918, 0.00291061, 0.00288844, 0.00285387, 0.00362468]), 'test_score': 0.8015873015873016}
{'label': 'kneighbors_3_distance_ball_tree', 'fit_time': array([0.00365496, 0.00260448, 0.00253558, 0.00232935, 0.00235391]), 'score_time': array([0.00244498, 0.00238442, 0.00269103, 0.00246453, 0.00234127]), 'test_score': 0.7798941798941799}
{'label': 'kneighbors_3_distance_kd_tree', 'fit_time': array([0.00241804, 0.00234747, 0.00233936, 0.00230026, 0.00233436]), 'score_time': array([0.00234127, 0.0023098 , 0.00231981, 0.00233936, 0.00226998]), 'test_score': 0.7798941798941799}
{'label': 'kneighbors_3_distance_brute', 'fit_time': array([0.00368333, 0.00365329, 0.00338316, 0.00351214, 0.00337434]), 'score_time': array([0.00354743, 0.00351644, 0.0032444 , 0.00322676, 0.00363016]), 'test_score': 0.7798941798941799}
{'label': 'kneighbors_5_uniform_ball_tree', 'fit_time': array([0.00349045, 0.00355148, 0.0040853 , 0.00338888, 0.00240541]), 'score_time': array([0.00457191, 0.00521994, 0.00461936, 0.00318694, 0.00301361]), 'test_score': 0.7944444444444445}
{'label': 'kneighbors_5_uniform_kd_tree', 'fit_time': array([0.00235319, 0.0029676 , 0.00241089, 0.00240922, 0.00234079]), 'score_time': array([0.00483847, 0.00415587, 0.00310349, 0.00300765, 0.00316787]), 'test_score': 0.7944444444444445}
{'label': 'kneighbors_5_uniform_brute', 'fit_time': array([0.00226068, 0.00219893, 0.00222063, 0.00217509, 0.0024426 ]), 'score_time': array([0.00295758, 0.00293207, 0.00288844, 0.00292063, 0.00314069]), 'test_score': 0.7944444444444445}
{'label': 'kneighbors_5_distance_ball_tree', 'fit_time': array([0.00249243, 0.0032568 , 0.00232649, 0.00233865, 0.00235271]), 'score_time': array([0.0032506 , 0.00251603, 0.0024035 , 0.00232244, 0.00238466]), 'test_score': 0.765079365079365}
{'label': 'kneighbors_5_distance_kd_tree', 'fit_time': array([0.00238967, 0.00237441, 0.00230455, 0.00234556, 0.00235319]), 'score_time': array([0.00230598, 0.00232792, 0.00251698, 0.00236034, 0.00234962]), 'test_score': 0.765079365079365}
{'label': 'kneighbors_5_distance_brute', 'fit_time': array([0.00219536, 0.00219989, 0.00218701, 0.00215769, 0.00216103]), 'score_time': array([0.00223899, 0.00236297, 0.0023129 , 0.00269723, 0.00222492]), 'test_score': 0.765079365079365}
criterion = ["gini", "entropy"]
splitter = ["best", "random"]
depth = [None, 1, 2, 3, 4, 5]
for c in criterion:
for spl in splitter:
for d in depth:
t = "decision_tree_" + c + "_" + spl + "_" + str(d)
sco = compute_scores(t, DecisionTreeClassifier(criterion=c, splitter=spl, max_depth=d), x_train, y_train)
score_array.append(sco)
print(sco)
{'label': 'decision_tree_gini_best_None', 'fit_time': array([0.00502443, 0.00362897, 0.00359392, 0.00349498, 0.00352669]), 'score_time': array([0.0018661 , 0.00189519, 0.0019958 , 0.00182915, 0.00174713]), 'test_score': 0.8545022086306491}
{'label': 'decision_tree_gini_best_1', 'fit_time': array([0.0026207 , 0.00260019, 0.0025661 , 0.00251555, 0.00259709]), 'score_time': array([0.00178099, 0.00173712, 0.00169039, 0.00163913, 0.00173354]), 'test_score': 0.8507985049269454}
{'label': 'decision_tree_gini_best_2', 'fit_time': array([0.0030396 , 0.00277591, 0.00281906, 0.00279856, 0.00341415]), 'score_time': array([0.00171638, 0.00187206, 0.00172377, 0.00169897, 0.00260949]), 'test_score': 0.8655283724091063}
{'label': 'decision_tree_gini_best_3', 'fit_time': array([0.00294423, 0.00284171, 0.00283766, 0.00283575, 0.00278997]), 'score_time': array([0.00169754, 0.00172806, 0.00171065, 0.00189638, 0.00164294]), 'test_score': 0.8729018008834523}
{'label': 'decision_tree_gini_best_4', 'fit_time': array([0.00297761, 0.00309515, 0.00295115, 0.00290275, 0.00289655]), 'score_time': array([0.00166869, 0.00164485, 0.00168157, 0.00166154, 0.00189328]), 'test_score': 0.8692320761128102}
{'label': 'decision_tree_gini_best_5', 'fit_time': array([0.00372744, 0.00311899, 0.00303197, 0.00317335, 0.00306964]), 'score_time': array([0.00173068, 0.00166655, 0.00178552, 0.00165343, 0.0020318 ]), 'test_score': 0.869249065579341}
{'label': 'decision_tree_gini_random_None', 'fit_time': array([0.00291514, 0.00269437, 0.00267148, 0.00268006, 0.00263715]), 'score_time': array([0.00178647, 0.00170493, 0.00181437, 0.00164557, 0.00197864]), 'test_score': 0.860091743119266}
{'label': 'decision_tree_gini_random_1', 'fit_time': array([0.00250435, 0.00240159, 0.00251579, 0.00290728, 0.00240827]), 'score_time': array([0.00163269, 0.00175786, 0.00185418, 0.00181508, 0.00171328]), 'test_score': 0.8619096160380565}
{'label': 'decision_tree_gini_random_2', 'fit_time': array([0.00250578, 0.00257754, 0.00353217, 0.00243759, 0.00235724]), 'score_time': array([0.0016582 , 0.0016613 , 0.00271654, 0.00162768, 0.0016644 ]), 'test_score': 0.863710499490316}
{'label': 'decision_tree_gini_random_3', 'fit_time': array([0.00244761, 0.00244784, 0.00253367, 0.00242186, 0.00239277]), 'score_time': array([0.00163603, 0.00162625, 0.00164032, 0.00171971, 0.00165105]), 'test_score': 0.845225959904859}
{'label': 'decision_tree_gini_random_4', 'fit_time': array([0.00316167, 0.00249791, 0.00243521, 0.00315905, 0.00249052]), 'score_time': array([0.00164247, 0.00164151, 0.00242543, 0.00165272, 0.00182223]), 'test_score': 0.8618586476384642}
{'label': 'decision_tree_gini_random_5', 'fit_time': array([0.00250196, 0.00676703, 0.00419998, 0.00294018, 0.0025332 ]), 'score_time': array([0.00225544, 0.00273299, 0.00256944, 0.00180531, 0.0017066 ]), 'test_score': 0.869164118246687}
{'label': 'decision_tree_entropy_best_None', 'fit_time': array([0.0038538 , 0.00373149, 0.00367737, 0.00364757, 0.00357533]), 'score_time': array([0.00175595, 0.00169587, 0.00188899, 0.00168657, 0.00167561]), 'test_score': 0.8527013251783894}
{'label': 'decision_tree_entropy_best_1', 'fit_time': array([0.0025692 , 0.00467658, 0.00256181, 0.00249529, 0.00251842]), 'score_time': array([0.00164437, 0.00175858, 0.00162864, 0.00164127, 0.00165963]), 'test_score': 0.8526333673122665}
{'label': 'decision_tree_entropy_best_2', 'fit_time': array([0.00286436, 0.00272036, 0.00283623, 0.00271177, 0.00266838]), 'score_time': array([0.00167012, 0.00163865, 0.00162506, 0.00165153, 0.00182509]), 'test_score': 0.8545022086306491}
{'label': 'decision_tree_entropy_best_3', 'fit_time': array([0.00314045, 0.00283337, 0.00288534, 0.00299001, 0.00286913]), 'score_time': array([0.0016582 , 0.00165367, 0.00162005, 0.00161409, 0.0015986 ]), 'test_score': 0.8582229018008836}
{'label': 'decision_tree_entropy_best_4', 'fit_time': array([0.00308275, 0.0035913 , 0.00316572, 0.00319839, 0.00318122]), 'score_time': array([0.00346851, 0.00171971, 0.00167418, 0.00169659, 0.00189304]), 'test_score': 0.8655453618756372}
{'label': 'decision_tree_entropy_best_5', 'fit_time': array([0.00392389, 0.00334787, 0.00326872, 0.00355554, 0.00444293]), 'score_time': array([0.00181007, 0.00169349, 0.00173497, 0.00171065, 0.0020628 ]), 'test_score': 0.863710499490316}
{'label': 'decision_tree_entropy_random_None', 'fit_time': array([0.00296044, 0.0027616 , 0.00288391, 0.00288773, 0.00284004]), 'score_time': array([0.00173736, 0.00190783, 0.00171947, 0.00166488, 0.00166512]), 'test_score': 0.8323479442745498}
{'label': 'decision_tree_entropy_random_1', 'fit_time': array([0.00247097, 0.00239897, 0.00241303, 0.00247359, 0.00230408]), 'score_time': array([0.00166273, 0.00163221, 0.00163651, 0.00161552, 0.00167632]), 'test_score': 0.8600407747196739}
{'label': 'decision_tree_entropy_random_2', 'fit_time': array([0.00361705, 0.00408816, 0.0025661 , 0.00249934, 0.00234795]), 'score_time': array([0.00317454, 0.0026567 , 0.00171399, 0.00161576, 0.00192928]), 'test_score': 0.8507475365273531}
{'label': 'decision_tree_entropy_random_3', 'fit_time': array([0.00332904, 0.00248384, 0.00243473, 0.00245953, 0.00237417]), 'score_time': array([0.0026226 , 0.00167632, 0.00168204, 0.00167084, 0.00165009]), 'test_score': 0.8544512402310568}
{'label': 'decision_tree_entropy_random_4', 'fit_time': array([0.00270295, 0.00259089, 0.0024178 , 0.00236273, 0.00242901]), 'score_time': array([0.00167394, 0.00165844, 0.00163579, 0.00162601, 0.0016396 ]), 'test_score': 0.8600067957866123}
{'label': 'decision_tree_entropy_random_5', 'fit_time': array([0.00260472, 0.00267673, 0.00246811, 0.00293446, 0.00247097]), 'score_time': array([0.0018177 , 0.00166154, 0.00188279, 0.00161362, 0.00161076]), 'test_score': 0.856354060482501}
criterion = ["gini", "entropy"]
n_estimator = [2, 15, 50, 100, 200]
depth = [None, 1, 2, 3, 4, 5]
for c in criterion:
for ne in n_estimator:
for d in depth:
t = "random_forest_" + c + "_" + str(ne) + "_" + str(d)
sco = compute_scores(t, RandomForestClassifier(n_estimators=ne, criterion=c, max_depth=d), x_train, y_train)
score_array.append(sco)
print(sco)
{'label': 'random_forest_gini_2_None', 'fit_time': array([0.00713658, 0.00560832, 0.00538707, 0.0058248 , 0.00575805]), 'score_time': array([0.00234008, 0.0022645 , 0.00223565, 0.00359178, 0.00237203]), 'test_score': 0.8637444784233775}
{'label': 'random_forest_gini_2_1', 'fit_time': array([0.00620127, 0.00515914, 0.00499606, 0.00495148, 0.00496507]), 'score_time': array([0.00233293, 0.0021925 , 0.0021801 , 0.00218344, 0.00220346]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_2_2', 'fit_time': array([0.00541735, 0.00507498, 0.00502896, 0.00499535, 0.00513363]), 'score_time': array([0.00218201, 0.00217056, 0.00213981, 0.00247192, 0.00214362]), 'test_score': 0.8563370710159701}
{'label': 'random_forest_gini_2_3', 'fit_time': array([0.00537729, 0.00668406, 0.00533795, 0.00512385, 0.00519443]), 'score_time': array([0.00212216, 0.00247025, 0.00234127, 0.00221848, 0.00226974]), 'test_score': 0.8545361875637105}
{'label': 'random_forest_gini_2_4', 'fit_time': array([0.0053978 , 0.00533843, 0.00517011, 0.00644279, 0.00553513]), 'score_time': array([0.002213 , 0.00224137, 0.00221133, 0.00227547, 0.002244 ]), 'test_score': 0.8508324838600068}
{'label': 'random_forest_gini_2_5', 'fit_time': array([0.00542235, 0.00542045, 0.005404 , 0.00538278, 0.00602627]), 'score_time': array([0.0023253 , 0.00243592, 0.00254154, 0.00293183, 0.00220346]), 'test_score': 0.8322969758749575}
{'label': 'random_forest_gini_15_None', 'fit_time': array([0.02379203, 0.02418208, 0.02356052, 0.02596831, 0.0250299 ]), 'score_time': array([0.00368547, 0.00368714, 0.0038116 , 0.00557756, 0.00396681]), 'test_score': 0.876605504587156}
{'label': 'random_forest_gini_15_1', 'fit_time': array([0.02126312, 0.02091837, 0.02275109, 0.02071381, 0.0208497 ]), 'score_time': array([0.00368571, 0.00357628, 0.00359941, 0.00358176, 0.00374079]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_15_2', 'fit_time': array([0.02269793, 0.02146339, 0.02284026, 0.02105021, 0.02929401]), 'score_time': array([0.00372434, 0.00353074, 0.00360155, 0.00355697, 0.00368023]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_15_3', 'fit_time': array([0.02148485, 0.02151775, 0.02380013, 0.0217793 , 0.02153444]), 'score_time': array([0.00361562, 0.00383282, 0.00368381, 0.00377226, 0.00413537]), 'test_score': 0.8581549439347604}
{'label': 'random_forest_gini_15_4', 'fit_time': array([0.02206445, 0.0225265 , 0.02345586, 0.02275038, 0.02235341]), 'score_time': array([0.00359273, 0.00361705, 0.00358868, 0.00360227, 0.00359988]), 'test_score': 0.8599898063200815}
{'label': 'random_forest_gini_15_5', 'fit_time': array([0.02346945, 0.02252817, 0.02399397, 0.02282715, 0.02369189]), 'score_time': array([0.00363445, 0.00360417, 0.00360036, 0.00432873, 0.00362229]), 'test_score': 0.8637274889568468}
{'label': 'random_forest_gini_50_None', 'fit_time': array([0.08200073, 0.07275105, 0.07193422, 0.07427335, 0.07357955]), 'score_time': array([0.00697732, 0.00715899, 0.0068872 , 0.00678325, 0.00687361]), 'test_score': 0.8802582398912675}
{'label': 'random_forest_gini_50_1', 'fit_time': array([0.06250525, 0.0612092 , 0.07881188, 0.06206536, 0.06263208]), 'score_time': array([0.00646043, 0.00651479, 0.00641727, 0.00638008, 0.00651121]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_50_2', 'fit_time': array([0.06331038, 0.06414366, 0.06551909, 0.06544662, 0.06418514]), 'score_time': array([0.00655055, 0.0065372 , 0.00645041, 0.00654578, 0.00644112]), 'test_score': 0.858188922867822}
{'label': 'random_forest_gini_50_3', 'fit_time': array([0.06584334, 0.06584525, 0.06884336, 0.06526494, 0.06776381]), 'score_time': array([0.00658154, 0.0064764 , 0.00664091, 0.00660205, 0.00646996]), 'test_score': 0.858188922867822}
{'label': 'random_forest_gini_50_4', 'fit_time': array([0.0670383 , 0.07454872, 0.06907535, 0.07667661, 0.07112551]), 'score_time': array([0.00666404, 0.00655723, 0.00652623, 0.01128697, 0.0081296 ]), 'test_score': 0.860023785253143}
{'label': 'random_forest_gini_50_5', 'fit_time': array([0.07370996, 0.10141563, 0.09287024, 0.06926656, 0.06838107]), 'score_time': array([0.00662899, 0.01074505, 0.00670028, 0.00658441, 0.00662184]), 'test_score': 0.8692150866462793}
{'label': 'random_forest_gini_100_None', 'fit_time': array([0.14189672, 0.15487194, 0.13980007, 0.1392684 , 0.13808012]), 'score_time': array([0.01135445, 0.01160002, 0.0110693 , 0.01135707, 0.01100016]), 'test_score': 0.8802582398912673}
{'label': 'random_forest_gini_100_1', 'fit_time': array([0.11929822, 0.12121677, 0.12064362, 0.11977386, 0.13914371]), 'score_time': array([0.01039577, 0.01056194, 0.01040435, 0.01030159, 0.01690364]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_100_2', 'fit_time': array([0.17409968, 0.1400671 , 0.12403727, 0.12286472, 0.12332034]), 'score_time': array([0.01121449, 0.01182199, 0.01051593, 0.01044607, 0.01037931]), 'test_score': 0.858188922867822}
{'label': 'random_forest_gini_100_3', 'fit_time': array([0.13199949, 0.13466787, 0.12645054, 0.13265371, 0.12602997]), 'score_time': array([0.01621795, 0.01075029, 0.01043868, 0.01049685, 0.01059079]), 'test_score': 0.8544852191641183}
{'label': 'random_forest_gini_100_4', 'fit_time': array([0.12938261, 0.13089347, 0.12945414, 0.13702798, 0.13022017]), 'score_time': array([0.01055479, 0.01060748, 0.01081109, 0.01071811, 0.01099563]), 'test_score': 0.8636935100237852}
{'label': 'random_forest_gini_100_5', 'fit_time': array([0.14922094, 0.14309812, 0.14286327, 0.13377881, 0.13333035]), 'score_time': array([0.01147842, 0.01111031, 0.01089597, 0.01118636, 0.01748919]), 'test_score': 0.8655453618756372}
{'label': 'random_forest_gini_200_None', 'fit_time': array([0.3078804 , 0.28162503, 0.29062128, 0.29750252, 0.2841382 ]), 'score_time': array([0.02028823, 0.02033091, 0.02040935, 0.02858019, 0.0197196 ]), 'test_score': 0.8820761128100578}
{'label': 'random_forest_gini_200_1', 'fit_time': array([0.24569225, 0.37770367, 0.26824856, 0.24989057, 0.24134493]), 'score_time': array([0.01866555, 0.03679204, 0.01876712, 0.018641 , 0.02477622]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_gini_200_2', 'fit_time': array([0.25986266, 0.24627781, 0.26987958, 0.2566905 , 0.25202346]), 'score_time': array([0.01884556, 0.01871133, 0.0187676 , 0.01907754, 0.02016997]), 'test_score': 0.858188922867822}
{'label': 'random_forest_gini_200_3', 'fit_time': array([0.2692585 , 0.25038862, 0.31445146, 0.27669621, 0.25259185]), 'score_time': array([0.01910973, 0.01923347, 0.04224658, 0.01876068, 0.01888967]), 'test_score': 0.8544852191641183}
{'label': 'random_forest_gini_200_4', 'fit_time': array([0.2683351 , 0.28130388, 0.26615763, 0.30273581, 0.26064706]), 'score_time': array([0.01898718, 0.01985312, 0.02396393, 0.03669 , 0.01903105]), 'test_score': 0.8618416581719334}
{'label': 'random_forest_gini_200_5', 'fit_time': array([0.26504946, 0.26023984, 0.28023958, 0.26167798, 0.26507258]), 'score_time': array([0.01900387, 0.02178621, 0.01892495, 0.01959872, 0.01924467]), 'test_score': 0.865494393476045}
{'label': 'random_forest_entropy_2_None', 'fit_time': array([0.00605559, 0.00560188, 0.00568867, 0.00573111, 0.00551152]), 'score_time': array([0.00231695, 0.00228238, 0.00228167, 0.00225115, 0.00225377]), 'test_score': 0.8563200815494394}
{'label': 'random_forest_entropy_2_1', 'fit_time': array([0.00505781, 0.00525808, 0.00518823, 0.00519705, 0.00551295]), 'score_time': array([0.0022738 , 0.00220203, 0.00218582, 0.00219345, 0.00269175]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_2_2', 'fit_time': array([0.00528479, 0.00508523, 0.00519252, 0.0053997 , 0.00538301]), 'score_time': array([0.00220346, 0.00222826, 0.00220847, 0.00229406, 0.00237179]), 'test_score': 0.8655963302752294}
{'label': 'random_forest_entropy_2_3', 'fit_time': array([0.00525641, 0.00515914, 0.00524044, 0.00514722, 0.00517702]), 'score_time': array([0.00230861, 0.00225115, 0.00220656, 0.00220037, 0.00230432]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_2_4', 'fit_time': array([0.00534034, 0.00530457, 0.00579524, 0.00888515, 0.00865459]), 'score_time': array([0.00217056, 0.00220752, 0.003479 , 0.00364542, 0.00228667]), 'test_score': 0.8636595310907238}
{'label': 'random_forest_entropy_2_5', 'fit_time': array([0.00544667, 0.00534749, 0.00538254, 0.00544596, 0.00550103]), 'score_time': array([0.00221348, 0.00226998, 0.00245786, 0.00222659, 0.00223923]), 'test_score': 0.8618416581719334}
{'label': 'random_forest_entropy_15_None', 'fit_time': array([0.0247519 , 0.03172088, 0.02865291, 0.03281736, 0.02847457]), 'score_time': array([0.00374031, 0.00414634, 0.0060637 , 0.00360513, 0.0044322 ]), 'test_score': 0.8765205572545023}
{'label': 'random_forest_entropy_15_1', 'fit_time': array([0.02058768, 0.02111292, 0.02112627, 0.02064395, 0.02059412]), 'score_time': array([0.00354218, 0.00350451, 0.00354695, 0.00367308, 0.00353336]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_15_2', 'fit_time': array([0.02164817, 0.02219439, 0.02125406, 0.02236009, 0.02205658]), 'score_time': array([0.00357699, 0.00347829, 0.00507331, 0.0035336 , 0.00411773]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_15_3', 'fit_time': array([0.02250504, 0.02183628, 0.02217484, 0.0220685 , 0.02214432]), 'score_time': array([0.00351977, 0.00353074, 0.00358915, 0.00352883, 0.00354052]), 'test_score': 0.858188922867822}
{'label': 'random_forest_entropy_15_4', 'fit_time': array([0.02230597, 0.02286077, 0.02477336, 0.0228796 , 0.0223155 ]), 'score_time': array([0.0036304 , 0.00355887, 0.00368071, 0.0035584 , 0.00369716]), 'test_score': 0.8581889228678221}
{'label': 'random_forest_entropy_15_5', 'fit_time': array([0.02303243, 0.02379799, 0.02309823, 0.02308178, 0.02385712]), 'score_time': array([0.00379705, 0.0037322 , 0.0036149 , 0.00359845, 0.0035882 ]), 'test_score': 0.8747706422018349}
{'label': 'random_forest_entropy_50_None', 'fit_time': array([0.07716537, 0.07710505, 0.08383012, 0.10172915, 0.07501745]), 'score_time': array([0.00684261, 0.00681949, 0.00678992, 0.0075655 , 0.00665474]), 'test_score': 0.8857968059802923}
{'label': 'random_forest_entropy_50_1', 'fit_time': array([0.06163812, 0.06187153, 0.06583738, 0.06296754, 0.07133532]), 'score_time': array([0.00638318, 0.00646353, 0.00654101, 0.00633955, 0.00698757]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_50_2', 'fit_time': array([0.07772136, 0.07020259, 0.06599951, 0.06677771, 0.06423712]), 'score_time': array([0.00641108, 0.00626135, 0.00639319, 0.0064497 , 0.0064683 ]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_50_3', 'fit_time': array([0.07849288, 0.0814569 , 0.06813502, 0.07085299, 0.06652737]), 'score_time': array([0.01004863, 0.00680375, 0.01033068, 0.00637031, 0.00642705]), 'test_score': 0.8544852191641183}
{'label': 'random_forest_entropy_50_4', 'fit_time': array([0.07088494, 0.07128406, 0.06978774, 0.06878614, 0.06899619]), 'score_time': array([0.00682974, 0.00649428, 0.00656819, 0.0066545 , 0.00652671]), 'test_score': 0.8544682296975875}
{'label': 'random_forest_entropy_50_5', 'fit_time': array([0.06932235, 0.06967831, 0.08151984, 0.07823801, 0.07020283]), 'score_time': array([0.00652313, 0.00662112, 0.00660944, 0.00653028, 0.0064168 ]), 'test_score': 0.8710499490316004}
{'label': 'random_forest_entropy_100_None', 'fit_time': array([0.15238762, 0.15066934, 0.21055341, 0.14876342, 0.15778589]), 'score_time': array([0.01147866, 0.01606441, 0.0111413 , 0.01206422, 0.01148176]), 'test_score': 0.8783554196398233}
{'label': 'random_forest_entropy_100_1', 'fit_time': array([0.13110352, 0.12467933, 0.1255343 , 0.11986661, 0.12814045]), 'score_time': array([0.01048613, 0.01066136, 0.01031518, 0.01049018, 0.01095843]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_100_2', 'fit_time': array([0.12823772, 0.12863016, 0.13882446, 0.1250813 , 0.13119125]), 'score_time': array([0.01073551, 0.0108459 , 0.01046324, 0.01042843, 0.01084924]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_100_3', 'fit_time': array([0.13015342, 0.15191722, 0.12856245, 0.14586425, 0.20414042]), 'score_time': array([0.01053381, 0.01129103, 0.01065087, 0.01685572, 0.01170063]), 'test_score': 0.8544852191641183}
{'label': 'random_forest_entropy_100_4', 'fit_time': array([0.14785862, 0.13604999, 0.13259673, 0.13925767, 0.13367748]), 'score_time': array([0.01088595, 0.01090932, 0.01054263, 0.01079655, 0.01070595]), 'test_score': 0.8526333673122665}
{'label': 'random_forest_entropy_100_5', 'fit_time': array([0.13702393, 0.1482029 , 0.16334128, 0.13757944, 0.14506698]), 'score_time': array([0.01106787, 0.01104069, 0.01088881, 0.01084614, 0.01495314]), 'test_score': 0.8673632347944276}
{'label': 'random_forest_entropy_200_None', 'fit_time': array([0.40850592, 0.30073357, 0.29222441, 0.29129291, 0.30677676]), 'score_time': array([0.01963353, 0.01968408, 0.02004743, 0.01955462, 0.02004886]), 'test_score': 0.8839279646619096}
{'label': 'random_forest_entropy_200_1', 'fit_time': array([0.23836899, 0.2496357 , 0.2581327 , 0.25939298, 0.25831342]), 'score_time': array([0.01856041, 0.02959418, 0.01849198, 0.01849103, 0.01858258]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_200_2', 'fit_time': array([0.27562332, 0.28593206, 0.25419283, 0.2526052 , 0.25819492]), 'score_time': array([0.02201343, 0.01857042, 0.01847029, 0.03207946, 0.01921821]), 'test_score': 0.8600407747196739}
{'label': 'random_forest_entropy_200_3', 'fit_time': array([0.26601291, 0.25834298, 0.26824641, 0.26738048, 0.27444077]), 'score_time': array([0.01921654, 0.01909733, 0.02020788, 0.01909733, 0.01863909]), 'test_score': 0.858188922867822}
{'label': 'random_forest_entropy_200_4', 'fit_time': array([0.30325627, 0.28386402, 0.27126002, 0.2629602 , 0.2625463 ]), 'score_time': array([0.03338718, 0.02429438, 0.01902699, 0.02001262, 0.01883674]), 'test_score': 0.8544852191641183}
{'label': 'random_forest_entropy_200_5', 'fit_time': array([0.28336549, 0.28402543, 0.34531116, 0.28095078, 0.31838989]), 'score_time': array([0.03342462, 0.019063 , 0.01936364, 0.01962566, 0.02260232]), 'test_score': 0.8655113829425757}
solver = ['svd', 'cholesky', 'lsqr', 'sparse_cg', 'sag', 'saga']
alpha = [0.1, 0.25, 0.5, 0.75, 1]
for sol in solver:
for a in alpha:
t = "ridge_" + sol + "_" + str(a)
sco = compute_scores(t, RidgeClassifier(solver=sol, alpha=a), X, y)
score_array.append(sco)
print(sco)
{'label': 'ridge_svd_0.1', 'fit_time': array([0.00491762, 0.00540614, 0.00382638, 0.003824 , 0.00384521]), 'score_time': array([0.00210047, 0.00198221, 0.00178432, 0.00180888, 0.0018878 ]), 'test_score': 0.8733115468409587}
{'label': 'ridge_svd_0.25', 'fit_time': array([0.0037601 , 0.0039165 , 0.00370765, 0.00373888, 0.00368547]), 'score_time': array([0.00175905, 0.00178742, 0.00175214, 0.00179386, 0.00201297]), 'test_score': 0.8733115468409587}
{'label': 'ridge_svd_0.5', 'fit_time': array([0.00394034, 0.00375628, 0.00367403, 0.0036726 , 0.00384188]), 'score_time': array([0.00176239, 0.00177765, 0.00174308, 0.00185323, 0.00173402]), 'test_score': 0.8733115468409587}
{'label': 'ridge_svd_0.75', 'fit_time': array([0.0037303 , 0.00366282, 0.00369668, 0.00365973, 0.00365138]), 'score_time': array([0.00173831, 0.00176811, 0.00163794, 0.00174809, 0.00175595]), 'test_score': 0.8718409586056645}
{'label': 'ridge_svd_1', 'fit_time': array([0.00414538, 0.00367713, 0.0038259 , 0.00365329, 0.00362968]), 'score_time': array([0.00177073, 0.00175261, 0.00180578, 0.00173521, 0.00175333]), 'test_score': 0.8703703703703705}
{'label': 'ridge_cholesky_0.1', 'fit_time': array([0.00377965, 0.0036881 , 0.00411677, 0.0036633 , 0.00360298]), 'score_time': array([0.0018692 , 0.00176024, 0.00178957, 0.0017457 , 0.00247741]), 'test_score': 0.8733115468409587}
{'label': 'ridge_cholesky_0.25', 'fit_time': array([0.0043211 , 0.0036552 , 0.00362539, 0.00360966, 0.00391483]), 'score_time': array([0.00181675, 0.00175691, 0.00194263, 0.00176501, 0.00178647]), 'test_score': 0.8733115468409587}
{'label': 'ridge_cholesky_0.5', 'fit_time': array([0.0036552 , 0.00370646, 0.00454593, 0.00376987, 0.00363207]), 'score_time': array([0.00184512, 0.00258279, 0.00183558, 0.00180244, 0.00175643]), 'test_score': 0.8733115468409587}
{'label': 'ridge_cholesky_0.75', 'fit_time': array([0.00362587, 0.00363946, 0.00358582, 0.00357294, 0.00358844]), 'score_time': array([0.00174999, 0.00174212, 0.00176358, 0.0017345 , 0.00175834]), 'test_score': 0.8718409586056645}
{'label': 'ridge_cholesky_1', 'fit_time': array([0.00363088, 0.00383401, 0.0036273 , 0.00354028, 0.00364923]), 'score_time': array([0.00176883, 0.00177073, 0.00174022, 0.00189161, 0.00181103]), 'test_score': 0.8703703703703705}
{'label': 'ridge_lsqr_0.1', 'fit_time': array([0.00368023, 0.00370097, 0.00360966, 0.00359392, 0.00375652]), 'score_time': array([0.00173855, 0.00181317, 0.00171232, 0.00176692, 0.00175285]), 'test_score': 0.8600762527233116}
{'label': 'ridge_lsqr_0.25', 'fit_time': array([0.00375247, 0.00366879, 0.00376678, 0.00366378, 0.00356698]), 'score_time': array([0.00172496, 0.00216055, 0.00175238, 0.0017333 , 0.00175381]), 'test_score': 0.8600762527233116}
{'label': 'ridge_lsqr_0.5', 'fit_time': array([0.00368142, 0.00399137, 0.00517297, 0.00371361, 0.00362539]), 'score_time': array([0.00198722, 0.00172424, 0.00206017, 0.00177288, 0.00173855]), 'test_score': 0.8600762527233116}
{'label': 'ridge_lsqr_0.75', 'fit_time': array([0.00370955, 0.00378323, 0.00370836, 0.00359178, 0.00357747]), 'score_time': array([0.00172281, 0.00174809, 0.00176311, 0.00175643, 0.00169992]), 'test_score': 0.8600762527233116}
{'label': 'ridge_lsqr_1', 'fit_time': array([0.00376511, 0.00410819, 0.00532055, 0.00374603, 0.00376749]), 'score_time': array([0.00176001, 0.00174785, 0.00211644, 0.00181055, 0.00175524]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sparse_cg_0.1', 'fit_time': array([0.00640821, 0.00630474, 0.0048306 , 0.00378036, 0.00380707]), 'score_time': array([0.00283074, 0.00277972, 0.00185013, 0.00177288, 0.00174522]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sparse_cg_0.25', 'fit_time': array([0.00416684, 0.00379086, 0.00412631, 0.00396967, 0.00476432]), 'score_time': array([0.00197196, 0.0021224 , 0.0018394 , 0.00177979, 0.00272346]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sparse_cg_0.5', 'fit_time': array([0.0061655 , 0.00670052, 0.0063026 , 0.0064559 , 0.0040679 ]), 'score_time': array([0.00292087, 0.00283027, 0.00292468, 0.00286508, 0.0017693 ]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sparse_cg_0.75', 'fit_time': array([0.0038569 , 0.00382757, 0.00527239, 0.00434351, 0.00395918]), 'score_time': array([0.00175428, 0.00176954, 0.00214791, 0.00242949, 0.00179553]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sparse_cg_1', 'fit_time': array([0.00388312, 0.00403094, 0.00379205, 0.00376034, 0.00377941]), 'score_time': array([0.00271678, 0.00177598, 0.00173163, 0.00177288, 0.00188017]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sag_0.1', 'fit_time': array([0.0044353 , 0.00585246, 0.00428414, 0.00446224, 0.00457263]), 'score_time': array([0.00167966, 0.00185204, 0.00167632, 0.00183988, 0.00178814]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sag_0.25', 'fit_time': array([0.00428987, 0.00503993, 0.00459099, 0.0042448 , 0.00423431]), 'score_time': array([0.00179839, 0.00166321, 0.00169015, 0.0016818 , 0.00165081]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sag_0.5', 'fit_time': array([0.00405097, 0.0042634 , 0.00446439, 0.0041399 , 0.00445008]), 'score_time': array([0.00166869, 0.00164723, 0.00165892, 0.00167704, 0.00167751]), 'test_score': 0.8600762527233116}
{'label': 'ridge_sag_0.75', 'fit_time': array([0.00406528, 0.00397491, 0.00436783, 0.00394487, 0.00446343]), 'score_time': array([0.00165868, 0.00166321, 0.00165153, 0.00169349, 0.00164866]), 'test_score': 0.8615468409586058}
{'label': 'ridge_sag_1', 'fit_time': array([0.00414181, 0.00482535, 0.00436854, 0.00415301, 0.00461483]), 'score_time': array([0.0018003 , 0.00164962, 0.00172496, 0.00166512, 0.00242043]), 'test_score': 0.8600762527233116}
{'label': 'ridge_saga_0.1', 'fit_time': array([0.00415254, 0.00414801, 0.00703692, 0.00525928, 0.0041585 ]), 'score_time': array([0.00176001, 0.00253892, 0.00320053, 0.00182629, 0.00169778]), 'test_score': 0.8600762527233116}
{'label': 'ridge_saga_0.25', 'fit_time': array([0.00469208, 0.00671744, 0.00672436, 0.00718093, 0.0053041 ]), 'score_time': array([0.00271344, 0.00324011, 0.0031693 , 0.00347424, 0.00218868]), 'test_score': 0.8600762527233116}
{'label': 'ridge_saga_0.5', 'fit_time': array([0.0039382 , 0.00486016, 0.00686002, 0.00696421, 0.00822878]), 'score_time': array([0.00172901, 0.00278187, 0.00332475, 0.00337982, 0.00284481]), 'test_score': 0.8600762527233116}
{'label': 'ridge_saga_0.75', 'fit_time': array([0.00666785, 0.00704861, 0.00441098, 0.00412989, 0.00380135]), 'score_time': array([0.00288606, 0.00230789, 0.00176692, 0.00174069, 0.00167394]), 'test_score': 0.8600762527233116}
{'label': 'ridge_saga_1', 'fit_time': array([0.00387597, 0.00403142, 0.00394249, 0.00650954, 0.00417686]), 'score_time': array([0.00166488, 0.00171614, 0.00164819, 0.00249076, 0.00169778]), 'test_score': 0.8600762527233116}
score_array.sort(key=lambda x : x["test_score"])
comparison_array = pd.DataFrame(score_array)
ntail = 50
plt.figure(figsize=(30,10))
plt.plot(comparison_array.tail(ntail)['label'], comparison_array.tail(ntail)['test_score'])
plt.ylabel("Test Score")
plt.xlabel("Algorithmes")
plt.title("Les 50 meilleurs algorithmes en termes d'accuracy")
plt.xticks(rotation=70)
plt.show()
comparison_array.loc[comparison_array['test_score'].idxmax()]
modele_final = RandomForestClassifier(50,'entropy', None).fit(x_train, y_train)
plot_confusion_matrix(modele_final, x_test, y_test)
tn, fn, fp, tp = confusion_matrix(modele_final.predict(x_test), y_test).ravel()
tn, fn, fp, tp
acc = (tn+tp) / len(x_test)
err = 1 - acc
rec = tp / (tp+fn)
pre = tp / (tp+fp)
f1 = 2 * rec * pre / (rec + pre)
print("Accuracy : " + str(acc))
print("Taux d'erreur : " + str(err))
print("Rappel : " + str(rec))
print("Précision : " + str(pre))
print("F-mesure : " + str(f1))
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/utils/validation.py:72: FutureWarning: Pass criterion=entropy, max_depth=None as keyword args. From version 1.0 (renaming of 0.25) passing these as positional arguments will result in an error
"will result in an error", FutureWarning)
Accuracy : 0.8676470588235294
Taux d'erreur : 0.13235294117647056
Rappel : 0.375
Précision : 0.75
F-mesure : 0.5