問題タブ [google-ai-platform]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
0 に答える
148 参照

python - 予測に失敗しました: sklearn 予測中の例外: 'HistGradientBoostingClassifier' オブジェクトに属性 'n_features_' がありません

Google Cloud AI Platform にデプロイしたモデルのクラウド関数内で predict メソッドを呼び出そうとしてHistGradientBoostingClassifierいますが、属性がないことを示すこのエラーが表示されますn_features_

私はHistGradientBoostingClassifier、gradient_boosting.py の 1100 行目で、predict(self, X)メソッドを呼び出してからself.predict_proba(X)(1114 行目) を呼び出し、_raw_predict(1130 行目) を呼び出し、この関数内でself.n_features_(646 行目) にアクセスしていることがわかります。_n_featuresは、トレーニング データセット X からの fit メソッドの 143 行目に割り当てられBaseHistGradientBoostingますHistGradientBoostingClassifier

Python API を介して次のように予測メソッドを呼び出しています。service.projects().predict(name=name, body={'instances': instances}).execute()

HistGradientBoostingClassifier はこの属性を持っていませんか、それともモデルとバージョンを最初に作成したときに fit メソッドに渡されないなど、トレーニング セットに何か問題がありますか? ml.projects().models().create(parent=project_id_model, body=model_request_dict).execute()ml.projects().models().versions().create(parent=project_id_version, body=version_request_dict).execute()?

クラウド関数のログの完全なエラーは次のとおりです。

リクエストを送信する完全なクラウド関数:

モデル/バージョンを作成/デプロイするクラウド機能: