pyrregular.models.nodes

Nodes. This module contains various pipeline transformer classes for data preprocessing and transformation.

Classes

ApplyFunc(func[, fn_kwargs])

A transformer that applies a specified function to the input data.

DropNATransformer()

A transformer that applies a function to drop or handle NA values in a DataFrame.

PassthroughTransformer()

A transformer that returns the input data unchanged.

class pyrregular.models.nodes.ApplyFunc(func, fn_kwargs=None)[source]

Bases: BaseEstimator, TransformerMixin

A transformer that applies a specified function to the input data.

Parameters:
  • func (callable) – The function to apply to the input data.

  • fn_kwargs (dict, optional) – Additional keyword arguments to pass to the function.

fit(X, y=None)[source]

Fit the transformer. This transformer does not learn anything.

Parameters:
  • X – Input data.

  • y – Target values (default is None).

Returns:

Returns the instance itself.

Return type:

self

transform(X)[source]

Apply the specified function to the input data.

Parameters:

X – Input data.

Returns:

The result of applying func to X with the specified keyword arguments.

class pyrregular.models.nodes.DropNATransformer[source]

Bases: BaseEstimator, TransformerMixin

A transformer that applies a function to drop or handle NA values in a DataFrame.

This transformer applies the _dropna function element-wise to the input DataFrame.

fit(X, y=None)[source]

Fit the transformer. This transformer does not learn anything.

Parameters:
  • X – Input data.

  • y – Target values (default is None).

Returns:

Returns the instance itself.

Return type:

self

transform(X)[source]

Apply the _dropna function element-wise to the DataFrame.

Parameters:

X – Input pandas DataFrame.

Returns:

Transformed DataFrame with _dropna applied to each element.

class pyrregular.models.nodes.PassthroughTransformer[source]

Bases: BaseEstimator, TransformerMixin

A transformer that returns the input data unchanged.

This transformer is useful as a placeholder or when no transformation is needed.

fit(X, y=None)[source]

Fit the transformer. This transformer does not learn anything.

Parameters:
  • X – Input data.

  • y – Target values (default is None).

Returns:

Returns the instance itself.

Return type:

self

transform(X)[source]

Return the input data unchanged.

Parameters:

X – Input data.

Returns:

The unchanged input data.