# Google Cloud Retail V2 Client - Class PredictionResult (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class PredictionResult.

PredictionResult represents the recommendation prediction results.

Generated from protobuf message `google.cloud.retail.v2.PredictResponse.PredictionResult`

## Namespace

Google \\ Cloud \\ Retail \\ V2 \\ PredictResponse

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ id` | `string` ID of the recommended product |
| `↳ metadata` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Additional product metadata / annotations. Possible values: \* \* `product`: JSON representation of the product. Is set if `returnProduct` is set to true in `PredictRequest.params`. \* \* `score`: Prediction score in double value. Is set if `returnScore` is set to true in `PredictRequest.params`. |

### getId

ID of the recommended product

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setId

ID of the recommended product

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMetadata

Additional product metadata / annotations.

Possible values:

- `product`: JSON representation of the product. Is set if `returnProduct` is set to true in `PredictRequest.params`.
- `score`: Prediction score in double value. Is set if `returnScore` is set to true in `PredictRequest.params`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setMetadata

Additional product metadata / annotations.

Possible values:

- `product`: JSON representation of the product. Is set if `returnProduct` is set to true in `PredictRequest.params`.
- `score`: Prediction score in double value. Is set if `returnScore` is set to true in `PredictRequest.params`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |