Skip to content

csv_weights cannot be set #1135

Closed
Closed

Description

@tigerhawkvok

Reference: 0420645671

Please fill out the form below.

System Information

  • Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): XGBoost
  • Framework Version: 0.90
  • Python Version: 3
  • CPU or GPU:
  • Python SDK Version: Latest
  • Are you using a custom image:

Describe the problem

Can't establish an XGBoost estimator with csv_weights set to 1, as per https://docs.aws.amazon.com/sagemaker/latest/dg/xgboost.html :

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

Amazon 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,...).

Now, the docs don't say where the XGBoost class takes the argument, so I tried the obvious locations which all failed.

Minimal repro / logs

As an estimator paramter:

image

As a float in the estimator fitting:

image

As a string in the estimator fitting:

image

As a fit parameter:

image

Activity

  1. ChoiByungWook commented on Dec 5, 2019

    @ChoiByungWook
    Contributor

    Reference: 0420645671

  2. self-assigned this
    on Feb 4, 2025
  3. added
    component: training
    on Apr 14, 2025
  4. mchav commented on Jun 18, 2025

    @mchav

    Was this resolved? Is the recommended approach to have this in hyperparameters?

  5. mollyheamazon commented on Jan 31, 2026

    @mollyheamazon
    Contributor

    Hi @tigerhawkvok

    Great news! This issue has been resolved with the release of SageMaker Python SDK v3.

    How to Get the Latest Version

    You can upgrade to the latest v3 package using pip:

    pip install --upgrade sagemaker
    
    ##Or specify the version explicitly:
    pip install sagemaker>=3.0.0

    Additional Resources:

     PyPI: https://pypi.org/project/sagemaker/
     Documentation: https://sagemaker.readthedocs.io/

    If you're still experiencing this issue after upgrading, please feel free to reopen this issue or create a new one with updated details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

XGBoostcomponent: trainingtype: bugtype: documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions