Skip to content

transform


method transform(X, y=None, verbose=None) [source]

Transform unseen data through the current branch. Transformers that are only applied on the training set are skipped. This method can only be called from atom, not from the models.

Parameters:

X: dataframe-like
Features to transform, with shape=(n_samples, n_features).

y: int, str, sequence or None, optional (default=None)
  • If None: y is ignored in the transformers.
  • If int: Position of the target column in X.
  • If str: Name of the target column in X.
  • Else: Target column with shape=(n_samples,).

verbose: int or None, optional (default=None)
Verbosity level of the output. If None, it uses the transformer's own verbosity.

Returns:

pd.DataFrame
Transformed feature set.

pd.Series
Transformed target column. Only returned if provided.


Example

from atom import ATOMClassifier

atom = ATOMClassifier(X, y)
atom.clean()
atom.impute(strat_num="knn", strat_cat="drop")
atom.prune(strategy="z-score", method="min_max", max_sigma=2)

# Transform new data through all transformers in the branch
X_transformed = atom.transform(X_new)
Back to top