您能用这种方式更改我的代码,以便将这两个图放在一起,即1行2列(子图nrows=1,ncols=2)吗?目前我把这些图表放在两个单独的单元格中,我想把它们放在一个单元格中
我的代码: 第一个情节:
from yellowbrick.classifier import (PrecisionRecallCurve)
fig, ax = plt.subplots(figsize=(10, 6))
viz = PrecisionRecallCurve(DecisionTreeClassifier(max_depth=4))
viz.fit(X_train_model_2, y_train_model_2)
print(viz.score(X_test_model_2, y_test_model_2))
viz.ax.set(title="Krzywa precyzja-czułość klasyfikatora drzewa losowego",
xlabel="Czułość",
ylabel="Precyzja")
ax.legend(("Binarna krzywa precyzja-czułość",
"Średnia precyzja = {:0.2f}".format(viz.score(X_test_model_2,y_test_model_2))),
frameon=True,
loc="lower left")
plt.show()
第二幅图:
import scikitplot as skplt
fig, ax = plt.subplots(figsize=(10, 6))
y_probas = decision_tree.predict_proba(X_test_model_2)
skplt.metrics.plot_cumulative_gain(y_test_model_2,
y_probas,
ax=ax)
ax.set(title="Krzywa skumulowanych zysków",
xlabel="Odsetek próbek",
ylabel="Zysk")
ax.legend(("Klasa 0",
"Klasa 1",
"Krzywa odniesienia"),
frameon=True,
loc="lower right")
plt.show()
也许这有助于:
相关问题 更多 >
编程相关推荐