Source code for ads.feature_engineering.feature_type.base
#!/usr/bin/env python# -*- coding: utf-8 -*--# Copyright (c) 2021, 2022 Oracle and/or its affiliates.# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/fromabcimportABC,ABCMetafromads.feature_engineering.feature_type.handler.feature_validatorimport(FeatureValidator,)fromads.feature_engineering.feature_type.handler.feature_warningimport(FeatureWarning,)fromads.common.utilsimportcamel_to_snake
[docs]classFeatureBaseType(type):"""The helper metaclass to extend fucntionality of FeatureType class."""def__new__(cls,classname,bases,dictionary):dictionary["validator"]=FeatureValidator()dictionary["warning"]=FeatureWarning()returntype.__new__(cls,classname,bases,dictionary)
[docs]classFeatureBaseTypeMeta(FeatureBaseType,ABCMeta):"""The class to provide compatibility between ABC and FeatureBaseType metaclass."""
[docs]classFeatureType(ABC,metaclass=FeatureBaseTypeMeta):""" Abstract case for feature types. Default class attribute include name and description. Name is auto generated using camel to snake conversion unless specified. """name=Name()description="Base feature type."
[docs]classTag:"""Class for free form tags. Name must be specified."""def__init__(self,name:str)->None:""" Initialize a tag instance. Parameters ---------- name: str The name of the tag. """self.name=name