金魚亭日常

読書,ガジェット,競技プログラミング

Sagemaker XGBoost でも sample_weights を指定する

XGBoost の XGBoostClassifier で fit するときに sample_weights を指定していたものを Sagemaker に移植する場合、 Hyperparameter で csv_weithts=1 を指定して、training data 作るときに、2列目にweights を入れる。

csv_weithts

When this flag is enabled, XGBoost differentiates the importance of instances for csv input by taking the second column (the column after labels) in training data as the instance weights.

Optional

Valid values: 0 or 1

XGBoost Hyperparameters - Amazon SageMaker

To differentiate the importance of labelled data points use Instance Weight Supports

SageMaker XGBoost allows customers to differentiate the importance of labelled data points by assigning each instance a weight value. For text/libsvm input, customers can assign weight values to data instances by attaching them after the labels. For example, label:weight idx_0:val_0 idx_1:val_1.... For text/csv input, customers need to turn on the csv_weights flag in the parameters and attach weight values in the column after labels. For example: label,weight,val_0,val_1,...).

XGBoost Algorithm - Amazon SageMaker