输入:
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(oob_score=True)
rf.fit(x_train,y_train)
输出:
RandomForestClassifier(oob_score=True)
我想请问一下,如何设置才能使它的输出,显示随机森林的具体参数信息呢???
输入:
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(oob_score=True)
rf.fit(x_train,y_train)
输出:
RandomForestClassifier(oob_score=True)
我想请问一下,如何设置才能使它的输出,显示随机森林的具体参数信息呢???
模型的参数,都对应一个属性,你可以显示所有属性。
>>> from sklearn.ensemble import RandomForestClassifier
>>> rf = RandomForestClassifier(oob_score=True)
>>> rf
RandomForestClassifier(bootstrap=True, ccp_alpha=0.0, class_weight=None,
criterion='gini', max_depth=None, max_features='auto',
max_leaf_nodes=None, max_samples=None,
min_impurity_decrease=0.0, min_impurity_split=None,
min_samples_leaf=1, min_samples_split=2,
min_weight_fraction_leaf=0.0, n_estimators=100,
n_jobs=None, oob_score=True, random_state=None,
verbose=0, warm_start=False)
>>> rf.bootstrap
True
>>> for item in dir(rf):
print(item)
__abstractmethods__
__class__
__delattr__
__dict__
__dir__
__doc__
__eq__
__format__
__ge__
__getattribute__
__getitem__
__getstate__
__gt__
__hash__
__init__
__init_subclass__
__iter__
__le__
__len__
__lt__
__module__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__setattr__
__setstate__
__sizeof__
__str__
__subclasshook__
__weakref__
_abc_impl
_estimator_type
_get_param_names
_get_tags
_make_estimator
_more_tags
_required_parameters
_set_oob_score
_validate_X_predict
_validate_estimator
_validate_y_class_weight
apply
base_estimator
bootstrap
ccp_alpha
class_weight
criterion
decision_path
estimator_params
feature_importances_
fit
get_params
max_depth
max_features
max_leaf_nodes
max_samples
min_impurity_decrease
min_impurity_split
min_samples_leaf
min_samples_split
min_weight_fraction_leaf
n_estimators
n_jobs
oob_score
predict
predict_log_proba
predict_proba
random_state
score
set_params
verbose
warm_start