# Discovery Engine v1beta API - Class QualityMetrics (1.0.0-beta23)

1.0.0-beta23 (latest) 1.0.0-beta22

    public sealed class QualityMetrics : IMessage<QualityMetrics>, IEquatable<QualityMetrics>, IDeepCloneable<QualityMetrics>, IBufferMessage, IMessage

Reference documentation and code samples for the Discovery Engine v1beta API class QualityMetrics.

Describes the metrics produced by the evaluation.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> QualityMetrics

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[QualityMetrics](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[QualityMetrics](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[QualityMetrics](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.DiscoveryEngine.V1Beta](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta)

## Assembly

Google.Cloud.DiscoveryEngine.V1Beta.dll

## Constructors

### QualityMetrics()

    public QualityMetrics()

### QualityMetrics(QualityMetrics)

    public QualityMetrics(QualityMetrics other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics` |

## Properties

### DocNdcg

    public QualityMetrics.Types.TopkMetrics DocNdcg { get; set; }

Normalized discounted cumulative gain (NDCG) per document, at various top-k
cutoff levels.

NDCG measures the ranking quality, giving higher relevance to top
results.

Example (top-3):
Suppose \[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\]
with three retrieved documents (D1, D2, D3) and binary relevance
judgements (1 for relevant, 0 for not relevant):

Retrieved: \[D3 (0), D1 (1), D2 (1)\]
Ideal: \[D1 (1), D2 (1), D3 (0)\]

Calculate NDCG@3 for each
\[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\]:

- DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
- Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
- NDCG@3: 1.13/1.63 = 0.693

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetricshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Types.TopkMetrics` |   |

### DocPrecision

    public QualityMetrics.Types.TopkMetrics DocPrecision { get; set; }

Precision per document, at various top-k cutoff levels.

Precision is the fraction of retrieved documents that are relevant.

Example (top-5):

- For a single \[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\], If 4 out of 5 retrieved documents in the top-5 are relevant, precision@5 = 4/5 = 0.8

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetricshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Types.TopkMetrics` |   |

### DocRecall

    public QualityMetrics.Types.TopkMetrics DocRecall { get; set; }

Recall per document, at various top-k cutoff levels.

Recall is the fraction of relevant documents retrieved out of all
relevant documents.

Example (top-5):

- For a single \[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\], If 3 out of 5 relevant documents are retrieved in the top-5, recall@5 = 3/5 = 0.6

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetricshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Types.TopkMetrics` |   |

### PageNdcg

    public QualityMetrics.Types.TopkMetrics PageNdcg { get; set; }

Normalized discounted cumulative gain (NDCG) per page, at various top-k
cutoff levels.

NDCG measures the ranking quality, giving higher relevance to top
results.

Example (top-3):
Suppose \[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\]
with three retrieved pages (P1, P2, P3) and binary relevance judgements (1
for relevant, 0 for not relevant):

Retrieved: \[P3 (0), P1 (1), P2 (1)\]
Ideal: \[P1 (1), P2 (1), P3 (0)\]

Calculate NDCG@3 for
\[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\]:

- DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
- Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
- NDCG@3: 1.13/1.63 = 0.693

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetricshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Types.TopkMetrics` |   |

### PageRecall

    public QualityMetrics.Types.TopkMetrics PageRecall { get; set; }

Recall per page, at various top-k cutoff levels.

Recall is the fraction of relevant pages retrieved out of all relevant
pages.

Example (top-5):

- For a single \[SampleQuery\]\[google.cloud.discoveryengine.v1beta.SampleQuery\], if 3 out of 5 relevant pages are retrieved in the top-5, recall@5 = 3/5 = 0.6

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetricshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.DiscoveryEngine.V1Beta/latest/Google.Cloud.DiscoveryEngine.V1Beta.QualityMetrics.Types.TopkMetrics` |   |