在 Sklearn 中,有没有办法打印出估算器的类名?
我已尝试使用 name 属性,但它不起作用。
from sklearn.linear_model import LogisticRegression
def print_estimator_name(estimator):
print(estimator.__name__)
#Expected Outcome:
print_estimator_name(LogisticRegression())
我希望这能打印出上面的分类器名称
最佳答案
我认为您正在寻找 estimator.__class__.__name__
即:
from sklearn.linear_model import LogisticRegression
def print_estimator_name(estimator):
print(estimator.__class__.__name__)
#Expected Outcome:
print_estimator_name(LogisticRegression())
关于python - 在 SkLearn 中打印 Estimator 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54049587/