Sample State Transitions

Learn about thesample state transitions.

Object’s life cycle

Let’s look at the life cycles of Sample objects. An object’s life cycle starts with object creation, then state changes, and (in some cases) the end of its processing life when there are no more references to it. We have three scenarios:

Initial load

We’ll need a load() method to populate a TrainingData object from some source of raw data. We can imagine a load() method using a CSV reader to create Sample objects with a species value, making them KnownSample objects. The load() method splits the KnownSample objects into the training and testing lists, which is an important state change for a TrainingData object.

Hyperparameter testing

We’ll need a test() method in the Hyperparameter class. The body of the test() method works with the test samples in the associated TrainingData object. For each sample, it applies the classifier and counts the matches between botanist-assigned species and the best guess of our AI algorithm. This points out the need for a classify() method for a single sample that’s used by the test() method for a batch of samples. The test() method will update ...