Skip to content

[Abstract] Supervised Model

João Saraiva edited this page Jun 9, 2022 · 1 revision

A Supervised Model is any machine learning model that learns by being supervised by a loss function, that quantifies how far its output is from what is desired.

How to instantiate a Supervised Model

It is an abstract class, so you need to instantiate one of its subclasses. You can create your own subclasses or use predefined ones:

Anyway, to initialize any of the subclasses you'll have to give a design. Depending on each family of models, the design that is accepted changes. For instance, for the SkLearnModel you may only give designs that are SkLearn classifiers. refer to each specific family of models to know more.

Setup

Each Supervised Model has a setup method, which should be called before any train-test session begins. This method might require some parameters.

Train

To train it, just call the train method, and give an object and a target:

model.train(object, target)

Test

To test it based on the previous train, just call the test method, and give an object and a target:

model.test(object, target)

You may not give a target and the prediction will be returned.

y = model.test(object)

Report

To get the metrics and performance plots of the previous train-test session, call the report method. You should give a Supervised Train Report :

y = model.report(reporter= SupervisedTrainReport(), show:bool, save_to:str)

Optionals:

  • show: Report is printed to the terminal.
  • save_to: Report is saved as PDF in the specified directory.