Search⌘ K
AI Features

Sample State Transitions

Learn how Sample objects in Python undergo state transitions from creation through classification and testing. Understand how methods like load, classify, and test manage these changes and affect object behavior. Discover the importance of managing object state for applications involving data classification and AI testing.

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 ...