Question 118:
You work for a large healthcare diagnostics company. You are on the machine learning team responsible for predicting various anomalies in blood samples. You have data samples from all of the corporation’s many testing facilities across the country. You have performed feature engineering and data cleaning on your dataset. You have also written the python code to split your dataset into training and test datasets. You are now ready to train your model for the first time.
You have written the following python code in your SageMaker jupyter notebook:
import sagemaker
from sagemaker.amazon.amazon_estimator import get_image_uri
from sagemaker import get_execution_role
container = get_image_uri(boto3.Session().region_name, `xgboost`)
role = get_execution_role()
s3_train = `s3://{}/{}/{}`.format(bucket, prefix, `train`)
s3_validation = `s3://{}/{}/{}`.format(bucket, prefix, `validation`)
s3_output = `s3://{}/{}/{}`.format(bucket, prefix, xgb_output)
xgb_model = sagemaker.estimator.Estimator(container,
role,
train_instance_count=1,
train_instance_type=`ml.m4.xlarge`,
train_volume_size = 5,
output_path=s3_output,
sagemaker_session=sagemaker.Session())
xgb_model.set_hyperparameters(max_depth = 2,
eta = 2,
gamma = 2,
min_child_weight = 2,
silent = 0,
objective = "multi:softmax",
num_class = 10,
num_round = 10)
train_channel = sagemaker.session.s3_input(s3_train, content_type=`text/csv`)
valid_channel = sagemaker.session.s3_input(s3_validation, content_type=`text/csv`)
data_channels = {`train`: train_channel, `validation`: valid_channel}
xgb_model.fit(inputs=data_channels,logs=True)
When you attempt to run this code in your SageMaker jupyter notebook, it fails. You check the CloudWatch logs and find this error message:
AlgorithmError: u`2` is not valid under any of the given
schemas\n\nFailed validating u`oneOf` in
schema[u`properties`][u`feature_dim`]:\n{u`oneOf`:
[{u`pattern`: u`^([0]\.[0-9])$`, u`type`: u`string`},\n{u`minimum`: 0, u`type`: u`integer`}]}\
What is the cause of your error?
Answer options:
A.You have used an invalid hyperparameter. B.You have used an invalid hyperparameter value. C.You have used an invalid train content_type. D.You have used an invalid objective.