Skip to content
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

booleans in MachineLearning Predict API #878

Closed
syedmusamah opened this issue Jul 20, 2015 · 3 comments
Closed

booleans in MachineLearning Predict API #878

syedmusamah opened this issue Jul 20, 2015 · 3 comments
Labels
feature-request A feature should be added or improved.

Comments

@syedmusamah
Copy link

I have a few boolean variables in my binary model. I was doing:

prediction_params = {
      ml_model_id: machine_learning_model["aws_model_id"],
      record: {   
              bool_variable_1: value_1.to_s, # "true",
              bool_variable_2: value_2.to_s, # "false",
              category_id: item.category_id.to_s
          },
      predict_endpoint: machine_learning_model["prediction_endpoint_url"]
}
client.predict(prediction_params)

The API responded back with the same predicted_scores no mater what values I set in the record.
The fix was to convert the boolean string values from "true" or "false" to "1" or "0".

It would be great to see support for native ruby booleans (true and false). At the very least, the SDK should be able to convert "true" into "1" itself, or throw a validation error.

related AWS forum thread

@syedmusamah syedmusamah changed the title booleans in Predict API booleans in MachineLearning Predict API Jul 20, 2015
@trevorrowe trevorrowe added feature-request A feature should be added or improved. Version 2 labels Jul 21, 2015
@trevorrowe
Copy link
Member

Sorry for the confusion. The SDK expects the record to be a hash of string keys and string values. This is based on the expected values of the service. It could be possible to provide a client-side conversion of booleans to their appropriate string representation.

@trevorrowe
Copy link
Member

I've moved this to our feature request list.

@syedmusamah
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants