Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
25 - 1
<?php
2
/*
3
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4
 * use this file except in compliance with the License. You may obtain a copy of
5
 * the License at
6
 *
7
 * http://www.apache.org/licenses/LICENSE-2.0
8
 *
9
 * Unless required by applicable law or agreed to in writing, software
10
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 * License for the specific language governing permissions and limitations under
13
 * the License.
14
 */
15
 
16
 
17
  /**
18
   * The "trainedmodels" collection of methods.
19
   * Typical usage is:
20
   *  <code>
21
   *   $predictionService = new Google_PredictionService(...);
22
   *   $trainedmodels = $predictionService->trainedmodels;
23
   *  </code>
24
   */
25
  class Google_TrainedmodelsServiceResource extends Google_ServiceResource {
26
 
27
 
28
    /**
29
     * Submit model id and request a prediction (trainedmodels.predict)
30
     *
31
     * @param string $id The unique name for the predictive model.
32
     * @param Google_Input $postBody
33
     * @param array $optParams Optional parameters.
34
     * @return Google_Output
35
     */
36
    public function predict($id, Google_Input $postBody, $optParams = array()) {
37
      $params = array('id' => $id, 'postBody' => $postBody);
38
      $params = array_merge($params, $optParams);
39
      $data = $this->__call('predict', array($params));
40
      if ($this->useObjects()) {
41
        return new Google_Output($data);
42
      } else {
43
        return $data;
44
      }
45
    }
46
    /**
47
     * Begin training your model. (trainedmodels.insert)
48
     *
49
     * @param Google_Training $postBody
50
     * @param array $optParams Optional parameters.
51
     * @return Google_Training
52
     */
53
    public function insert(Google_Training $postBody, $optParams = array()) {
54
      $params = array('postBody' => $postBody);
55
      $params = array_merge($params, $optParams);
56
      $data = $this->__call('insert', array($params));
57
      if ($this->useObjects()) {
58
        return new Google_Training($data);
59
      } else {
60
        return $data;
61
      }
62
    }
63
    /**
64
     * Check training status of your model. (trainedmodels.get)
65
     *
66
     * @param string $id The unique name for the predictive model.
67
     * @param array $optParams Optional parameters.
68
     * @return Google_Training
69
     */
70
    public function get($id, $optParams = array()) {
71
      $params = array('id' => $id);
72
      $params = array_merge($params, $optParams);
73
      $data = $this->__call('get', array($params));
74
      if ($this->useObjects()) {
75
        return new Google_Training($data);
76
      } else {
77
        return $data;
78
      }
79
    }
80
    /**
81
     * Add new data to a trained model. (trainedmodels.update)
82
     *
83
     * @param string $id The unique name for the predictive model.
84
     * @param Google_Update $postBody
85
     * @param array $optParams Optional parameters.
86
     * @return Google_Training
87
     */
88
    public function update($id, Google_Update $postBody, $optParams = array()) {
89
      $params = array('id' => $id, 'postBody' => $postBody);
90
      $params = array_merge($params, $optParams);
91
      $data = $this->__call('update', array($params));
92
      if ($this->useObjects()) {
93
        return new Google_Training($data);
94
      } else {
95
        return $data;
96
      }
97
    }
98
    /**
99
     * Delete a trained model. (trainedmodels.delete)
100
     *
101
     * @param string $id The unique name for the predictive model.
102
     * @param array $optParams Optional parameters.
103
     */
104
    public function delete($id, $optParams = array()) {
105
      $params = array('id' => $id);
106
      $params = array_merge($params, $optParams);
107
      $data = $this->__call('delete', array($params));
108
      return $data;
109
    }
110
  }
111
 
112
  /**
113
   * The "hostedmodels" collection of methods.
114
   * Typical usage is:
115
   *  <code>
116
   *   $predictionService = new Google_PredictionService(...);
117
   *   $hostedmodels = $predictionService->hostedmodels;
118
   *  </code>
119
   */
120
  class Google_HostedmodelsServiceResource extends Google_ServiceResource {
121
 
122
 
123
    /**
124
     * Submit input and request an output against a hosted model. (hostedmodels.predict)
125
     *
126
     * @param string $hostedModelName The name of a hosted model.
127
     * @param Google_Input $postBody
128
     * @param array $optParams Optional parameters.
129
     * @return Google_Output
130
     */
131
    public function predict($hostedModelName, Google_Input $postBody, $optParams = array()) {
132
      $params = array('hostedModelName' => $hostedModelName, 'postBody' => $postBody);
133
      $params = array_merge($params, $optParams);
134
      $data = $this->__call('predict', array($params));
135
      if ($this->useObjects()) {
136
        return new Google_Output($data);
137
      } else {
138
        return $data;
139
      }
140
    }
141
  }
142
 
143
/**
144
 * Service definition for Google_Prediction (v1.4).
145
 *
146
 * <p>
147
 * Lets you access a cloud hosted machine learning service that makes it easy to build smart apps
148
 * </p>
149
 *
150
 * <p>
151
 * For more information about this service, see the
152
 * <a href="http://code.google.com/apis/predict/docs/developer-guide.html" target="_blank">API Documentation</a>
153
 * </p>
154
 *
155
 * @author Google, Inc.
156
 */
157
class Google_PredictionService extends Google_Service {
158
  public $trainedmodels;
159
  public $hostedmodels;
160
  /**
161
   * Constructs the internal representation of the Prediction service.
162
   *
163
   * @param Google_Client $client
164
   */
165
  public function __construct(Google_Client $client) {
166
    $this->servicePath = 'prediction/v1.4/';
167
    $this->version = 'v1.4';
168
    $this->serviceName = 'prediction';
169
 
170
    $client->addService($this->serviceName, $this->version);
171
    $this->trainedmodels = new Google_TrainedmodelsServiceResource($this, $this->serviceName, 'trainedmodels', json_decode('{"methods": {"predict": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Input"}, "response": {"$ref": "Output"}, "httpMethod": "POST", "path": "trainedmodels/{id}/predict", "id": "prediction.trainedmodels.predict"}, "insert": {"scopes": ["https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/prediction"], "request": {"$ref": "Training"}, "response": {"$ref": "Training"}, "httpMethod": "POST", "path": "trainedmodels", "id": "prediction.trainedmodels.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "id": "prediction.trainedmodels.get", "httpMethod": "GET", "path": "trainedmodels/{id}", "response": {"$ref": "Training"}}, "update": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Update"}, "response": {"$ref": "Training"}, "httpMethod": "PUT", "path": "trainedmodels/{id}", "id": "prediction.trainedmodels.update"}, "delete": {"scopes": ["https://www.googleapis.com/auth/prediction"], "path": "trainedmodels/{id}", "id": "prediction.trainedmodels.delete", "parameters": {"id": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE"}}}', true));
172
    $this->hostedmodels = new Google_HostedmodelsServiceResource($this, $this->serviceName, 'hostedmodels', json_decode('{"methods": {"predict": {"scopes": ["https://www.googleapis.com/auth/prediction"], "parameters": {"hostedModelName": {"required": true, "type": "string", "location": "path"}}, "request": {"$ref": "Input"}, "response": {"$ref": "Output"}, "httpMethod": "POST", "path": "hostedmodels/{hostedModelName}/predict", "id": "prediction.hostedmodels.predict"}}}', true));
173
 
174
  }
175
}
176
 
177
class Google_Input extends Google_Model {
178
  protected $__inputType = 'Google_InputInput';
179
  protected $__inputDataType = '';
180
  public $input;
181
  public function setInput(Google_InputInput $input) {
182
    $this->input = $input;
183
  }
184
  public function getInput() {
185
    return $this->input;
186
  }
187
}
188
 
189
class Google_InputInput extends Google_Model {
190
  public $csvInstance;
191
  public function setCsvInstance(/* array(Google_object) */ $csvInstance) {
192
    $this->assertIsArray($csvInstance, 'Google_object', __METHOD__);
193
    $this->csvInstance = $csvInstance;
194
  }
195
  public function getCsvInstance() {
196
    return $this->csvInstance;
197
  }
198
}
199
 
200
class Google_Output extends Google_Model {
201
  public $kind;
202
  public $outputLabel;
203
  public $id;
204
  protected $__outputMultiType = 'Google_OutputOutputMulti';
205
  protected $__outputMultiDataType = 'array';
206
  public $outputMulti;
207
  public $outputValue;
208
  public $selfLink;
209
  public function setKind($kind) {
210
    $this->kind = $kind;
211
  }
212
  public function getKind() {
213
    return $this->kind;
214
  }
215
  public function setOutputLabel($outputLabel) {
216
    $this->outputLabel = $outputLabel;
217
  }
218
  public function getOutputLabel() {
219
    return $this->outputLabel;
220
  }
221
  public function setId($id) {
222
    $this->id = $id;
223
  }
224
  public function getId() {
225
    return $this->id;
226
  }
227
  public function setOutputMulti(/* array(Google_OutputOutputMulti) */ $outputMulti) {
228
    $this->assertIsArray($outputMulti, 'Google_OutputOutputMulti', __METHOD__);
229
    $this->outputMulti = $outputMulti;
230
  }
231
  public function getOutputMulti() {
232
    return $this->outputMulti;
233
  }
234
  public function setOutputValue($outputValue) {
235
    $this->outputValue = $outputValue;
236
  }
237
  public function getOutputValue() {
238
    return $this->outputValue;
239
  }
240
  public function setSelfLink($selfLink) {
241
    $this->selfLink = $selfLink;
242
  }
243
  public function getSelfLink() {
244
    return $this->selfLink;
245
  }
246
}
247
 
248
class Google_OutputOutputMulti extends Google_Model {
249
  public $score;
250
  public $label;
251
  public function setScore($score) {
252
    $this->score = $score;
253
  }
254
  public function getScore() {
255
    return $this->score;
256
  }
257
  public function setLabel($label) {
258
    $this->label = $label;
259
  }
260
  public function getLabel() {
261
    return $this->label;
262
  }
263
}
264
 
265
class Google_Training extends Google_Model {
266
  public $kind;
267
  public $storageDataLocation;
268
  public $storagePMMLModelLocation;
269
  protected $__dataAnalysisType = 'Google_TrainingDataAnalysis';
270
  protected $__dataAnalysisDataType = '';
271
  public $dataAnalysis;
272
  public $trainingStatus;
273
  protected $__modelInfoType = 'Google_TrainingModelInfo';
274
  protected $__modelInfoDataType = '';
275
  public $modelInfo;
276
  public $storagePMMLLocation;
277
  public $id;
278
  public $selfLink;
279
  public $utility;
280
  public function setKind($kind) {
281
    $this->kind = $kind;
282
  }
283
  public function getKind() {
284
    return $this->kind;
285
  }
286
  public function setStorageDataLocation($storageDataLocation) {
287
    $this->storageDataLocation = $storageDataLocation;
288
  }
289
  public function getStorageDataLocation() {
290
    return $this->storageDataLocation;
291
  }
292
  public function setStoragePMMLModelLocation($storagePMMLModelLocation) {
293
    $this->storagePMMLModelLocation = $storagePMMLModelLocation;
294
  }
295
  public function getStoragePMMLModelLocation() {
296
    return $this->storagePMMLModelLocation;
297
  }
298
  public function setDataAnalysis(Google_TrainingDataAnalysis $dataAnalysis) {
299
    $this->dataAnalysis = $dataAnalysis;
300
  }
301
  public function getDataAnalysis() {
302
    return $this->dataAnalysis;
303
  }
304
  public function setTrainingStatus($trainingStatus) {
305
    $this->trainingStatus = $trainingStatus;
306
  }
307
  public function getTrainingStatus() {
308
    return $this->trainingStatus;
309
  }
310
  public function setModelInfo(Google_TrainingModelInfo $modelInfo) {
311
    $this->modelInfo = $modelInfo;
312
  }
313
  public function getModelInfo() {
314
    return $this->modelInfo;
315
  }
316
  public function setStoragePMMLLocation($storagePMMLLocation) {
317
    $this->storagePMMLLocation = $storagePMMLLocation;
318
  }
319
  public function getStoragePMMLLocation() {
320
    return $this->storagePMMLLocation;
321
  }
322
  public function setId($id) {
323
    $this->id = $id;
324
  }
325
  public function getId() {
326
    return $this->id;
327
  }
328
  public function setSelfLink($selfLink) {
329
    $this->selfLink = $selfLink;
330
  }
331
  public function getSelfLink() {
332
    return $this->selfLink;
333
  }
334
  public function setUtility(/* array(Google_double) */ $utility) {
335
    $this->assertIsArray($utility, 'Google_double', __METHOD__);
336
    $this->utility = $utility;
337
  }
338
  public function getUtility() {
339
    return $this->utility;
340
  }
341
}
342
 
343
class Google_TrainingDataAnalysis extends Google_Model {
344
  public $warnings;
345
  public function setWarnings(/* array(Google_string) */ $warnings) {
346
    $this->assertIsArray($warnings, 'Google_string', __METHOD__);
347
    $this->warnings = $warnings;
348
  }
349
  public function getWarnings() {
350
    return $this->warnings;
351
  }
352
}
353
 
354
class Google_TrainingModelInfo extends Google_Model {
355
  public $confusionMatrixRowTotals;
356
  public $numberLabels;
357
  public $confusionMatrix;
358
  public $meanSquaredError;
359
  public $modelType;
360
  public $numberInstances;
361
  public $classWeightedAccuracy;
362
  public $classificationAccuracy;
363
  public function setConfusionMatrixRowTotals($confusionMatrixRowTotals) {
364
    $this->confusionMatrixRowTotals = $confusionMatrixRowTotals;
365
  }
366
  public function getConfusionMatrixRowTotals() {
367
    return $this->confusionMatrixRowTotals;
368
  }
369
  public function setNumberLabels($numberLabels) {
370
    $this->numberLabels = $numberLabels;
371
  }
372
  public function getNumberLabels() {
373
    return $this->numberLabels;
374
  }
375
  public function setConfusionMatrix($confusionMatrix) {
376
    $this->confusionMatrix = $confusionMatrix;
377
  }
378
  public function getConfusionMatrix() {
379
    return $this->confusionMatrix;
380
  }
381
  public function setMeanSquaredError($meanSquaredError) {
382
    $this->meanSquaredError = $meanSquaredError;
383
  }
384
  public function getMeanSquaredError() {
385
    return $this->meanSquaredError;
386
  }
387
  public function setModelType($modelType) {
388
    $this->modelType = $modelType;
389
  }
390
  public function getModelType() {
391
    return $this->modelType;
392
  }
393
  public function setNumberInstances($numberInstances) {
394
    $this->numberInstances = $numberInstances;
395
  }
396
  public function getNumberInstances() {
397
    return $this->numberInstances;
398
  }
399
  public function setClassWeightedAccuracy($classWeightedAccuracy) {
400
    $this->classWeightedAccuracy = $classWeightedAccuracy;
401
  }
402
  public function getClassWeightedAccuracy() {
403
    return $this->classWeightedAccuracy;
404
  }
405
  public function setClassificationAccuracy($classificationAccuracy) {
406
    $this->classificationAccuracy = $classificationAccuracy;
407
  }
408
  public function getClassificationAccuracy() {
409
    return $this->classificationAccuracy;
410
  }
411
}
412
 
413
class Google_Update extends Google_Model {
414
  public $csvInstance;
415
  public $label;
416
  public function setCsvInstance(/* array(Google_object) */ $csvInstance) {
417
    $this->assertIsArray($csvInstance, 'Google_object', __METHOD__);
418
    $this->csvInstance = $csvInstance;
419
  }
420
  public function getCsvInstance() {
421
    return $this->csvInstance;
422
  }
423
  public function setLabel($label) {
424
    $this->label = $label;
425
  }
426
  public function getLabel() {
427
    return $this->label;
428
  }
429
}