fabric.autofe
AutoFEIncompatibleDataError Objects
class AutoFEIncompatibleDataError(ValueError)
A valid AutoFE candidate cannot fit this training partition.
get_transformer
def get_transformer(stage: str, method: str) -> TransformerMixin
Get the transformer object based on the specified stage and method.
Arguments:
stage- The stage of the transformation.method- The method of the transformation.
Returns:
transformer- The transformer object, should be a sklearn.base.TransformerMixin object.
Raises:
ValueError- If the specified stage or method is not available.
parse_autofe_config
def parse_autofe_config(
raw_config: str,
data: Any,
task: Task,
learner_class: BaseEstimator,
estimator_name: Optional[str] = None) -> Dict[str, Dict[str, Any]]
Handle the autofe config.
Arguments:
raw_config- One of "off", "auto", or "force". Custom dictionaries are not supported.data- Training data. Could be any type that flaml supports.task- The flaml Task object, to determine what methods are available.learner_class- The flaml Estimator class, to determine what methods are available.estimator_name- The registered learner name, including custom learners. If omitted, infer an exact built-in match; unmatched learners use the generic feature space.
Raises:
ValueError- Unsupported config.
Returns:
search_space- a FLAML search space.
Featurization Objects
class Featurization(TransformerMixin, SKLearnBaseEstimator)
A class to implement the featurization pipeline.
__init__
def __init__(params: Optional[Dict] = None,
task: Optional[Task] = None,
config: Optional[List[Dict]] = None)
Init the Featurization class.
Arguments:
params- Init based on a hyperparameter config.task- The flaml Task object, to determine implementation detail.config- Init based on a config.
Raises:
ValueError- If neither params nor config is provided.
get_params
def get_params(deep=True)
Return initialization arguments rather than learned export configuration.
config
@property
def config() -> List[Dict]
Get the config of the featurization pipeline. Could be use for reconstruct. Also an alias for self.detail_config
params
@property
def params() -> Dict
Get the hyperparameter config of the featurization pipeline. Could be use for reconstruct.
standalone_init
def standalone_init(config: List[Dict]) -> Dict
Init function for reconstruct.
Arguments:
config- The config to init the Featurization class.
Raises:
ValueError- Unknown stage or method.
Returns:
config- The inner config inside the Featurization class.
static_preprocess
def static_preprocess(X, y, *, fit=False)
General static preprocess function before all featurization stages.
Arguments:
X- Training data.y- Training label.fit- Whether to learn a stable input-column mapping.
Returns:
X- Processed training data.y- Processed training label.categorical_features- a list of names of categorical features in the X.numerical_features- a list of names of numerical features in the X.
build_transformer
def build_transformer(
stage: str,
features: List[str]) -> Tuple[TransformerMixin, List[str], Dict]
Build a transformer object based on the specified stage and features.
Arguments:
stage- The stage of the transformation.features- The list of features to be transformed.
Returns:
encoder- The transformer object, should be a sklearn.base.TransformerMixin object.features- The list of features to be transformed.detail_config- The config of the transformer object.
fit
def fit(X, y=None)
Fit the featurization pipeline.
_repr_mimebundle_
def _repr_mimebundle_(**kwargs)
Used in Jupyter notebook to display the featurization pipeline.
show_transformations
def show_transformations()
Print the featurization pipeline.
__sklearn_is_fitted__
def __sklearn_is_fitted__()
sklearn 1.8 hook used by check_is_fitted (e.g. when this estimator
is the last step of a Pipeline). Prefer the explicit flag set by
fit() so that no-op fits (no transformers configured) still register
as fitted. Falls back to pipeline is not None for objects produced
by older code paths.
CardinalitySelector Objects
class CardinalitySelector(SelectorMixin, SKLearnBaseEstimator)
Class to drop columns with high cardinality.