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: str = MEDIA,
contexts: list[str] | None = None,
print_confirmation: bool = True,
) -> 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. Outher 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 RapidataDataTypes.MEDIA. Other option: RapidataDataTypes.TEXT ("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
|
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_compare_set #
create_compare_set(
name: str,
instruction: str,
datapoints: list[list[str]],
truths: list[str],
data_type: str = MEDIA,
contexts: list[str] | None = None,
print_confirmation: bool = True,
) -> 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 RapidataDataTypes.MEDIA. Other option: RapidataDataTypes.TEXT ("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
|
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_select_words_set #
create_select_words_set(
name: str,
instruction: str,
truths: list[list[int]],
datapoints: list[str],
sentences: list[str],
strict_grading: bool = True,
print_confirmation: bool = True,
) -> 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. Outher list is for each datapoint, inner list is for each truth. example: datapoints: ["datapoint1", "datapoint2"] sentences: ["this example 1", "this example 2"] truths: [[0, 1], [2]] -> first datapoint correct words are "this" and "example", second datapoint is "2" |
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 |
strict_grading
|
bool
|
Whether to grade strictly. Defaults to True. If True, the labeler must select all correct words to be graded as correct. (and no wrong words) If False, the labeler must select at least one correct word to be graded as correct. (and no wrong words) |
True
|
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
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,
print_confirmation: bool = True,
) -> 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. Outher 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
|
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_draw_set #
create_draw_set(
name: str,
instruction: str,
truths: list[list[Box]],
datapoints: list[str],
contexts: list[str] | None = None,
print_confirmation: bool = True,
) -> 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. Outher 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
|
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
Source code in src/rapidata/rapidata_client/validation/validation_set_manager.py
create_mixed_set #
create_mixed_set(
name: str,
rapids: Sequence[Rapid],
print_confirmation: bool = True,
) -> 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
|
Sequence[Rapid]
|
The list of rapids to add to the validation set. |
required |
print_confirmation
|
bool
|
Whether to print a confirmation message that validation set has been created. Defaults to True. |
True
|
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 = 1
) -> 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 1. |
1
|
Returns:
Type | Description |
---|---|
list[RapidataValidationSet]
|
list[RapidataValidationSet]: The list of validation sets. |