Skip to content

ATOMLoader


function atom.api.ATOMLoader(filename, data=None, transform_data=True, verbose=None) [source]

Load a class instance from a pickle file. If the file is a trainer that was saved using save_data=False, it is possible to load new data into it. For atom pickles, all data transformations in the pipeline can be applied to the loaded data.

Parameters:

filename: str
Name of the pickle file to load.

data: tuple of indexables or None, optional (default=None)
Tuple containing the features and target data. Only use this parameter if the file is a trainer that was saved using save_data=False (see the save method). Allowed formats are:
  • X or X, y
  • train, test
  • X_train, X_test, y_train, y_test
  • (X_train, y_train), (X_test, y_test)
X, train, test: dict, list, tuple, np.ndarray or pd.DataFrame

Feature set with shape=(n_samples, n_features). If no y is provided, the last column is used as target.

y: int, str or sequence
  • 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,).
transform_data: bool, optional (default=True)
If False, the data is left as provided. If True, it is transformed through all the steps in the instance's pipeline. This parameter is ignored if the loaded file is not an atom pickle.

verbose: int or None, optional (default=None)
Verbosity level of the transformations applied to the new data. If None, use the verbosity from the loaded instance. This parameter is ignored if transform_data=False.

Returns: cls: class instance
Un-pickled instance.


Example

from atom import ATOMClassifier, ATOMLoader

atom = ATOMClassifier(X, y)
atom.run("LR", metric="AP", n_calls=25, n_initial_points=10)
atom.save("atom", save_data=False)  # Save atom to a pickle file

# Load the class and add the data to the new instance
atom_2 = ATOMLoader("atom", data=(X, y), verbose=0)
Back to top