我已经训练了一个 LightGBM 模型,现在想要创建一个自定义预测例程以部署在 google aiplatform 上。
加载模型文件时,会抛出未安装 lightgbm 的错误。我在 setup.py 中使用了下面的代码,但它不起作用。
from setuptools import setup, find_packages
DEPENDENCIES = ['lightgbm==3.1.1']
setup(
name='my_custom_code',
version='0.4',
install_requires=DEPENDENCIES,
include_package_date=True,
packages=find_packages(),
description='custom code.',
scripts=['predictor.py', 'preprocess.py'])
Run Code Online (Sandbox Code Playgroud) 我有一个数据框,其索引行是字符串数据类型。我希望它是数字并排序的:
col1 col2
1 25 33
3 35 544
2 24 52
Run Code Online (Sandbox Code Playgroud)
预期的 :
col1 col2
1 25 33
2 24 52
3 35 544
Run Code Online (Sandbox Code Playgroud) 我试图找到决策树的ROC曲线和AUROC曲线.我的代码是这样的
clf.fit(x,y)
y_score = clf.fit(x,y).decision_function(test[col])
pred = clf.predict_proba(test[col])
print(sklearn.metrics.roc_auc_score(actual,y_score))
fpr,tpr,thre = sklearn.metrics.roc_curve(actual,y_score)
Run Code Online (Sandbox Code Playgroud)
输出:
Error()
'DecisionTreeClassifier' object has no attribute 'decision_function'
Run Code Online (Sandbox Code Playgroud)
基本上,错误是在找到时出现的y_score
.请解释一下是什么y_score
以及如何解决这个问题?