baseobject.all_objects#

baseobject.all_objects(object_types=None, filter_tags=None, exclude_estimators=None, return_names=True, as_dataframe=False, return_tags=None, suppress_import_stdout=True, package_name='baseobject', path: Optional[str] = None, ignore_modules=None, class_lookup=None)[source]#

Get a list of all estimators in the package with name package_name.

This function crawls the package/module and gets all classes that are descendents of BaseObject. These classes can be retrieved based on their inherittence from intermediate classes, and their tags.

Parameters:
object_types: class or list of classes, default=None
  • If class_lookup is provided, can also be str or list of str which kind of objects should be returned.

  • If None, no filter is applied and all estimators are returned.

  • If class or list of class, estimators are filtered to inherit from one of these.

  • If str or list of str, classes ca be aliased by strings, via class_lookup.

return_names: bool, default=True
  • If True, estimator class name is included in the all_estimators() return in the order: name, estimator class, optional tags, either as a tuple or as pandas.DataFrame columns.

if False, estimator class name is removed from the all_estimators()

return.

filter_tags: dict of (str or list of str), optional (default=None)

For a list of valid tag strings, use the registry.all_tags utility. subsets the returned estimators as follows:

each key/value pair is statement in “and”/conjunction

key is tag name to sub-set on value str or list of string are tag values condition is “key must be equal to value, or in set(value)”.

exclude_estimators: str or list of str, odefault=None

Names of estimators to exclude.

as_dataframe: bool, default=False
  • If False, all_estimators will return a list (either a list of

    estimators or a list of tuples, see Returns).

  • If True, all_estimators will return a pandas.DataFrame with named

    columns for all of the attributes being returned. this requires soft dependency pandas to be installed.

return_tags: str or list of str, default=None

Names of tags to fetch and return each estimator’s value of. For a list of valid tag strings, use the registry.all_tags utility. If str or list of str, the tag values named in return_tags will be fetched for each object and will be appended as either columns or tuple entries.

package_namestr, default=”baseobject”.

should be set to default to package or module name if used for search. objects will be searched inside the package/module called package_name, this can include sub-module dots, e.g., “package.module1.module2”.

pathstr, default=None

If provided, this should be the path that should be used as root to find package_name and start the search for any submodules/packages.

ignore_modulesstr or lits of str, optional. Default=empty list

list of module names to ignore in search.

class_lookupdict[str, class], default=None

Dictionary of aliases for classes used in object_types.

Returns:
all_estimators will return one of the following:
  1. list of estimators, if return_names=False, and return_tags is None

  2. list of tuples (optional estimator name, class, ~optional estimator

    tags), if return_names=True or return_tags is not None.

  3. pandas.DataFrame if as_dataframe = True

  • If list of estimators, entries are estimators matching the query, in alphabetical order of estimator name

  • If list of tuples list of (optional estimator name, estimator, optional estimator tags) matching the query, in alphabetical order of estimator name, where:

    • name is the estimator name as string, and is an optional return

    • estimator is the actual estimator

    • tags are the estimator’s values for each tag in return_tags and is an optional return.

  • If dataframe, all_estimators will return a pandas.DataFrame. Column names represent the attributes contained in each column. “estimators” will be the name of the column of estimators, “names” will be the name of the column of estimator class names and the string(s) passed in return_tags will serve as column names for all columns of tags that were optionally requested.

Other Parameters:
suppress_import_stdoutbool, default=True

whether to suppress stdout printout upon import.

References

Modified version of scikit-learn’s and sktime’s all_estimators().