Feature Feature¶
Feature subclasses are responsible for generating an integer value given an open feature project’s feature URL.
- class dffml.feature.feature.Feature(name: str, dtype: ~typing.Type = <class 'int'>, length: int = 1)[source]¶
Class for all features.
A feature is provided with the feature URL of the package (in self._key) and is expected to fetch any data it needs to calculate itself when fetch is called. All data fetched should be stored in tempdir() if it must reside on disk.
Once the appropriate data is fetched the parse method is responsible for storing the parts of that data which will be used to calculate in the subclass
Examples
Define a feature:
>>> from dffml import * >>> >>> feature = Feature("example", float, 10) >>> feature.dtype <class 'float'> >>> feature.name 'example' >>> feature.length 10