The Sample Class Hierarchy
Explore how to design and implement a sample class hierarchy in Python using object-oriented programming. Understand subclass roles, classification behaviors, and the use of @property decorators to manage computed attributes and enforce class design principles.
We'll cover the following...
Overview
We can rethink our earlier designs from several points of view. One alternative is to separate the essential Sample class from the additional features. It seems like we can identify four additional behaviors for each Sample instance, shown in the following table.
Known | Unknown | |
Unclassified | Training data | Sample waiting to be classified |
Classified | Testing data | Classified sample |
We’ve omitted a detail from the Classified row. Each time we do a classification, a specific hyperparameter is associated with the resulting classified sample. It would be more accurate to say it’s a sample ...