Class: Google::Apis::PredictionV1_5::PredictionService

Inherits:
Core::BaseService show all
Defined in:
generated/google/apis/prediction_v1_5/service.rb

Overview

Prediction API

Lets you access a cloud hosted machine learning service that makes it easy to build smart apps

Examples:

require 'google/apis/prediction_v1_5'

Prediction = Google::Apis::PredictionV1_5 # Alias the module
service = Prediction::PredictionService.new

See Also:

Instance Attribute Summary collapse

Attributes inherited from Core::BaseService

#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path

Instance Method Summary collapse

Methods inherited from Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Methods included from Core::Logging

#logger

Constructor Details

#initializePredictionService

Returns a new instance of PredictionService



52
53
54
55
# File 'generated/google/apis/prediction_v1_5/service.rb', line 52

def initialize
  super('https://www.googleapis.com/', 'prediction/v1.5/')
  @batch_path = 'batch/prediction/v1.5'
end

Instance Attribute Details

#keyString

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.

Returns:

  • (String)

    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_5/service.rb', line 39

def key
  @key
end

#quota_userString

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.

Returns:

  • (String)

    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_5/service.rb', line 45

def quota_user
  @quota_user
end

#user_ipString

Returns IP address of the site where the request originates. Use this if you want to enforce per-user limits.

Returns:

  • (String)

    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_5/service.rb', line 50

def user_ip
  @user_ip
end

Instance Method Details

#analyze_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::Analyze

Get analysis of the model and the data the model was trained on.

Parameters:

  • id (String)

    The unique name for the predictive model.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



119
120
121
122
123
124
125
126
127
128
# File 'generated/google/apis/prediction_v1_5/service.rb', line 119

def analyze_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'trainedmodels/{id}/analyze', options)
  command.response_representation = Google::Apis::PredictionV1_5::Analyze::Representation
  command.response_class = Google::Apis::PredictionV1_5::Analyze
  command.params['id'] = id unless id.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

#delete_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... }

This method returns an undefined value.

Delete a trained model.

Parameters:

  • id (String)

    The unique name for the predictive model.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

  • result (NilClass)

    No result returned for this method

  • err (StandardError)

    error object if request failed

Raises:



154
155
156
157
158
159
160
161
# File 'generated/google/apis/prediction_v1_5/service.rb', line 154

def delete_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:delete, 'trainedmodels/{id}', options)
  command.params['id'] = id unless id.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_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::Training

Check training status of your model.

Parameters:

  • id (String)

    The unique name for the predictive model.

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



187
188
189
190
191
192
193
194
195
196
# File 'generated/google/apis/prediction_v1_5/service.rb', line 187

def get_trainedmodel(id, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'trainedmodels/{id}', options)
  command.response_representation = Google::Apis::PredictionV1_5::Training::Representation
  command.response_class = Google::Apis::PredictionV1_5::Training
  command.params['id'] = id unless id.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_trainedmodel(training_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::Training

Begin training your model.

Parameters:

  • training_object (Google::Apis::PredictionV1_5::Training) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



221
222
223
224
225
226
227
228
229
230
231
# File 'generated/google/apis/prediction_v1_5/service.rb', line 221

def insert_trainedmodel(training_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'trainedmodels', options)
  command.request_representation = Google::Apis::PredictionV1_5::Training::Representation
  command.request_object = training_object
  command.response_representation = Google::Apis::PredictionV1_5::Training::Representation
  command.response_class = Google::Apis::PredictionV1_5::Training
  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

#list_trainedmodels(max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::List

List available models.

Parameters:

  • max_results (Fixnum)

    Maximum number of results to return

  • page_token (String)

    Pagination token

  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



259
260
261
262
263
264
265
266
267
268
269
# File 'generated/google/apis/prediction_v1_5/service.rb', line 259

def list_trainedmodels(max_results: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:get, 'trainedmodels/list', options)
  command.response_representation = Google::Apis::PredictionV1_5::List::Representation
  command.response_class = Google::Apis::PredictionV1_5::List
  command.query['maxResults'] = max_results unless max_results.nil?
  command.query['pageToken'] = page_token unless page_token.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_5::Output

Submit input and request an output against a hosted model.

Parameters:

  • hosted_model_name (String)

    The name of a hosted model.

  • input_object (Google::Apis::PredictionV1_5::Input) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



82
83
84
85
86
87
88
89
90
91
92
93
# File 'generated/google/apis/prediction_v1_5/service.rb', line 82

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', options)
  command.request_representation = Google::Apis::PredictionV1_5::Input::Representation
  command.request_object = input_object
  command.response_representation = Google::Apis::PredictionV1_5::Output::Representation
  command.response_class = Google::Apis::PredictionV1_5::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

#predict_trainedmodel(id, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::Output

Submit model id and request a prediction.

Parameters:

  • id (String)

    The unique name for the predictive model.

  • input_object (Google::Apis::PredictionV1_5::Input) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



296
297
298
299
300
301
302
303
304
305
306
307
# File 'generated/google/apis/prediction_v1_5/service.rb', line 296

def predict_trainedmodel(id, input_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:post, 'trainedmodels/{id}/predict', options)
  command.request_representation = Google::Apis::PredictionV1_5::Input::Representation
  command.request_object = input_object
  command.response_representation = Google::Apis::PredictionV1_5::Output::Representation
  command.response_class = Google::Apis::PredictionV1_5::Output
  command.params['id'] = id unless id.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_trainedmodel(id, update_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::PredictionV1_5::Training

Add new data to a trained model.

Parameters:

  • id (String)

    The unique name for the predictive model.

  • update_object (Google::Apis::PredictionV1_5::Update) (defaults to: nil)
  • fields (String)

    Selector specifying which fields to include in a partial response.

  • quota_user (String)

    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.

  • user_ip (String)

    IP address of the site where the request originates. Use this if you want to enforce per-user limits.

  • options (Google::Apis::RequestOptions)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



334
335
336
337
338
339
340
341
342
343
344
345
# File 'generated/google/apis/prediction_v1_5/service.rb', line 334

def update_trainedmodel(id, update_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
  command =  make_simple_command(:put, 'trainedmodels/{id}', options)
  command.request_representation = Google::Apis::PredictionV1_5::Update::Representation
  command.request_object = update_object
  command.response_representation = Google::Apis::PredictionV1_5::Training::Representation
  command.response_class = Google::Apis::PredictionV1_5::Training
  command.params['id'] = id unless id.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