1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CloudMachineLearningEngine\Resource;
19
20use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1AddTrialMeasurementRequest;
21use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1CheckTrialEarlyStoppingStateRequest;
22use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1CompleteTrialRequest;
23use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1ListOptimalTrialsRequest;
24use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1ListOptimalTrialsResponse;
25use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1ListTrialsResponse;
26use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1StopTrialRequest;
27use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1SuggestTrialsRequest;
28use Google\Service\CloudMachineLearningEngine\GoogleCloudMlV1Trial;
29use Google\Service\CloudMachineLearningEngine\GoogleLongrunningOperation;
30use Google\Service\CloudMachineLearningEngine\GoogleProtobufEmpty;
31
32/**
33 * The "trials" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $mlService = new Google\Service\CloudMachineLearningEngine(...);
37 *   $trials = $mlService->trials;
38 *  </code>
39 */
40class ProjectsLocationsStudiesTrials extends \Google\Service\Resource
41{
42  /**
43   * Adds a measurement of the objective metrics to a trial. This measurement is
44   * assumed to have been taken before the trial is complete.
45   * (trials.addMeasurement)
46   *
47   * @param string $name Required. The trial name.
48   * @param GoogleCloudMlV1AddTrialMeasurementRequest $postBody
49   * @param array $optParams Optional parameters.
50   * @return GoogleCloudMlV1Trial
51   */
52  public function addMeasurement($name, GoogleCloudMlV1AddTrialMeasurementRequest $postBody, $optParams = [])
53  {
54    $params = ['name' => $name, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('addMeasurement', [$params], GoogleCloudMlV1Trial::class);
57  }
58  /**
59   * Checks whether a trial should stop or not. Returns a long-running operation.
60   * When the operation is successful, it will contain a
61   * CheckTrialEarlyStoppingStateResponse. (trials.checkEarlyStoppingState)
62   *
63   * @param string $name Required. The trial name.
64   * @param GoogleCloudMlV1CheckTrialEarlyStoppingStateRequest $postBody
65   * @param array $optParams Optional parameters.
66   * @return GoogleLongrunningOperation
67   */
68  public function checkEarlyStoppingState($name, GoogleCloudMlV1CheckTrialEarlyStoppingStateRequest $postBody, $optParams = [])
69  {
70    $params = ['name' => $name, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('checkEarlyStoppingState', [$params], GoogleLongrunningOperation::class);
73  }
74  /**
75   * Marks a trial as complete. (trials.complete)
76   *
77   * @param string $name Required. The trial name.metat
78   * @param GoogleCloudMlV1CompleteTrialRequest $postBody
79   * @param array $optParams Optional parameters.
80   * @return GoogleCloudMlV1Trial
81   */
82  public function complete($name, GoogleCloudMlV1CompleteTrialRequest $postBody, $optParams = [])
83  {
84    $params = ['name' => $name, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('complete', [$params], GoogleCloudMlV1Trial::class);
87  }
88  /**
89   * Adds a user provided trial to a study. (trials.create)
90   *
91   * @param string $parent Required. The name of the study that the trial belongs
92   * to.
93   * @param GoogleCloudMlV1Trial $postBody
94   * @param array $optParams Optional parameters.
95   * @return GoogleCloudMlV1Trial
96   */
97  public function create($parent, GoogleCloudMlV1Trial $postBody, $optParams = [])
98  {
99    $params = ['parent' => $parent, 'postBody' => $postBody];
100    $params = array_merge($params, $optParams);
101    return $this->call('create', [$params], GoogleCloudMlV1Trial::class);
102  }
103  /**
104   * Deletes a trial. (trials.delete)
105   *
106   * @param string $name Required. The trial name.
107   * @param array $optParams Optional parameters.
108   * @return GoogleProtobufEmpty
109   */
110  public function delete($name, $optParams = [])
111  {
112    $params = ['name' => $name];
113    $params = array_merge($params, $optParams);
114    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
115  }
116  /**
117   * Gets a trial. (trials.get)
118   *
119   * @param string $name Required. The trial name.
120   * @param array $optParams Optional parameters.
121   * @return GoogleCloudMlV1Trial
122   */
123  public function get($name, $optParams = [])
124  {
125    $params = ['name' => $name];
126    $params = array_merge($params, $optParams);
127    return $this->call('get', [$params], GoogleCloudMlV1Trial::class);
128  }
129  /**
130   * Lists the trials associated with a study.
131   * (trials.listProjectsLocationsStudiesTrials)
132   *
133   * @param string $parent Required. The name of the study that the trial belongs
134   * to.
135   * @param array $optParams Optional parameters.
136   * @return GoogleCloudMlV1ListTrialsResponse
137   */
138  public function listProjectsLocationsStudiesTrials($parent, $optParams = [])
139  {
140    $params = ['parent' => $parent];
141    $params = array_merge($params, $optParams);
142    return $this->call('list', [$params], GoogleCloudMlV1ListTrialsResponse::class);
143  }
144  /**
145   * Lists the pareto-optimal trials for multi-objective study or the optimal
146   * trials for single-objective study. The definition of pareto-optimal can be
147   * checked in wiki page. https://en.wikipedia.org/wiki/Pareto_efficiency
148   * (trials.listOptimalTrials)
149   *
150   * @param string $parent Required. The name of the study that the pareto-optimal
151   * trial belongs to.
152   * @param GoogleCloudMlV1ListOptimalTrialsRequest $postBody
153   * @param array $optParams Optional parameters.
154   * @return GoogleCloudMlV1ListOptimalTrialsResponse
155   */
156  public function listOptimalTrials($parent, GoogleCloudMlV1ListOptimalTrialsRequest $postBody, $optParams = [])
157  {
158    $params = ['parent' => $parent, 'postBody' => $postBody];
159    $params = array_merge($params, $optParams);
160    return $this->call('listOptimalTrials', [$params], GoogleCloudMlV1ListOptimalTrialsResponse::class);
161  }
162  /**
163   * Stops a trial. (trials.stop)
164   *
165   * @param string $name Required. The trial name.
166   * @param GoogleCloudMlV1StopTrialRequest $postBody
167   * @param array $optParams Optional parameters.
168   * @return GoogleCloudMlV1Trial
169   */
170  public function stop($name, GoogleCloudMlV1StopTrialRequest $postBody, $optParams = [])
171  {
172    $params = ['name' => $name, 'postBody' => $postBody];
173    $params = array_merge($params, $optParams);
174    return $this->call('stop', [$params], GoogleCloudMlV1Trial::class);
175  }
176  /**
177   * Adds one or more trials to a study, with parameter values suggested by AI
178   * Platform Vizier. Returns a long-running operation associated with the
179   * generation of trial suggestions. When this long-running operation succeeds,
180   * it will contain a SuggestTrialsResponse. (trials.suggest)
181   *
182   * @param string $parent Required. The name of the study that the trial belongs
183   * to.
184   * @param GoogleCloudMlV1SuggestTrialsRequest $postBody
185   * @param array $optParams Optional parameters.
186   * @return GoogleLongrunningOperation
187   */
188  public function suggest($parent, GoogleCloudMlV1SuggestTrialsRequest $postBody, $optParams = [])
189  {
190    $params = ['parent' => $parent, 'postBody' => $postBody];
191    $params = array_merge($params, $optParams);
192    return $this->call('suggest', [$params], GoogleLongrunningOperation::class);
193  }
194}
195
196// Adding a class alias for backwards compatibility with the previous class name.
197class_alias(ProjectsLocationsStudiesTrials::class, 'Google_Service_CloudMachineLearningEngine_Resource_ProjectsLocationsStudiesTrials');
198