我正在尝试调整黄砖图形的轴限制。但是,我似乎无法调整它。我可以更改轴标签和标题,但不能更改限制。如果我不渲染图形,它会起作用,visualizer.show()
但我会丢失标签、标题、图例等。
from sklearn.linear_model import RidgeClassifier
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OrdinalEncoder, LabelEncoder
from yellowbrick.classifier import ROCAUC
from yellowbrick.datasets import load_game
import matplotlib.pyplot as plt
X, y = load_game()
X = OrdinalEncoder().fit_transform(X)
y = LabelEncoder().fit_transform(y)
fig, ax = plt.subplots()
ax.set_xlim([-0.05, 1.0])
ax.set_ylim([0.0, 1.05])
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
fig, ax = plt.subplots(figsize = (10,6))
model = RidgeClassifier()
visualizer = ROCAUC(model, classes=["win", "loss", "draw"], ax = ax)
visualizer.fit(X_train, y_train)
visualizer.score(X_test, y_test)
visualizer.show()