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 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南