preloader

Ensemble methods - Práctica

Índice de contenido
python
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
from sklearn.model_selection import cross_val_score, GridSearchCV
import time
import pandas as pd
python
cancer_data = load_breast_cancer(as_frame= True)
cancer_data
{'data':      mean radius  mean texture  mean perimeter  mean area  mean smoothness  \
 0          17.99         10.38          122.80     1001.0          0.11840   
 1          20.57         17.77          132.90     1326.0          0.08474   
 2          19.69         21.25          130.00     1203.0          0.10960   
 3          11.42         20.38           77.58      386.1          0.14250   
 4          20.29         14.34          135.10     1297.0          0.10030   
 ..           ...           ...             ...        ...              ...   
 564        21.56         22.39          142.00     1479.0          0.11100   
 565        20.13         28.25          131.20     1261.0          0.09780   
 566        16.60         28.08          108.30      858.1          0.08455   
 567        20.60         29.33          140.10     1265.0          0.11780   
 568         7.76         24.54           47.92      181.0          0.05263   
 
      mean compactness  mean concavity  mean concave points  mean symmetry  \
 0             0.27760         0.30010              0.14710         0.2419   
 1             0.07864         0.08690              0.07017         0.1812   
 2             0.15990         0.19740              0.12790         0.2069   
 3             0.28390         0.24140              0.10520         0.2597   
 4             0.13280         0.19800              0.10430         0.1809   
 ..                ...             ...                  ...            ...   
 564           0.11590         0.24390              0.13890         0.1726   
 565           0.10340         0.14400              0.09791         0.1752   
 566           0.10230         0.09251              0.05302         0.1590   
 567           0.27700         0.35140              0.15200         0.2397   
 568           0.04362         0.00000              0.00000         0.1587   
 
      mean fractal dimension  ...  worst radius  worst texture  \
 0                   0.07871  ...        25.380          17.33   
 1                   0.05667  ...        24.990          23.41   
 2                   0.05999  ...        23.570          25.53   
 3                   0.09744  ...        14.910          26.50   
 4                   0.05883  ...        22.540          16.67   
 ..                      ...  ...           ...            ...   
 564                 0.05623  ...        25.450          26.40   
 565                 0.05533  ...        23.690          38.25   
 566                 0.05648  ...        18.980          34.12   
 567                 0.07016  ...        25.740          39.42   
 568                 0.05884  ...         9.456          30.37   
 
      worst perimeter  worst area  worst smoothness  worst compactness  \
 0             184.60      2019.0           0.16220            0.66560   
 1             158.80      1956.0           0.12380            0.18660   
 2             152.50      1709.0           0.14440            0.42450   
 3              98.87       567.7           0.20980            0.86630   
 4             152.20      1575.0           0.13740            0.20500   
 ..               ...         ...               ...                ...   
 564           166.10      2027.0           0.14100            0.21130   
 565           155.00      1731.0           0.11660            0.19220   
 566           126.70      1124.0           0.11390            0.30940   
 567           184.60      1821.0           0.16500            0.86810   
 568            59.16       268.6           0.08996            0.06444   
 
      worst concavity  worst concave points  worst symmetry  \
 0             0.7119                0.2654          0.4601   
 1             0.2416                0.1860          0.2750   
 2             0.4504                0.2430          0.3613   
 3             0.6869                0.2575          0.6638   
 4             0.4000                0.1625          0.2364   
 ..               ...                   ...             ...   
 564           0.4107                0.2216          0.2060   
 565           0.3215                0.1628          0.2572   
 566           0.3403                0.1418          0.2218   
 567           0.9387                0.2650          0.4087   
 568           0.0000                0.0000          0.2871   
 
      worst fractal dimension  
 0                    0.11890  
 1                    0.08902  
 2                    0.08758  
 3                    0.17300  
 4                    0.07678  
 ..                       ...  
 564                  0.07115  
 565                  0.06637  
 566                  0.07820  
 567                  0.12400  
 568                  0.07039  
 
 [569 rows x 30 columns],
 'target': 0      0
 1      0
 2      0
 3      0
 4      0
       ..
 564    0
 565    0
 566    0
 567    0
 568    1
 Name: target, Length: 569, dtype: int32,
 'frame':      mean radius  mean texture  mean perimeter  mean area  mean smoothness  \
 0          17.99         10.38          122.80     1001.0          0.11840   
 1          20.57         17.77          132.90     1326.0          0.08474   
 2          19.69         21.25          130.00     1203.0          0.10960   
 3          11.42         20.38           77.58      386.1          0.14250   
 4          20.29         14.34          135.10     1297.0          0.10030   
 ..           ...           ...             ...        ...              ...   
 564        21.56         22.39          142.00     1479.0          0.11100   
 565        20.13         28.25          131.20     1261.0          0.09780   
 566        16.60         28.08          108.30      858.1          0.08455   
 567        20.60         29.33          140.10     1265.0          0.11780   
 568         7.76         24.54           47.92      181.0          0.05263   
 
      mean compactness  mean concavity  mean concave points  mean symmetry  \
 0             0.27760         0.30010              0.14710         0.2419   
 1             0.07864         0.08690              0.07017         0.1812   
 2             0.15990         0.19740              0.12790         0.2069   
 3             0.28390         0.24140              0.10520         0.2597   
 4             0.13280         0.19800              0.10430         0.1809   
 ..                ...             ...                  ...            ...   
 564           0.11590         0.24390              0.13890         0.1726   
 565           0.10340         0.14400              0.09791         0.1752   
 566           0.10230         0.09251              0.05302         0.1590   
 567           0.27700         0.35140              0.15200         0.2397   
 568           0.04362         0.00000              0.00000         0.1587   
 
      mean fractal dimension  ...  worst texture  worst perimeter  worst area  \
 0                   0.07871  ...          17.33           184.60      2019.0   
 1                   0.05667  ...          23.41           158.80      1956.0   
 2                   0.05999  ...          25.53           152.50      1709.0   
 3                   0.09744  ...          26.50            98.87       567.7   
 4                   0.05883  ...          16.67           152.20      1575.0   
 ..                      ...  ...            ...              ...         ...   
 564                 0.05623  ...          26.40           166.10      2027.0   
 565                 0.05533  ...          38.25           155.00      1731.0   
 566                 0.05648  ...          34.12           126.70      1124.0   
 567                 0.07016  ...          39.42           184.60      1821.0   
 568                 0.05884  ...          30.37            59.16       268.6   
 
      worst smoothness  worst compactness  worst concavity  \
 0             0.16220            0.66560           0.7119   
 1             0.12380            0.18660           0.2416   
 2             0.14440            0.42450           0.4504   
 3             0.20980            0.86630           0.6869   
 4             0.13740            0.20500           0.4000   
 ..                ...                ...              ...   
 564           0.14100            0.21130           0.4107   
 565           0.11660            0.19220           0.3215   
 566           0.11390            0.30940           0.3403   
 567           0.16500            0.86810           0.9387   
 568           0.08996            0.06444           0.0000   
 
      worst concave points  worst symmetry  worst fractal dimension  target  
 0                  0.2654          0.4601                  0.11890       0  
 1                  0.1860          0.2750                  0.08902       0  
 2                  0.2430          0.3613                  0.08758       0  
 3                  0.2575          0.6638                  0.17300       0  
 4                  0.1625          0.2364                  0.07678       0  
 ..                    ...             ...                      ...     ...  
 564                0.2216          0.2060                  0.07115       0  
 565                0.1628          0.2572                  0.06637       0  
 566                0.1418          0.2218                  0.07820       0  
 567                0.2650          0.4087                  0.12400       0  
 568                0.0000          0.2871                  0.07039       1  
 
 [569 rows x 31 columns],
 'target_names': array(['malignant', 'benign'], dtype='<U9'),
 'DESCR': '.. _breast_cancer_dataset:\n\nBreast cancer wisconsin (diagnostic) dataset\n--------------------------------------------\n\n**Data Set Characteristics:**\n\n    :Number of Instances: 569\n\n    :Number of Attributes: 30 numeric, predictive attributes and the class\n\n    :Attribute Information:\n        - radius (mean of distances from center to points on the perimeter)\n        - texture (standard deviation of gray-scale values)\n        - perimeter\n        - area\n        - smoothness (local variation in radius lengths)\n        - compactness (perimeter^2 / area - 1.0)\n        - concavity (severity of concave portions of the contour)\n        - concave points (number of concave portions of the contour)\n        - symmetry\n        - fractal dimension ("coastline approximation" - 1)\n\n        The mean, standard error, and "worst" or largest (mean of the three\n        worst/largest values) of these features were computed for each image,\n        resulting in 30 features.  For instance, field 0 is Mean Radius, field\n        10 is Radius SE, field 20 is Worst Radius.\n\n        - class:\n                - WDBC-Malignant\n                - WDBC-Benign\n\n    :Summary Statistics:\n\n    ===================================== ====== ======\n                                           Min    Max\n    ===================================== ====== ======\n    radius (mean):                        6.981  28.11\n    texture (mean):                       9.71   39.28\n    perimeter (mean):                     43.79  188.5\n    area (mean):                          143.5  2501.0\n    smoothness (mean):                    0.053  0.163\n    compactness (mean):                   0.019  0.345\n    concavity (mean):                     0.0    0.427\n    concave points (mean):                0.0    0.201\n    symmetry (mean):                      0.106  0.304\n    fractal dimension (mean):             0.05   0.097\n    radius (standard error):              0.112  2.873\n    texture (standard error):             0.36   4.885\n    perimeter (standard error):           0.757  21.98\n    area (standard error):                6.802  542.2\n    smoothness (standard error):          0.002  0.031\n    compactness (standard error):         0.002  0.135\n    concavity (standard error):           0.0    0.396\n    concave points (standard error):      0.0    0.053\n    symmetry (standard error):            0.008  0.079\n    fractal dimension (standard error):   0.001  0.03\n    radius (worst):                       7.93   36.04\n    texture (worst):                      12.02  49.54\n    perimeter (worst):                    50.41  251.2\n    area (worst):                         185.2  4254.0\n    smoothness (worst):                   0.071  0.223\n    compactness (worst):                  0.027  1.058\n    concavity (worst):                    0.0    1.252\n    concave points (worst):               0.0    0.291\n    symmetry (worst):                     0.156  0.664\n    fractal dimension (worst):            0.055  0.208\n    ===================================== ====== ======\n\n    :Missing Attribute Values: None\n\n    :Class Distribution: 212 - Malignant, 357 - Benign\n\n    :Creator:  Dr. William H. Wolberg, W. Nick Street, Olvi L. Mangasarian\n\n    :Donor: Nick Street\n\n    :Date: November, 1995\n\nThis is a copy of UCI ML Breast Cancer Wisconsin (Diagnostic) datasets.\nhttps://goo.gl/U2Uwz2\n\nFeatures are computed from a digitized image of a fine needle\naspirate (FNA) of a breast mass.  They describe\ncharacteristics of the cell nuclei present in the image.\n\nSeparating plane described above was obtained using\nMultisurface Method-Tree (MSM-T) [K. P. Bennett, "Decision Tree\nConstruction Via Linear Programming." Proceedings of the 4th\nMidwest Artificial Intelligence and Cognitive Science Society,\npp. 97-101, 1992], a classification method which uses linear\nprogramming to construct a decision tree.  Relevant features\nwere selected using an exhaustive search in the space of 1-4\nfeatures and 1-3 separating planes.\n\nThe actual linear program used to obtain the separating plane\nin the 3-dimensional space is that described in:\n[K. P. Bennett and O. L. Mangasarian: "Robust Linear\nProgramming Discrimination of Two Linearly Inseparable Sets",\nOptimization Methods and Software 1, 1992, 23-34].\n\nThis database is also available through the UW CS ftp server:\n\nftp ftp.cs.wisc.edu\ncd math-prog/cpo-dataset/machine-learn/WDBC/\n\n.. topic:: References\n\n   - W.N. Street, W.H. Wolberg and O.L. Mangasarian. Nuclear feature extraction \n     for breast tumor diagnosis. IS&T/SPIE 1993 International Symposium on \n     Electronic Imaging: Science and Technology, volume 1905, pages 861-870,\n     San Jose, CA, 1993.\n   - O.L. Mangasarian, W.N. Street and W.H. Wolberg. Breast cancer diagnosis and \n     prognosis via linear programming. Operations Research, 43(4), pages 570-577, \n     July-August 1995.\n   - W.H. Wolberg, W.N. Street, and O.L. Mangasarian. Machine learning techniques\n     to diagnose breast cancer from fine-needle aspirates. Cancer Letters 77 (1994) \n     163-171.',
 'feature_names': array(['mean radius', 'mean texture', 'mean perimeter', 'mean area',
        'mean smoothness', 'mean compactness', 'mean concavity',
        'mean concave points', 'mean symmetry', 'mean fractal dimension',
        'radius error', 'texture error', 'perimeter error', 'area error',
        'smoothness error', 'compactness error', 'concavity error',
        'concave points error', 'symmetry error',
        'fractal dimension error', 'worst radius', 'worst texture',
        'worst perimeter', 'worst area', 'worst smoothness',
        'worst compactness', 'worst concavity', 'worst concave points',
        'worst symmetry', 'worst fractal dimension'], dtype='<U23'),
 'filename': 'C:\\Users\\user\\anaconda3\\envs\\python-385\\lib\\site-packages\\sklearn\\datasets\\data\\breast_cancer.csv'}
python
df = cancer_data.frame
df

mean radiusmean texturemean perimetermean areamean smoothnessmean compactnessmean concavitymean concave pointsmean symmetrymean fractal dimension...worst textureworst perimeterworst areaworst smoothnessworst compactnessworst concavityworst concave pointsworst symmetryworst fractal dimensiontarget
017.9910.38122.801001.00.118400.277600.300100.147100.24190.07871...17.33184.602019.00.162200.665600.71190.26540.46010.118900
120.5717.77132.901326.00.084740.078640.086900.070170.18120.05667...23.41158.801956.00.123800.186600.24160.18600.27500.089020
219.6921.25130.001203.00.109600.159900.197400.127900.20690.05999...25.53152.501709.00.144400.424500.45040.24300.36130.087580
311.4220.3877.58386.10.142500.283900.241400.105200.25970.09744...26.5098.87567.70.209800.866300.68690.25750.66380.173000
420.2914.34135.101297.00.100300.132800.198000.104300.18090.05883...16.67152.201575.00.137400.205000.40000.16250.23640.076780
..................................................................
56421.5622.39142.001479.00.111000.115900.243900.138900.17260.05623...26.40166.102027.00.141000.211300.41070.22160.20600.071150
56520.1328.25131.201261.00.097800.103400.144000.097910.17520.05533...38.25155.001731.00.116600.192200.32150.16280.25720.066370
56616.6028.08108.30858.10.084550.102300.092510.053020.15900.05648...34.12126.701124.00.113900.309400.34030.14180.22180.078200
56720.6029.33140.101265.00.117800.277000.351400.152000.23970.07016...39.42184.601821.00.165000.868100.93870.26500.40870.124000
5687.7624.5447.92181.00.052630.043620.000000.000000.15870.05884...30.3759.16268.60.089960.064440.00000.00000.28710.070391

569 rows × 31 columns

python
df.dtypes
mean radius                float64
mean texture               float64
mean perimeter             float64
mean area                  float64
mean smoothness            float64
mean compactness           float64
mean concavity             float64
mean concave points        float64
mean symmetry              float64
mean fractal dimension     float64
radius error               float64
texture error              float64
perimeter error            float64
area error                 float64
smoothness error           float64
compactness error          float64
concavity error            float64
concave points error       float64
symmetry error             float64
fractal dimension error    float64
worst radius               float64
worst texture              float64
worst perimeter            float64
worst area                 float64
worst smoothness           float64
worst compactness          float64
worst concavity            float64
worst concave points       float64
worst symmetry             float64
worst fractal dimension    float64
target                       int32
dtype: object
python
y = df.target
y
0      0
1      0
2      0
3      0
4      0
      ..
564    0
565    0
566    0
567    0
568    1
Name: target, Length: 569, dtype: int32
python
X = df.drop("target", axis=1)
X

mean radiusmean texturemean perimetermean areamean smoothnessmean compactnessmean concavitymean concave pointsmean symmetrymean fractal dimension...worst radiusworst textureworst perimeterworst areaworst smoothnessworst compactnessworst concavityworst concave pointsworst symmetryworst fractal dimension
017.9910.38122.801001.00.118400.277600.300100.147100.24190.07871...25.38017.33184.602019.00.162200.665600.71190.26540.46010.11890
120.5717.77132.901326.00.084740.078640.086900.070170.18120.05667...24.99023.41158.801956.00.123800.186600.24160.18600.27500.08902
219.6921.25130.001203.00.109600.159900.197400.127900.20690.05999...23.57025.53152.501709.00.144400.424500.45040.24300.36130.08758
311.4220.3877.58386.10.142500.283900.241400.105200.25970.09744...14.91026.5098.87567.70.209800.866300.68690.25750.66380.17300
420.2914.34135.101297.00.100300.132800.198000.104300.18090.05883...22.54016.67152.201575.00.137400.205000.40000.16250.23640.07678
..................................................................
56421.5622.39142.001479.00.111000.115900.243900.138900.17260.05623...25.45026.40166.102027.00.141000.211300.41070.22160.20600.07115
56520.1328.25131.201261.00.097800.103400.144000.097910.17520.05533...23.69038.25155.001731.00.116600.192200.32150.16280.25720.06637
56616.6028.08108.30858.10.084550.102300.092510.053020.15900.05648...18.98034.12126.701124.00.113900.309400.34030.14180.22180.07820
56720.6029.33140.101265.00.117800.277000.351400.152000.23970.07016...25.74039.42184.601821.00.165000.868100.93870.26500.40870.12400
5687.7624.5447.92181.00.052630.043620.000000.000000.15870.05884...9.45630.3759.16268.60.089960.064440.00000.00000.28710.07039

569 rows × 30 columns

python
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.1, random_state=0)
python
start_time = time.time()

dt = DecisionTreeClassifier(random_state = 0)

dt_score = cross_val_score(dt, X_train, y_train, cv = None).mean()
end_time = time.time()
print("Tiempo: ", end_time - start_time)
print("Score: ", dt_score)
Tiempo:  0.12500715255737305
Score:  0.9101275461640966
python
start_time = time.time()

rf = RandomForestClassifier(random_state = 0) 

rf_score = cross_val_score(rf, X_train, y_train, cv = None).mean()
end_time = time.time()
print("Tiempo: ", end_time - start_time)
print("Score: ", rf_score)
Tiempo:  1.9391109943389893
Score:  0.9648391395393109
python
start_time = time.time()

et = ExtraTreesClassifier(random_state = 0) 

et_score = cross_val_score(et, X_train, y_train, cv = None).mean()
end_time = time.time()
print("Tiempo: ", end_time - start_time)
print("Score: ", et_score)
Tiempo:  1.312074899673462
Score:  0.9648391395393109
python
gs_dt = GridSearchCV(dt,
                    param_grid = {"max_depth" : range(2, 21), 
                                  "min_samples_split": range(4, 41, 2)},
                    scoring = None,
                    cv = None)
gs_dt.fit(X_train, y_train)
GridSearchCV(estimator=DecisionTreeClassifier(random_state=0),
             param_grid={'max_depth': range(2, 21),
                         'min_samples_split': range(4, 41, 2)})
python
pd.DataFrame(gs_dt.cv_results_)

mean_fit_timestd_fit_timemean_score_timestd_score_timeparam_max_depthparam_min_samples_splitparamssplit0_test_scoresplit1_test_scoresplit2_test_scoresplit3_test_scoresplit4_test_scoremean_test_scorestd_test_scorerank_test_score
00.0096010.0028000.00520.00160024{'max_depth': 2, 'min_samples_split': 4}0.9514560.9029130.9215690.9215690.8921570.9179330.02020080
10.0104010.0023320.00440.00135726{'max_depth': 2, 'min_samples_split': 6}0.9514560.9029130.9215690.9215690.8921570.9179330.02020080
20.0082000.0011660.00340.00049028{'max_depth': 2, 'min_samples_split': 8}0.9514560.9029130.9215690.9215690.8921570.9179330.02020080
30.0090010.0018970.00420.000980210{'max_depth': 2, 'min_samples_split': 10}0.9514560.9029130.9215690.9215690.8921570.9179330.02020080
40.0080010.0008940.00360.000800212{'max_depth': 2, 'min_samples_split': 12}0.9514560.9029130.9215690.9215690.8921570.9179330.02020080
................................................
3560.0124010.0008000.00500.0025302032{'max_depth': 20, 'min_samples_split': 32}0.9514560.9223300.9117650.9215690.8823530.9178950.022183114
3570.0138010.0039190.00360.0008002034{'max_depth': 20, 'min_samples_split': 34}0.9514560.9223300.9117650.9215690.8823530.9178950.022183114
3580.0134010.0032000.00440.0010202036{'max_depth': 20, 'min_samples_split': 36}0.9514560.9223300.9117650.9215690.8823530.9178950.022183114
3590.0118010.0007480.00380.0007492038{'max_depth': 20, 'min_samples_split': 38}0.9514560.9029130.9117650.9215690.8823530.9140110.022758290
3600.0132010.0029940.00520.0009802040{'max_depth': 20, 'min_samples_split': 40}0.9514560.9029130.9117650.9215690.8823530.9140110.022758290

361 rows × 15 columns

python
gs_dt.best_estimator_
DecisionTreeClassifier(max_depth=5, min_samples_split=4, random_state=0)
python
[i for i in range(100, 501, 50)]
[100, 150, 200, 250, 300, 350, 400, 450, 500]
python
rf = RandomForestClassifier(max_depth=5, min_samples_split=4, random_state=0)
gs_rf = GridSearchCV(rf,
                    param_grid = {"n_estimators": range(100, 501, 50)},
                    scoring = None,
                    cv = None)
gs_rf.fit(X_train, y_train)
gs_rf.best_estimator_
RandomForestClassifier(max_depth=5, min_samples_split=4, n_estimators=150,
                       random_state=0)
python
et = ExtraTreesClassifier(max_depth=5, min_samples_split=4, random_state=0)
gs_et = GridSearchCV(et,
                    param_grid = {"n_estimators": range(100, 501, 50)},
                    scoring = None,
                    cv = None)
gs_et.fit(X_train, y_train)
GridSearchCV(estimator=ExtraTreesClassifier(max_depth=5, min_samples_split=4,
                                            random_state=0),
             param_grid={'n_estimators': range(100, 501, 50)})
python
pd.DataFrame(gs_et.cv_results_)

mean_fit_timestd_fit_timemean_score_timestd_score_timeparam_n_estimatorsparamssplit0_test_scoresplit1_test_scoresplit2_test_scoresplit3_test_scoresplit4_test_scoremean_test_scorestd_test_scorerank_test_score
00.2726160.0206560.0336020.003073100{'n_estimators': 100}0.9417480.9417480.9411760.9411760.9803920.9492480.0155741
10.4006230.0173630.0390020.004980150{'n_estimators': 150}0.9417480.9417480.9313730.9313730.9803920.9453260.0181368
20.5400310.0139150.0516030.003137200{'n_estimators': 200}0.9417480.9417480.9313730.9411760.9803920.9472870.0170174
30.8362480.1547280.0788050.017771250{'n_estimators': 250}0.9417480.9417480.9313730.9411760.9803920.9472870.0170174
40.9154520.1544750.0864050.005852300{'n_estimators': 300}0.9417480.9417480.9313730.9411760.9803920.9472870.0170174
50.9586550.0294000.0862050.004665350{'n_estimators': 350}0.9417480.9417480.9313730.9509800.9803920.9492480.0167631
61.0106580.0649670.0974060.006946400{'n_estimators': 400}0.9417480.9417480.9313730.9411760.9803920.9472870.0170174
70.8734500.0384190.0880050.004382450{'n_estimators': 450}0.9417480.9417480.9411760.9411760.9803920.9492480.0155741
80.9248530.0110890.0930050.001414500{'n_estimators': 500}0.9417480.9417480.9313730.9313730.9803920.9453260.0181368
python
gs_et.best_estimator_.get_params()
{'bootstrap': False,
 'ccp_alpha': 0.0,
 'class_weight': None,
 'criterion': 'gini',
 'max_depth': 5,
 'max_features': 'auto',
 'max_leaf_nodes': None,
 'max_samples': None,
 'min_impurity_decrease': 0.0,
 'min_impurity_split': None,
 'min_samples_leaf': 1,
 'min_samples_split': 4,
 'min_weight_fraction_leaf': 0.0,
 'n_estimators': 100,
 'n_jobs': None,
 'oob_score': False,
 'random_state': 0,
 'verbose': 0,
 'warm_start': False}
python
print("DecisionTreeClassifier best score:", gs_dt.best_score_)
print("RandomForestClassifier best score:", gs_rf.best_score_)
print("ExtraTreesClassifier best score:", gs_et.best_score_)
DecisionTreeClassifier best score: 0.9355606320197983
RandomForestClassifier best score: 0.9570150390253189
ExtraTreesClassifier best score: 0.9492480487340569
comments powered by Disqus