Validation set manager
ValidationSetManager #
Responsible for everything related to validation sets. From creation to retrieval.
Attributes:
| Name | Type | Description |
|---|---|---|
rapid |
RapidsManager
|
The RapidsManager instance. |
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_classification_set #
create_classification_set(
name: str,
instruction: str,
answer_options: list[str],
datapoints: list[str],
truths: list[list[str]],
data_type: Literal["media", "text"] = "media",
contexts: list[str] | None = None,
media_contexts: list[str] | None = None,
explanations: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a classification validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction by which the labeler will answer. |
required |
answer_options
|
list[str]
|
The options to choose from when answering. |
required |
datapoints
|
list[str]
|
The datapoints that will be used for validation. |
required |
truths
|
list[list[str]]
|
The truths for each datapoint. Outer list is for each datapoint, inner list is for each truth. example: options: ["yes", "no", "maybe"] datapoints: ["datapoint1", "datapoint2"] truths: [["yes"], ["no", "maybe"]] -> first datapoint correct answer is "yes", second datapoint is "no" or "maybe" |
required |
data_type
|
str
|
The type of data. Defaults to "media" (any form of image, video or audio). Other option: "text". |
'media'
|
contexts
|
list[str]
|
The contexts for each datapoint. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction and answer options. (Therefore will be different for each datapoint) Will be match up with the datapoints using the list index. |
None
|
media_contexts
|
list[str]
|
The list of media contexts i.e. links to the images / videos for the comparison. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction. (Therefore will be different for each datapoint) Will be matched up with the datapoints using the list index. |
None
|
explanations
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first datapoint correct answer is "yes", second datapoint is "no" or "maybe"Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
create_compare_set #
create_compare_set(
name: str,
instruction: str,
datapoints: list[list[str]],
truths: list[str],
data_type: Literal["media", "text"] = "media",
contexts: list[str] | None = None,
media_contexts: list[str] | None = None,
explanation: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a comparison validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction to compare against. |
required |
truths
|
list[str]
|
The truths for each comparison. List is for each comparison. example: instruction: "Which image has a cat?" datapoints = [["image1.jpg", "image2.jpg"], ["image3.jpg", "image4.jpg"]] truths: ["image1.jpg", "image4.jpg"] -> first comparison image1.jpg has a cat, second comparison image4.jpg has a cat |
required |
datapoints
|
list[list[str]]
|
The compare datapoints to create the validation set with. Outer list is for each comparison, inner list the two images/texts that will be compared. |
required |
data_type
|
str
|
The type of data. Defaults to "media" (any form of image, video or audio). Other option: "text". |
'media'
|
contexts
|
list[str]
|
The contexts for each datapoint. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction and truth. (Therefore will be different for each datapoint) Will be match up with the datapoints using the list index. |
None
|
media_contexts
|
list[str]
|
The list of media contexts i.e. links to the images / videos for the comparison. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction. (Therefore will be different for each datapoint) Will be matched up with the datapoints using the list index. |
None
|
explanation
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first comparison image1.jpg has a cat, second comparison image4.jpg has a catSource code in src/rapidata/rapidata_client/validation/validation_set_manager.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
create_select_words_set #
create_select_words_set(
name: str,
instruction: str,
truths: list[list[int]],
datapoints: list[str],
sentences: list[str],
required_precision: float = 1.0,
required_completeness: float = 1.0,
explanation: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a select words validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction to show to the labeler. |
required |
truths
|
list[list[int]]
|
The truths for each datapoint. Outer list is for each datapoint, inner list is for each truth. example: datapoints: ["datapoint1", "datapoint2"] sentences: ["this example 1", "this example with another text"] truths: [[0, 1], [2]] -> first datapoint correct words are "this" and "example", second datapoint is "with" |
required |
datapoints
|
list[str]
|
The datapoints that will be used for validation. |
required |
sentences
|
list[str]
|
The sentences that will be used for validation. The sentece will be split up by spaces to be selected by the labeler. Must be the same length as datapoints. |
required |
required_precision
|
float
|
The required precision for the labeler to get the rapid correct (minimum ratio of the words selected that need to be correct). Defaults to 1.0 (no wrong word can be selected). |
1.0
|
required_completeness
|
float
|
The required completeness for the labeler to get the rapid correct (miminum ratio of total correct words selected). Defaults to 1.0 (all correct words need to be selected). |
1.0
|
explanation
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first datapoint the correct words are "this" and "example", second datapoint is "with"Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_locate_set #
create_locate_set(
name: str,
instruction: str,
truths: list[list[Box]],
datapoints: list[str],
contexts: list[str] | None = None,
media_contexts: list[str] | None = None,
explanation: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a locate validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction to show to the labeler. |
required |
truths
|
list[list[Box]]
|
The truths for each datapoint. Outer list is for each datapoint, inner list is for each truth. example: datapoints: ["datapoint1", "datapoint2"] truths: [[Box(0, 0, 100, 100)], [Box(50, 50, 150, 150)]] -> first datapoint the object is in the top left corner, second datapoint the object is in the center |
required |
datapoints
|
list[str]
|
The datapoints that will be used for validation. |
required |
contexts
|
list[str]
|
The contexts for each datapoint. Defaults to None. |
None
|
media_contexts
|
list[str]
|
The list of media contexts i.e. links to the images / videos for the comparison. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction. (Therefore will be different for each datapoint) Will be matched up with the datapoints using the list index. |
None
|
explanation
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first datapoint the object is in the top left corner, second datapoint the object is in the centerSource code in src/rapidata/rapidata_client/validation/validation_set_manager.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | |
create_draw_set #
create_draw_set(
name: str,
instruction: str,
truths: list[list[Box]],
datapoints: list[str],
contexts: list[str] | None = None,
media_contexts: list[str] | None = None,
explanation: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a draw validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction to show to the labeler. |
required |
truths
|
list[list[Box]]
|
The truths for each datapoint. Outer list is for each datapoint, inner list is for each truth. example: datapoints: ["datapoint1", "datapoint2"] truths: [[Box(0, 0, 100, 100)], [Box(50, 50, 150, 150)]] -> first datapoint the object is in the top left corner, second datapoint the object is in the center |
required |
datapoints
|
list[str]
|
The datapoints that will be used for validation. |
required |
contexts
|
list[str]
|
The contexts for each datapoint. Defaults to None. |
None
|
media_contexts
|
list[str]
|
The list of media contexts i.e. links to the images / videos for the comparison. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction. (Therefore will be different for each datapoint) Will be matched up with the datapoints using the list index. |
None
|
explanation
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first datapoint the object is in the top left corner, second datapoint the object is in the centerSource code in src/rapidata/rapidata_client/validation/validation_set_manager.py
404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | |
create_timestamp_set #
create_timestamp_set(
name: str,
instruction: str,
truths: list[list[tuple[int, int]]],
datapoints: list[str],
contexts: list[str] | None = None,
media_contexts: list[str] | None = None,
explanation: list[str | None] | None = None,
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a timestamp validation set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
instruction
|
str
|
The instruction to show to the labeler. |
required |
truths
|
list[list[tuple[int, int]]]
|
The truths for each datapoint defined as start and endpoint based on miliseconds. Outer list is for each datapoint, inner list is for each truth. example: datapoints: ["datapoint1", "datapoint2"] truths: [[(0, 10)], [(20, 30)]] -> first datapoint the correct interval is from 0 to 10, second datapoint the correct interval is from 20 to 30 |
required |
datapoints
|
list[str]
|
The datapoints that will be used for validation. |
required |
contexts
|
list[str]
|
The contexts for each datapoint. Defaults to None. |
None
|
media_contexts
|
list[str]
|
The list of media contexts i.e. links to the images / videos for the comparison. Defaults to None. If provided has to be the same length as datapoints and will be shown in addition to the instruction. (Therefore will be different for each datapoint) Will be matched up with the datapoints using the list index. |
None
|
explanation
|
list[str | None]
|
The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None. |
None
|
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Example
This would mean: first datapoint the correct interval is from 0 to 10, second datapoint the correct interval is from 20 to 30Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | |
create_mixed_set #
create_mixed_set(
name: str,
rapids: list[Rapid],
dimensions: list[str] = [],
) -> RapidataValidationSet
Create a validation set with a list of rapids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the validation set. (will not be shown to the labeler) |
required |
rapids
|
list[Rapid]
|
The list of rapids to add to the validation set. |
required |
dimensions
|
list[str]
|
The dimensions to add to the validation set accross which users will be tracked. Defaults to [] which is the default dimension. |
[]
|
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
get_validation_set_by_id #
get_validation_set_by_id(
validation_set_id: str,
) -> RapidataValidationSet
Get a validation set by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
validation_set_id
|
str
|
The ID of the validation set. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RapidataValidationSet |
RapidataValidationSet
|
The ValidationSet instance. |
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
find_validation_sets #
find_validation_sets(
name: str = "", amount: int = 10
) -> list[RapidataValidationSet]
Find validation sets by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to search for. Defaults to "" to match with any set. |
''
|
amount
|
int
|
The amount of validation sets to return. Defaults to 10. |
10
|
Returns:
| Type | Description |
|---|---|
list[RapidataValidationSet]
|
list[RapidataValidationSet]: The list of validation sets. |