Docs /Templates/ sinapsis-sktime

DummyClassifierSKTimeWrapper

sinapsis-sktimeSKTimedynamicinferencemodelsprediction

Python template · sinapsis_sktime.templates.sktime_classifiers

Overview

Template for SkTime classification model training and inference for the dummy module.

DummyClassifier — inherited documentation

DummyClassifier makes predictions that ignore the input features.

This classifier serves as a simple baseline to compare against other more complex classifiers. The specific behavior of the baseline is selected with the ``strategy`` parameter.

All strategies make predictions that ignore the input feature values passed as the ``X`` argument to ``fit`` and ``predict``. The predictions, however, typically depend on values observed in the ``y`` parameter passed to ``fit``.

Function-identical to ``sklearn.dummy.DummyClassifier``, which is called inside.

Parameters ---------- strategy : {"most_frequent", "prior", "stratified", "uniform", "constant"}, default="prior" Strategy to use to generate predictions.

* "most_frequent": the ``predict`` method always returns the most frequent class label in the observed ``y`` argument passed to ``fit``. The ``predict_proba`` method returns the matching one-hot encoded vector. * "prior": the ``predict`` method always returns the most frequent class label in the observed ``y`` argument passed to ``fit`` (like "most_frequent"). ``predict_proba`` always returns the empirical class distribution of ``y`` also known as the empirical class prior distribution. * "stratified": the ``predict_proba`` method randomly samples one-hot vectors from a multinomial distribution parametrized by the empirical class prior probabilities. The ``predict`` method returns the class label which got probability one in the one-hot vector of ``predict_proba``. Each sampled row of both methods is therefore independent and identically distributed. * "uniform": generates predictions uniformly at random from the list of unique classes observed in ``y``, i.e. each class has equal probability. * "constant": always predicts a constant label that is provided by the user. This is useful for metrics that evaluate a non-majority class.

random_state : int, RandomState instance or None, default=None Controls the randomness to generate the predictions when ``strategy='stratified'`` or ``strategy='uniform'``. Pass an int for reproducible output across multiple function calls.

constant : int or str or array-like of shape (n_outputs,), default=None The explicit constant as predicted by the "constant" strategy. This parameter is useful only for the "constant" strategy.

Examples -------- >>> from sktime.classification.dummy import DummyClassifier >>> from sktime.datasets import load_unit_test >>> X_train, y_train = load_unit_test(split="train") >>> X_test, y_test = load_unit_test(split="test") >>> classifier = DummyClassifier(strategy="prior") >>> classifier.fit(X_train, y_train) DummyClassifier() >>> y_pred = classifier.predict(X_test) >>> y_pred_proba = classifier.predict_proba(X_test)

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-sktime==1.0.0
uv pip install sinapsis-sktime==1.0.0
uv add sinapsis-sktime==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
root_dir
str
Optional
Default: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
model_save_pathRequired

Path where the trained model will be saved. dummyclassifier_init strategy typing.Union[str, typing.Any, NoneType]: default: prior random_state typing.Optional[int]: default: None constant <class 'NoneType'>: default: None

str
Required
Default: null
dummyclassifier_initRequired
DummyClassifierAttributes
Required
Default: null
constant
NoneType
Optional
Default: null
strategy
typing.Union[str, typing.Any, NoneType]
Optional
Default: "prior"
random_state
typing.Optional[int]
Optional
Default: null

Configuration example

Generated from documented defaults. Replace any placeholders and complete required nested settings before running.

yaml
templates:
  - template_name: "DummyClassifierSKTimeWrapper"
    class_name: "DummyClassifierSKTimeWrapper"
    attributes:
      root_dir: "/sinapsis-hub/private/platform/sinapsis-hub/playground/publish"
      model_save_path: "<required>"
      dummyclassifier_init:
        constant: null
        strategy: "prior"
        random_state: null

Inheritance

Immediate parent: sinapsis_sktime.templates.sktime_classifiers.SKTimeDummyClassifiers

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere