Search⌘ K

Class Responsibilities

Explore how different classes in Python can collaborate to achieve tasks by assigning clear responsibilities. Understand emergent behavior as classes like TrainingData and Hyperparameter share duties to perform classification tests effectively. Learn techniques such as forward references and state changes to manage complex object interactions.

We'll cover the following...

Overview

Which class is responsible for actually performing a test? Does the TrainingData class invoke the classifier on each KnownSample in a testing set? Or, perhaps, does it provide the testing set to the Hyperparameter class, delegating the testing to the Hyperparameter class? Since the Hyperparameter class has responsibility for the k value, and the algorithm for locating the k-nearest neighbors, it seems sensible for the Hyperparameter class to ...