【发布时间】:2019-01-05 06:30:44
【问题描述】:
在 Sklearn 中,有没有办法打印出估算器的类名?
我曾尝试使用 name 属性,但不起作用。
from sklearn.linear_model import LogisticRegression
def print_estimator_name(estimator):
print(estimator.__name__)
#Expected Outcome:
print_estimator_name(LogisticRegression())
我希望这会打印出上面的分类器名称
【问题讨论】:
-
type(estimator)? -
你的名字是什么意思?你是说类名吗?在这种情况下 type() 应该可以解决问题。您是指分配给实例化对象的内存地址吗?另外,也许您只想要对象上的 __str__() 方法?
标签: python model scikit-learn