In: Computer Science
-In google Colab
from sklearn.datasets import load_breast_cancer
allData = load_breast_cancer()
X = allData['data']
y = allData['target']
-# How many features or attributes does this machine learning problem have? Hint use allData['DESCR'] to determine that.
- #Compute the shape or the dimensions of x, and Compute the shape or the dimensions of y?
- Import a classifier, create an instance of the classifier and fit or train he classifier using the training data.
- #compute the number of true positives, true negatives, false negatives and false negative rate
-If the above are taken into consideration, then the given machine learning problem as got 'j' features.
- The shape or dimensions of X can be calculated as X.shape. The shape or dimensions of y can be calculated as y.shape.
The following statements can be used to print-
- Import the classifier using 'from sklearn.ensemble import RandomForestClassifier' (Ex- RandomForest is cosen as classifier)
clf = RandomForestClassifier(n_estimators=1000) //Classifier is defined and instance is created
clf.fit(X, y) // Classifier is fitted
- Confusion Matrix gives true positives, true negatives, false negatives and false negative rates-
Confusion Matrix is printed using the following snippet code-
Note-