Class: Google::Apis::PredictionV1_2::PredictionService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::PredictionV1_2::PredictionService
- Defined in:
- generated/google/apis/prediction_v1_2/service.rb
Overview
Prediction API
Lets you access a cloud hosted machine learning service that makes it easy to build smart apps
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
-
#user_ip ⇒ String
IP address of the site where the request originates.
Attributes inherited from Core::BaseService
#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path
Instance Method Summary collapse
-
#delete_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }
Delete a trained model.
-
#get_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Check training status of your model.
-
#initialize ⇒ PredictionService
constructor
A new instance of PredictionService.
-
#insert_training(training_object = nil, data: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Begin training your model.
-
#predict(data, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Output
Submit data and request a prediction.
-
#predict_hostedmodel(hosted_model_name, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Output
Submit input and request an output against a hosted model.
-
#update_training(data, update_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Add new data to a trained model.
Methods inherited from Core::BaseService
#batch, #batch_upload, #fetch_all, #http
Methods included from Core::Logging
Constructor Details
#initialize ⇒ PredictionService
Returns a new instance of PredictionService
52 53 54 55 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 52 def initialize super('https://www.googleapis.com/', 'prediction/v1.2/') @batch_path = 'batch/prediction/v1.2' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39 40 41 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 39 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
45 46 47 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 45 def quota_user @quota_user end |
#user_ip ⇒ String
Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.
50 51 52 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 50 def user_ip @user_ip end |
Instance Method Details
#delete_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }
This method returns an undefined value.
Delete a trained model
157 158 159 160 161 162 163 164 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 157 def delete_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:delete, 'training/{data}', ) command.params['data'] = data unless data.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |
#get_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Check training status of your model
190 191 192 193 194 195 196 197 198 199 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 190 def get_training(data, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:get, 'training/{data}', ) command.response_representation = Google::Apis::PredictionV1_2::Training::Representation command.response_class = Google::Apis::PredictionV1_2::Training command.params['data'] = data unless data.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |
#insert_training(training_object = nil, data: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Begin training your model
226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 226 def insert_training(training_object = nil, data: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:post, 'training', ) command.request_representation = Google::Apis::PredictionV1_2::Training::Representation command.request_object = training_object command.response_representation = Google::Apis::PredictionV1_2::Training::Representation command.response_class = Google::Apis::PredictionV1_2::Training command.query['data'] = data unless data.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |
#predict(data, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Output
Submit data and request a prediction
82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 82 def predict(data, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:post, 'training/{data}/predict', ) command.request_representation = Google::Apis::PredictionV1_2::Input::Representation command.request_object = input_object command.response_representation = Google::Apis::PredictionV1_2::Output::Representation command.response_class = Google::Apis::PredictionV1_2::Output command.params['data'] = data unless data.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |
#predict_hostedmodel(hosted_model_name, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Output
Submit input and request an output against a hosted model
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 120 def predict_hostedmodel(hosted_model_name, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:post, 'hostedmodels/{hostedModelName}/predict', ) command.request_representation = Google::Apis::PredictionV1_2::Input::Representation command.request_object = input_object command.response_representation = Google::Apis::PredictionV1_2::Output::Representation command.response_class = Google::Apis::PredictionV1_2::Output command.params['hostedModelName'] = hosted_model_name unless hosted_model_name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |
#update_training(data, update_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_2::Training
Add new data to a trained model
264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'generated/google/apis/prediction_v1_2/service.rb', line 264 def update_training(data, update_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block) command = make_simple_command(:put, 'training/{data}', ) command.request_representation = Google::Apis::PredictionV1_2::Update::Representation command.request_object = update_object command.response_representation = Google::Apis::PredictionV1_2::Training::Representation command.response_class = Google::Apis::PredictionV1_2::Training command.params['data'] = data unless data.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['userIp'] = user_ip unless user_ip.nil? execute_or_queue_command(command, &block) end |