Search⌘ K
AI Features

The TrainingData Class

Explore the TrainingData class structure, its interaction with Sample subclasses and Hyperparameter instances. Understand how load and test methods manage data partitioning and evaluation, preparing you to design flexible data-driven Python applications.

We'll cover the following...

The TrainingData class has listed two subclasses of Sample objects. The KnownSample and UnknownSample can be implemented as extensions to a common parent class, Sample.

Methods

The TrainingData class also has a list with Hyperparameter instances. This class can have simple, direct references to previously defined classes. This class has two methods that initiate the processing:

  • The load() method reads raw data and partitions it into training data and test data. Both of these are essentially KnownSample instances with different purposes. The training subset is for evaluating the k-NN algorithm; the testing subset is for determining how well the k hyperparameter is ...