Search for question
Question

Δ # Get the ROC Curves Д # Plot the ROC curves. G₁/nRun All Ex Clear All Outputs # Make predictions. # CV score # Accuracy: 1 is perfect prediction. # Precision # Recall # f1 score: best value at 1 (perfect precision and recall) and worst at 0. # Plot confusion matrix for Decision tree # Predict probabilities for the test data/n# Create decision tree classifier # Train the estimator # Evaluate the accuracy of the assignment # Generate tree/n# Examine predictors cancer.feature_names [12] 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') # Test-train split # Hint: explanatory data is 'cancer.data' and outcome is 'cancer.target'/n[9] [10] [11] print (list(cancer.target_names)) print (list(cancer.feature_names)) Python ['malignant', 'benign'] ['mean radius', 'mean texture', 'mean perimeter', 'mean area', 'mean smoothness', 'mean compactness', 'mean concavity', 'mean concave points', mean sy # Inspect data # (1) info # (2) descriptive statistics # (3) first five rows df = pd.DataFrame(cancer.data, columns=cancer.feature_names) df['target'] = pd.Series (cancer.target) df.head() 4A 8 (A) 0 43°C Haze Python Python Spaces: 4 Cell 1 of 19 Go Live ENG Search NEW IN 17:13 17-06-2024 PRE/n[6] # Load libraries from sklearn.tree import Decision TreeClassifier from sklearn.datasets import load_breast_cancer import pandas as pd www # Load data [7] cancer ■load_breast_cancer() [8] ... cancer ['data' array([[1.799e+01, 1.038e+01, 1.228e+02, 1.1890-01], [2.057e+01, 1.777e+01, 1.329e+02, 8.902e-02], [1.969e+01, 2.125e+01, 1.300e+02, 8.758e-02], 04 A 8 0 43°C Haze Q Search 2.654e-01, 4.601-01, 1.860-01, 2.750e-01, .... 2.4300-01, 3.613e-01, X NEW Spaces: ENG IN

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6