Skip to content

Commit 2422d97

Browse files
feat: UTC-243: Add model agreement stats to SDK (#634)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 9717454 commit 2422d97

File tree

12 files changed

+960
-148
lines changed

12 files changed

+960
-148
lines changed

.mock/definition/projects/stats.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
types:
2+
StatsModelVersionAnnotatorAgreementResponse:
3+
properties:
4+
agreement: optional<double>
5+
source:
6+
openapi: openapi/openapi.yaml
7+
StatsModelVersionGroundTruthAgreementResponse:
8+
properties:
9+
agreement: optional<double>
10+
source:
11+
openapi: openapi/openapi.yaml
12+
StatsModelVersionPredictionAgreementResponse:
13+
properties:
14+
average_prediction_agreement_per_model: optional<double>
15+
source:
16+
openapi: openapi/openapi.yaml
217
StatsIaaResponseIaa:
318
discriminated: false
419
docs: >-
@@ -216,6 +231,113 @@ service:
216231
auth: false
217232
base-path: ''
218233
endpoints:
234+
model_version_annotator_agreement:
235+
path: /api/projects/{id}/model-stats/{model_version}/agreement
236+
method: GET
237+
auth: true
238+
docs: >-
239+
<Card href="https://humansignal.com/goenterprise">
240+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
241+
<p style="margin-top: 10px; font-size: 14px;">
242+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
243+
</p>
244+
</Card>
245+
Get agreement between a given model version and all annotators in the
246+
project for overlapping tasks.
247+
source:
248+
openapi: openapi/openapi.yaml
249+
path-parameters:
250+
id: integer
251+
model_version: string
252+
display-name: Get model-version overall agreement vs annotators
253+
response:
254+
docs: Model-version overall agreement vs annotators
255+
type: StatsModelVersionAnnotatorAgreementResponse
256+
examples:
257+
- path-parameters:
258+
id: 1
259+
model_version: model_version
260+
response:
261+
body:
262+
agreement: 1.1
263+
audiences:
264+
- public
265+
model_version_ground_truth_agreement:
266+
path: /api/projects/{id}/model-stats/{model_version}/agreement-groundtruth
267+
method: GET
268+
auth: true
269+
docs: >-
270+
<Card href="https://humansignal.com/goenterprise">
271+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
272+
<p style="margin-top: 10px; font-size: 14px;">
273+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
274+
</p>
275+
</Card>
276+
Get agreement between a given model version and ground truth annotations
277+
in the project for overlapping tasks.
278+
source:
279+
openapi: openapi/openapi.yaml
280+
path-parameters:
281+
id: integer
282+
model_version: string
283+
display-name: Get model-version ground truth agreement
284+
request:
285+
name: StatsModelVersionGroundTruthAgreementRequest
286+
query-parameters:
287+
per_label:
288+
type: optional<boolean>
289+
default: false
290+
docs: Calculate agreement per label
291+
response:
292+
docs: Model-version ground truth agreement
293+
type: StatsModelVersionGroundTruthAgreementResponse
294+
examples:
295+
- path-parameters:
296+
id: 1
297+
model_version: model_version
298+
response:
299+
body:
300+
agreement: 1.1
301+
audiences:
302+
- public
303+
model_version_prediction_agreement:
304+
path: /api/projects/{id}/model-stats/{model_version}/prediction
305+
method: GET
306+
auth: true
307+
docs: >-
308+
<Card href="https://humansignal.com/goenterprise">
309+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
310+
<p style="margin-top: 10px; font-size: 14px;">
311+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
312+
</p>
313+
</Card>
314+
Get agreement between a given model version and all other model versions
315+
in the project for overlapping tasks.
316+
source:
317+
openapi: openapi/openapi.yaml
318+
path-parameters:
319+
id: integer
320+
model_version: string
321+
display-name: Get model-version prediction agreement
322+
request:
323+
name: StatsModelVersionPredictionAgreementRequest
324+
query-parameters:
325+
per_label:
326+
type: optional<boolean>
327+
default: false
328+
docs: Calculate agreement per label
329+
response:
330+
docs: Model-version prediction agreement
331+
type: StatsModelVersionPredictionAgreementResponse
332+
examples:
333+
- path-parameters:
334+
id: 1
335+
model_version: model_version
336+
response:
337+
body:
338+
average_prediction_agreement_per_model: 1.1
339+
audiences:
340+
- public
219341
iaa:
220342
path: /api/projects/{id}/stats/IAA
221343
method: GET

.mock/definition/stats.yml

Lines changed: 0 additions & 132 deletions
This file was deleted.

.mock/openapi/openapi.yaml

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8574,10 +8574,13 @@ paths:
85748574
/api/projects/{id}/model-stats/{model_version}/agreement:
85758575
get:
85768576
description: |-
8577-
Overall agreement between a given model version's predictions and all annotators on overlapping tasks.
8578-
Computed as the average of per-annotator agreement vs this model version over annotators who overlap on at least one task.
8579-
Mirrors IAA per annotator, but one side is the model.
8580-
:return: {"agreement": float[0..1]}
8577+
<Card href="https://humansignal.com/goenterprise">
8578+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
8579+
<p style="margin-top: 10px; font-size: 14px;">
8580+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
8581+
</p>
8582+
</Card>
8583+
Get agreement between a given model version and all annotators in the project for overlapping tasks.
85818584
operationId: api_projects_model_stats_agreement_retrieve
85828585
parameters:
85838586
- in: path
@@ -8597,6 +8600,7 @@ paths:
85978600
schema:
85988601
properties:
85998602
agreement:
8603+
nullable: true
86008604
type: number
86018605
type: object
86028606
description: Model-version overall agreement vs annotators
@@ -8605,12 +8609,22 @@ paths:
86058609
summary: Get model-version overall agreement vs annotators
86068610
tags:
86078611
- Stats
8612+
x-fern-audiences:
8613+
- public
8614+
x-fern-sdk-group-name:
8615+
- projects
8616+
- stats
8617+
x-fern-sdk-method-name: model_version_annotator_agreement
86088618
/api/projects/{id}/model-stats/{model_version}/agreement-groundtruth:
86098619
get:
86108620
description: |-
8611-
Ground truth agreement for annotations that match predictions of a specific model version.
8612-
This mirrors gt_per_user_agreement but filters stats by tasks where predictions have given model_version.
8613-
:return: {"agreement": float[0..1]}
8621+
<Card href="https://humansignal.com/goenterprise">
8622+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
8623+
<p style="margin-top: 10px; font-size: 14px;">
8624+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
8625+
</p>
8626+
</Card>
8627+
Get agreement between a given model version and ground truth annotations in the project for overlapping tasks.
86148628
operationId: api_projects_model_stats_agreement_groundtruth_retrieve
86158629
parameters:
86168630
- in: path
@@ -8636,6 +8650,7 @@ paths:
86368650
schema:
86378651
properties:
86388652
agreement:
8653+
nullable: true
86398654
type: number
86408655
type: object
86418656
description: Model-version ground truth agreement
@@ -8644,17 +8659,22 @@ paths:
86448659
summary: Get model-version ground truth agreement
86458660
tags:
86468661
- Stats
8662+
x-fern-audiences:
8663+
- public
8664+
x-fern-sdk-group-name:
8665+
- projects
8666+
- stats
8667+
x-fern-sdk-method-name: model_version_ground_truth_agreement
86478668
/api/projects/{id}/model-stats/{model_version}/prediction:
86488669
get:
86498670
description: |-
8650-
Mean agreement between the given model version and all other model versions in the project.
8651-
8652-
Computed as the average of pairwise model-to-model agreement scores from PredictionPairStats where either
8653-
prediction pair's model_version_from or model_version_to equals the provided model_version.
8654-
8655-
When per_label=true, returns a mapping of label -> average agreement across the same set of pairs.
8656-
8657-
:return: {"average_prediction_agreement_per_model": float[0..1] | {label: float[0..1]}}
8671+
<Card href="https://humansignal.com/goenterprise">
8672+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
8673+
<p style="margin-top: 10px; font-size: 14px;">
8674+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
8675+
</p>
8676+
</Card>
8677+
Get agreement between a given model version and all other model versions in the project for overlapping tasks.
86588678
operationId: api_projects_model_stats_prediction_retrieve
86598679
parameters:
86608680
- in: path
@@ -8680,6 +8700,7 @@ paths:
86808700
schema:
86818701
properties:
86828702
average_prediction_agreement_per_model:
8703+
nullable: true
86838704
type: number
86848705
type: object
86858706
description: Model-version prediction agreement
@@ -8688,6 +8709,12 @@ paths:
86888709
summary: Get model-version prediction agreement
86898710
tags:
86908711
- Stats
8712+
x-fern-audiences:
8713+
- public
8714+
x-fern-sdk-group-name:
8715+
- projects
8716+
- stats
8717+
x-fern-sdk-method-name: model_version_prediction_agreement
86918718
/api/projects/{id}/project-extra-params/:
86928719
get:
86938720
description: |-

0 commit comments

Comments
 (0)