Data Leakage Test
The Data Leakage Test in RagaAI is designed to identify both exact and near duplicates within your image dataset.
Execute Test:
The following code snippet is set up to perform a Near Duplicate Detection Test, helping you to identify and address duplicate images in your dataset.
Step 1: Define the Duplication Detection Rules
Start by creating rules to identify what constitutes a near duplicate in your dataset.
DLRules()
: Initialises the rules for the data leakage test.rules.add()
: Adds a rule for detecting duplicates:metric
: The performance metric used for detection, "similarity_score" in this instance.metric_threshold
: The threshold for the similarity score; a value of 0.99 indicates a very high similarity, typical of near duplicates.
data_leakage_test()
: Configures the near duplicate detection test with the following parameters:test_session
: The session object linked to your RagaAI project.train_dataset_name
: Contains the name of your train dataset.dataset_name
: Contains the name of your field dataset.type
: The type of test, "near_duplicates" in this case.output_type
: The expected result of the test, "near_duplicates" here.train_embed_col_name
: The column name in your training dataset containing the embeddings used for comparison.embed_col_name
: The column name in your field dataset containing the embeddings used for comparison.rules
: The previously defined rules for data leakage test.
test_session.add()
: Registers the near duplicate detection test within the session.test_session.run()
: Initiates the execution of all tests in the session, including the near duplicate detection test.
By following these steps, you have successfully set up and executed a Data Leakage Test on the RagaAI Testing Platform.
Post-execution, review the results to identify and remove or handle duplicates as necessary.
Analysing Test Results
Overlap Assessment: The test evaluates each image against others, assigning overlap scores.
Classification: Images with a overlap score above the threshold to any other image are classified as 'failed'.
![](https://docs.raga.ai/~gitbook/image?url=https%3A%2F%2F1811327582-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FYbIiNdp1QbG4avl7VShw%252Fuploads%252FpcZp48Te7AM8BMyYgX30%252FScreenshot%25202024-01-16%2520at%252015.50.52.png%3Falt%3Dmedia%26token%3D51394e53-d085-4821-8094-d7d39eb6844c&width=768&dpr=4&quality=100&sign=9a1e443a&sv=1)
Analysing Results
Embedding View: View your dataset in an interactive visual format to identify clusters of duplicates.
Datagrid View: Scan through images and their pass/fail status.
![](https://docs.raga.ai/~gitbook/image?url=https%3A%2F%2F1811327582-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FYbIiNdp1QbG4avl7VShw%252Fuploads%252FiXT9LaIYH4RGByw25b1g%252FScreenshot%25202024-01-16%2520at%252015.51.39.png%3Falt%3Dmedia%26token%3D64b68810-646a-4969-8f80-1b49d71564ef&width=768&dpr=4&quality=100&sign=d67a9b4e&sv=1)
Detailed Review
Image View: Click on an image and view the similar datapoints in the train dataset along with the overlap scores.
![](https://docs.raga.ai/~gitbook/image?url=https%3A%2F%2F1811327582-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FYbIiNdp1QbG4avl7VShw%252Fuploads%252FXLdJYev6uTJYBiIyhZtj%252FScreenshot%25202024-01-16%2520at%252015.52.45.png%3Falt%3Dmedia%26token%3D87655cbc-c3a3-43b2-9d64-258362543db7&width=768&dpr=4&quality=100&sign=47631776&sv=1)
This proactive approach safeguards the model's resilience, enabling it to consistently generalize to novel, unseen data while minimizing the impact of any leaked information.
Last updated