-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Unable to pass eval_metrics to KMeans estimator #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@rddefauw When did you see the error? After creating the estimator or during training? I run the same code it seems to be working fine:
|
I saw it during training.
…Sent from my iPhone
On Jul 1, 2019, at 2:32 PM, icywang86rui <[email protected]<mailto:[email protected]>> wrote:
@rddefauw<https://github.com/rddefauw> When did you see the error? After creating the estimator or during training? I run the same code it seems to be working fine:
~/work/test$ cat test_kmeans.py
from sagemaker.amazon.kmeans import KMeans, KMeansPredictor
kmeans = KMeans(role='role',
train_instance_count=1,
train_instance_type='ml.c4.xlarge',
output_path='s3://____',
k=3,
eval_metrics=["msd", "ssd"])
print(kmeans.hyperparameters())
~/work/test$ python test_kmeans.py
{'force_dense': 'True', 'k': '3', 'eval_metrics': "['msd', 'ssd']"}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#889?email_source=notifications&email_token=AIF3BNCIDZIUEVMUCYQ5ZLTP5JSRRA5CNFSM4H4A3OIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY7IOGI#issuecomment-507414297>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AIF3BNAMMPONDIOPTHOXOEDP5JSRRANCNFSM4H4A3OIA>.
|
Hi @rddefauw, can you make an object of Thanks. |
I'm not entirely sure what you mean. An object of what type? I tried passing in a dictionary as with the low level SDK:
But I got the same output from
|
Sorry I should've been more specific: an object of |
I guess I'm not clear on what you're suggesting. The HP object is a descriptor so I tried just using the set method:
But that resulted in the same error. |
Hello @rddefauw, I just ran an example with the same eval_metrics hyperparameter value and was able to reproduce the error. Going to investigate now.
|
It looks like a bug on our end. We end up sending the list as a string as defined here: https://github.com/aws/sagemaker-python-sdk/blob/master/src/sagemaker/amazon/hyperparameter.py#L70. On the algorithm side it expects the incoming list input to be JSON formatted, however we only serialize as a string, so some of the encoding gets lost. Here is an easy repro showcasing this, which can be run using python -s. CURRENT
CORRECT
The json.dumps() works with int, float, boolean and list. Which should handle all of the current existing hyperparameters correctly. I'll submit a PR. Thank you for bringing this to our attention. |
PR: #922 |
Co-authored-by: Zhankui Lu <[email protected]>
Co-authored-by: Zhankui Lu <[email protected]>
Please fill out the form below.
System Information
Describe the problem
I am trying to pass in the
eval_metrics
parameter to theKMeans
estimator:That's the example value for
eval_metrics
used in the unit test for KMeans. However, when I run the training job I get this error:I tried several formats including
'eval_metrics': '[\"msd\",\"ssd\"]'
.However I am able to pass in the parameters if I use boto3:
That job completed successfully.
Minimal repro / logs
See above code.
The text was updated successfully, but these errors were encountered: