cascade.utils.sklearn#
- class cascade.utils.sklearn.SkMetric(name: str, *args: Any, value: SupportsFloat | None = None, dataset: str | None = None, split: str | None = None, direction: Literal['up', 'down'] | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, SupportsFloat] | None = None, **kwargs: Any)[source]#
- __init__(name: str, *args: Any, value: SupportsFloat | None = None, dataset: str | None = None, split: str | None = None, direction: Literal['up', 'down'] | None = None, interval: Tuple[SupportsFloat, SupportsFloat] | None = None, extra: Dict[str, SupportsFloat] | None = None, **kwargs: Any) None [source]#
Creates Metric
- Parameters:
name (str) – Name of the metric
value (Optional[MetricType]) – Scalar value of the metric, by default None
dataset (Optional[str]) – Dataset on which metric was computed, by default None
split (Optional[str]) – The split of the dataset for example train or test, by default None
direction (Literal["up", "down", None]) – Is metric better when it is greater or less, by default None
interval (Optional[Tuple[MetricType, MetricType]]) – Upper and lower boundaries of value, by default None
extra (Optional[Dict[str, Any]]) – Extra values that needs to be stored with metric, by default None
- class cascade.utils.sklearn.SkModel(*args: Any, blocks: List[Any] | None = None, **kwargs: Any)[source]#
Wrapper for sklearn models. Accepts the name and block to form pipeline. Can fit, evaluate, predict save and load out of the box.
- __init__(*args: Any, blocks: List[Any] | None = None, **kwargs: Any) None [source]#
- Parameters:
blocks (list, optional) – List of sklearn transformers to make a pipeline from
- get_meta() List[Dict[Any, Any]] [source]#
- Returns:
meta – A list where first element is this object’s metadata. All other elements represent the other stages of pipeline if present.
Meta can be anything that is worth to document about the object and its properties.
Meta is a list (see Meta type alias) to allow the formation of pipelines.
- Return type:
Meta
- load_artifact(path: str, *args: Any, **kwargs: Any) None [source]#
Loads sklearn pipeline
Args and kwargs are passed into pickle.load
- Parameters:
path (str) – the folder from which to load pipeline.pkl
- Raises:
ValueError – if the path is not a valid directory