当我们直接引用from sklearn.ensemble.weight_boosting import _samme_proba
时会出现错误:
ModuleNotFoundError: No module named 'sklearn.ensemble.weight_boosting'
因为现在的 sklearn.ensemble
下已经没有了,只有以下内容:
__all__ = [
"BaseEnsemble",
"RandomForestClassifier",
"RandomForestRegressor",
"RandomTreesEmbedding",
"ExtraTreesClassifier",
"ExtraTreesRegressor",
"BaggingClassifier",
"BaggingRegressor",
"IsolationForest",
"GradientBoostingClassifier",
"GradientBoostingRegressor",
"AdaBoostClassifier",
"AdaBoostRegressor",
"VotingClassifier",
"VotingRegressor",
"StackingClassifier",
"StackingRegressor",
"HistGradientBoostingClassifier",
"HistGradientBoostingRegressor",
]
因此在使用_samme_proba
时,引用应该改为:from sklearn.ensemble._weight_boosting import _samme_proba