XGBoost¶
Snowflake ML Model Registry は、 XGBoost を使用して作成されたモデル(xgboost.XGBModel
または xgboost.Booster
から派生したモデル)をサポートしています。
以下の追加オプションは、 options
ディクショナリで log_model
を呼び出すときに使用できます。
オプション |
説明 |
---|---|
|
モデルオブジェクトで利用可能なメソッドの名前のリスト。 |
|
GPUを持つプラットフォームへの展開時に使用する CUDAランタイムのバージョン。デフォルトで11.8。手動で |
レジストリがターゲットメソッドの署名を知ることができるように、 XGBoost モデルをログするときには sample_input_data
か signatures
のどちらかのパラメーターを指定する必要があります。
例¶
import xgboost
from sklearn import datasets, model_selection
cal_X, cal_y = datasets.load_breast_cancer(as_frame=True, return_X_y=True)
cal_X_train, cal_X_test, cal_y_train, cal_y_test = model_selection.train_test_split(cal_X, cal_y)
params = dict(n_estimators=100, reg_lambda=1, gamma=0, max_depth=3, objective="binary:logistic")
regressor = xgboost.train(params, xgboost.DMatrix(data=cal_X_train, label=cal_y_train))
model_ref = registry.log_model(
regressor,
model_name="xgBooster",
version_name="v1",
sample_input_data=cal_X_test,
options={
"target_methods": ["predict"],
"method_options": {
"predict": {"case_sensitive": True},
},
},
)
model_ref.run(cal_X_test[-10:])