Validator Fundamentals — Module 3 of 4
Click to start
“As a validator who has already run and logged data quality tests with ValidMind, I want to next run both out-of-the-box and custom model evaluation tests for the champion model and a potential challenger model, and use the results of my testing to log model findings.”
This third module is part of a four-part series:
Validator Fundamentals
First, let’s make sure you can log in to ValidMind.
Training is interactive — you explore ValidMind live. Try it!
→ , ↓ , SPACE , N — next slide ← , ↑ , P , H — previous slide ? — all keyboard shortcuts
To continue, you need to have been onboarded onto ValidMind Academy with the Validator role and completed the first two modules of this course:
Be sure to return to this page afterwards.
Jupyter Notebook series
These notebooks walk you through how to validate a model using ValidMind, complete with supporting test results attached as evidence to your validation report.
You will need to have already completed notebooks 1 and 2 during the first and second modules to proceed.
Our series of four introductory notebooks for model validators include sample code and how-to information to get you started with ValidMind:
1 — Set up the ValidMind Library for validation
2 — Start the model validation process
3 — Developing a potential challenger model
4 — Finalize testing and reporting
In this third module, we’ll run through the remaining two notebooks 3 in Section 1 and 4 in Section 2 together.
Let’s continue our journey with Section 1 on the next page.
ValidMind generates a unique code snippet for each registered model to connect with your validation environment:
Can’t load the ValidMind Platform?
Make sure you’re logged in and have refreshed the page in a Chromium-based web browser.
Connect to your model
With your code snippet copied to your clipboard:
When you’re done, return to this page and click to continue.
Import the champion model
Next, let’s import the champion model submitted by the model development team in the format of a .pkl
file for evaluation:
When you’re done, return to this page and click to continue.
Champion vs. challenger models
Try it live on the next pages.
We’re curious how an alternate model compares to our champion model, so let’s train a challenger model as a basis for our testing:
Random forest classification model
Let’s train our potential challenger model:
When you’re done, return to this page and click to continue.
Initialize the model objects
In addition to the initialized datasets, you’ll also need to initialize a ValidMind model object (vm_model
) that can be passed to other functions for analysis and tests on the data for each of our two models using the vm.init_model()
method:
When you’re done, return to this page and click to continue.
Model evaluation testing
Try it live on the next pages.
With everything ready for us, let’s run the rest of our validation tests. We’ll focus on comprehensive testing around model performance of both the champion and challenger models going forward as we’ve already verified the data quality of the datasets used to train the champion model:
We’ll start with some performance tests, beginning with independent testing of our champion logistic regression model, then moving on to our potential challenger model.
Next, we want to inspect the robustness and stability testing comparison between our champion and challenger model.
Finally, we want to verify the relative influence of different input features on our models’ predictions, as well as inspect the differences between our champion and challenger model to see if a certain model offers more understandable or logical importance scores for features.
Run model performance tests
Use the list_tests()
function to identify all the model performance tests for classification:
When you’re done, return to this page and click to continue.
Log a model finding
(Scroll down for the full instructions.)
Try it live on the next page.
As we can observe from the output in our notebook, our champion model doesn’t pass the MinimumAccuracy
test based on the default thresholds of the out-of-the-box test, so let’s log a model finding in the ValidMind Platform:
From the Inventory in the ValidMind Platform, go to the model you connected to earlier.
In the left sidebar that appears for your model, click Validation Report.
Locate the Data Preparation section and click on 2.2.2. Model Performance to expand that section.
Under the Model Performance Metrics section, locate Findings then click Link Finding to Report:
Click Create New Finding to add a finding.
Enter in the details for your finding, for example:
Click Save.
Select the finding you just added to link to your validation report.
Click Update Linked Findings to insert your finding.
Confirm that finding you inserted has been correctly inserted into section 2.2.2. Model Performance of the report.
Click on the finding to expand the finding, where you can adjust details such as severity, owner, due date, status, etc. as well as include proposed remediation plans or supporting documentation as attachments.
Create a model finding
Run diagnostic tests
This time, use list_tests()
to identify all the model diagnosis tests for classification:
When you’re done, return to this page and click to continue.
Run feature importance tests
Use list_tests()
again to identify all the feature importance tests for classification:
When you’re done, return to this page and click to continue.
4 — Finalize testing and reporting
This is the final notebook in our introductory series, which will walk you through how to supplement ValidMind tests with your own custom tests and include them as additional evidence in your validation report, and wrap up your validation testing.
Scroll through this notebook to explore. When you are done, click to continue.
As usual, let’s connect back up to your model in the ValidMind Platform:
Connect to your model
With your code snippet copied to your clipboard:
When you’re done, return to this page and click to continue.
Custom tests
Try it live on the next pages.
Let’s implement a custom test that calculates a confusion matrix:
Implement a custom inline test
An inline test refers to a test written and executed within the same environment as the code being tested — in the following example, right in our Jupyter Notebook — without requiring a separate test file or framework:
When you’re done, return to this page and click to continue.
Use external test providers
Sometimes you may want to reuse the same set of custom tests across multiple models and share them with others in your organization, like the model development team would have done with you in this example workflow featured in this series of notebooks:
When you’re done, return to this page and click to continue.
Verify model development testing
Our final task is to verify that all the tests provided by the model development team were run and reported accurately:
When you’re done, return to this page and click to continue.
Developing challenger models
In this third module, you learned how to:
Continue your model development journey with:
Finalizing Validation Reports
ValidMind Academy | Home