How to extract metrics from training XGBoost model in sagemaker

0

Hi, I am trying to set up an XGBoost estimator as following

estimator = XGBoost(
    entry_point="code/train_sagemaker.py",
    role=role,
    instance_count=1,
    instance_type="ml.m5.large", # Not needed here?
    framework_version="1.7-1",
    dependencies=['code/regressionFunctions.py'],
    base_job_name=base_job_name,
    hyperparameters=hyperparameters,
    metric_definitions=metric_definitions,
)

estimator.fit(s3_input_train)

however, I get an error

ClientError: An error occurred (ValidationException) when calling the CreateTrainingJob operation: You can't override the metric definitions for Amazon SageMaker algorithms. Please retry the request without specifying metric definitions.

Here's how I call the model in my entrypoint file

        xgb_regressor = XGBRegressor(**params).fit(self.featuresTrain, self.labelTrain.iloc[:, 0],
                                          eval_set=[(self.featuresTest, self.labelTest.iloc[:, 0])], eval_metric=['rmse', 'mae'], early_stopping_rounds=20)#Extract label column to prevent warning 

When I leave out the option for metric definitions, I am unable to get the metrics for my model. I can extract them myself from the log file, but I also want to use the HyperparameterTuner to tune my models. How can I output metrics so I can extract them>

danuML
질문됨 5달 전55회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠