load_policy#

scikitplot.feature_selection.load_policy(source, format=None)[source]#

Load a FeaturePolicy from a file, a mapping or a policy.

Parameters:
sourcestr, os.PathLike, mapping or FeaturePolicy

A path to a .toml, .yaml/.yml or .json file, a mapping in config form, or a policy (returned unchanged).

formatstr or None, default=None

Explicit file format, else derived from the suffix.

Returns:
FeaturePolicy

The policy.

Raises:
PolicyError, IncompatibleSchemaError

If the document is off contract.

Parameters:
  • source (Any)

  • format (str | None)

Return type:

FeaturePolicy

Examples

>>> from scikitplot.feature_selection import load_policy
>>> load_policy({"roles": {"target": ["y"]}}).roles_map["target"].columns
('y',)