# Getting data | |
from sklearn.datasets import load_breast_cancer | |
cancer = load_breast_cancer() | |
classes=cancer.target_names | |
X = cancer.data | |
y = cancer.target | |
# Importing PCA visualizer | |
from yellowbrick.model_selection import ValidationCurve | |
# Importing RandomForestClassifier | |
from sklearn.ensemble import RandomForestClassifier | |
# Creating the validation curve | |
import numpy as np | |
visualizer = ValidationCurve(RandomForestClassifier(), | |
param_name="max_depth", n_jobs=-1, | |
param_range=np.arange(1, 11), | |
cv=10, scoring="accuracy") | |
visualizer.fit(X, y) | |
# Saving plot in PNG format | |
visualizer.show(outpath="Validation_Curve.png") |