Skip to content

Class Mappings for scikit-learn

This topic shows you how to set class mappings and their effects.

Preparation

Go through Getting Started for scikit-learn.

Note

Ensure that you can successfully run the mnist.py training script that resulted from integration with the MissingLink SDK. In the steps that follow below, the script is further developed to include class mappings.

Write code

You can replace the class names in your confusion matrix using:

`project.set_properties(class_mapping=class_mapping)`

In the case of MNIST, doing so is not too useful but, for example, when training on Imagenet, it helps a lot.

class_mapping = {
    "0": "zero",
    "1": "one",
    "2": "two",
    "3": "three",
    "4": "four",
    "5": "five",
    "6": "six",
    "7": "seven",
    "8": "eight",
    "9": "nine",
}
project.set_properties(class_mapping=class_mapping)

You should have added class mappings to your experiment successfully.

  • Inspect the resulting script here.

  • Run the new script and see how MissingLink's dashboard helps with monitoring the experiment's class mappings.