本文整理汇总了Python中sklearn.ensemble.RandomForestClassifier.plot_feature_importances方法的典型用法代码示例。如果您正苦于以下问题:Python RandomForestClassifier.plot_feature_importances方法的具体用法?Python RandomForestClassifier.plot_feature_importances怎么用?Python RandomForestClassifier.plot_feature_importances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.ensemble.RandomForestClassifier
的用法示例。
在下文中一共展示了RandomForestClassifier.plot_feature_importances方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_order
# 需要导入模块: from sklearn.ensemble import RandomForestClassifier [as 别名]
# 或者: from sklearn.ensemble.RandomForestClassifier import plot_feature_importances [as 别名]
def test_order(self):
np.random.seed(0)
clf = RandomForestClassifier()
scikitplot.classifier_factory(clf)
clf.fit(self.X, self.y)
ax = clf.plot_feature_importances(order='ascending')
ax = clf.plot_feature_importances(order='descending')
ax = clf.plot_feature_importances(order=None)
示例2: test_max_num_features
# 需要导入模块: from sklearn.ensemble import RandomForestClassifier [as 别名]
# 或者: from sklearn.ensemble.RandomForestClassifier import plot_feature_importances [as 别名]
def test_max_num_features(self):
np.random.seed(0)
clf = RandomForestClassifier()
scikitplot.classifier_factory(clf)
clf.fit(self.X, self.y)
ax = clf.plot_feature_importances(max_num_features=2)
ax = clf.plot_feature_importances(max_num_features=4)
ax = clf.plot_feature_importances(max_num_features=6)
示例3: test_ax
# 需要导入模块: from sklearn.ensemble import RandomForestClassifier [as 别名]
# 或者: from sklearn.ensemble.RandomForestClassifier import plot_feature_importances [as 别名]
def test_ax(self):
np.random.seed(0)
clf = RandomForestClassifier()
scikitplot.classifier_factory(clf)
clf.fit(self.X, self.y)
fig, ax = plt.subplots(1, 1)
out_ax = clf.plot_feature_importances()
assert ax is not out_ax
out_ax = clf.plot_feature_importances(ax=ax)
assert ax is out_ax
示例4: test_feature_names
# 需要导入模块: from sklearn.ensemble import RandomForestClassifier [as 别名]
# 或者: from sklearn.ensemble.RandomForestClassifier import plot_feature_importances [as 别名]
def test_feature_names(self):
np.random.seed(0)
clf = RandomForestClassifier()
scikitplot.classifier_factory(clf)
clf.fit(self.X, self.y)
ax = clf.plot_feature_importances(feature_names=["a", "b", "c", "d"])
示例5: test_string_classes
# 需要导入模块: from sklearn.ensemble import RandomForestClassifier [as 别名]
# 或者: from sklearn.ensemble.RandomForestClassifier import plot_feature_importances [as 别名]
def test_string_classes(self):
np.random.seed(0)
clf = RandomForestClassifier()
scikitplot.classifier_factory(clf)
clf.fit(self.X, convert_labels_into_string(self.y))
ax = clf.plot_feature_importances()