Copyright | (c) 2015-2016 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Performs prediction on the data in the request. Responses are very similar to requests. There are two top-level fields, each of which are JSON lists:
- predictions
- The list of predictions, one per instance in the request.
- error
- An error message returned instead of a prediction list if any instance produced an error.
If the call is successful, the response body will contain one prediction entry per instance in the request body. If prediction fails for any instance, the response body will contain no predictions and will contian a single error entry instead. Even though there is one prediction per instance, the format of a prediction is not directly related to the format of an instance. Predictions take whatever format is specified in the outputs collection defined in the model. The collection of predictions is returned in a JSON list. Each member of the list can be a simple value, a list, or a JSON object of any complexity. If your model has more than one output tensor, each prediction will be a JSON object containing a name/value pair for each output. The names identify the output aliases in the graph. The following examples show some possible responses: A simple set of predictions for three input instances, where each prediction is an integer value:
{"predictions": [5, 4, 3]}
A more complex set of predictions, each containing two named values that correspond to output tensors, named **label** and **scores** respectively. The value of **label** is the predicted category ("car" or "beach") and **scores** contains a list of probabilities for that instance across the possible categories.
{"predictions": [{"label": "beach", "scores": [0.1, 0.9]}, {"label": "car", "scores": [0.75, 0.25]}]}
A response when there is an error processing an input instance:
{"error": "Divide by zero"}
See: Google Cloud Machine Learning Reference for ml.projects.predict
.
- type ProjectsPredictResource = "v1beta1" :> (CaptureMode "name" "predict" Text :> (QueryParam "$.xgafv" Xgafv :> (QueryParam "upload_protocol" Text :> (QueryParam "pp" Bool :> (QueryParam "access_token" Text :> (QueryParam "uploadType" Text :> (QueryParam "bearer_token" Text :> (QueryParam "callback" Text :> (QueryParam "alt" AltJSON :> (ReqBody '[JSON] GoogleCloudMlV1beta1__PredictRequest :> Post '[JSON] GoogleAPI__HTTPBody))))))))))
- projectsPredict :: GoogleCloudMlV1beta1__PredictRequest -> Text -> ProjectsPredict
- data ProjectsPredict
- ppXgafv :: Lens' ProjectsPredict (Maybe Xgafv)
- ppUploadProtocol :: Lens' ProjectsPredict (Maybe Text)
- ppPp :: Lens' ProjectsPredict Bool
- ppAccessToken :: Lens' ProjectsPredict (Maybe Text)
- ppUploadType :: Lens' ProjectsPredict (Maybe Text)
- ppPayload :: Lens' ProjectsPredict GoogleCloudMlV1beta1__PredictRequest
- ppBearerToken :: Lens' ProjectsPredict (Maybe Text)
- ppName :: Lens' ProjectsPredict Text
- ppCallback :: Lens' ProjectsPredict (Maybe Text)
REST Resource
type ProjectsPredictResource = "v1beta1" :> (CaptureMode "name" "predict" Text :> (QueryParam "$.xgafv" Xgafv :> (QueryParam "upload_protocol" Text :> (QueryParam "pp" Bool :> (QueryParam "access_token" Text :> (QueryParam "uploadType" Text :> (QueryParam "bearer_token" Text :> (QueryParam "callback" Text :> (QueryParam "alt" AltJSON :> (ReqBody '[JSON] GoogleCloudMlV1beta1__PredictRequest :> Post '[JSON] GoogleAPI__HTTPBody)))))))))) Source #
A resource alias for ml.projects.predict
method which the
ProjectsPredict
request conforms to.
Creating a Request
Creates a value of ProjectsPredict
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
data ProjectsPredict Source #
Performs prediction on the data in the request. Responses are very similar to requests. There are two top-level fields, each of which are JSON lists:
- predictions
- The list of predictions, one per instance in the request.
- error
- An error message returned instead of a prediction list if any instance produced an error.
If the call is successful, the response body will contain one prediction entry per instance in the request body. If prediction fails for any instance, the response body will contain no predictions and will contian a single error entry instead. Even though there is one prediction per instance, the format of a prediction is not directly related to the format of an instance. Predictions take whatever format is specified in the outputs collection defined in the model. The collection of predictions is returned in a JSON list. Each member of the list can be a simple value, a list, or a JSON object of any complexity. If your model has more than one output tensor, each prediction will be a JSON object containing a name/value pair for each output. The names identify the output aliases in the graph. The following examples show some possible responses: A simple set of predictions for three input instances, where each prediction is an integer value:
{"predictions": [5, 4, 3]}
A more complex set of predictions, each containing two named values that correspond to output tensors, named **label** and **scores** respectively. The value of **label** is the predicted category ("car" or "beach") and **scores** contains a list of probabilities for that instance across the possible categories.
{"predictions": [{"label": "beach", "scores": [0.1, 0.9]}, {"label": "car", "scores": [0.75, 0.25]}]}
A response when there is an error processing an input instance:
{"error": "Divide by zero"}
See: projectsPredict
smart constructor.
Request Lenses
ppUploadProtocol :: Lens' ProjectsPredict (Maybe Text) Source #
Upload protocol for media (e.g. "raw", "multipart").
ppAccessToken :: Lens' ProjectsPredict (Maybe Text) Source #
OAuth access token.
ppUploadType :: Lens' ProjectsPredict (Maybe Text) Source #
Legacy upload protocol for media (e.g. "media", "multipart").
ppPayload :: Lens' ProjectsPredict GoogleCloudMlV1beta1__PredictRequest Source #
Multipart request metadata.
ppBearerToken :: Lens' ProjectsPredict (Maybe Text) Source #
OAuth bearer token.
ppName :: Lens' ProjectsPredict Text Source #
Required. The resource name of a model or a version. Authorization: requires `Viewer` role on the parent project.
ppCallback :: Lens' ProjectsPredict (Maybe Text) Source #
JSONP