Skip to content

Options

This section documents the options components of the dummy module.

options

Defines sklearn.dummy options interoperability.

This module provides options for scikit-learn's dummy models. It includes classes and global variables to help configure and use these models with the Nextmv platform.

CLASS DESCRIPTION
DummyRegressorOptions

Options for the sklearn.dummy.DummyRegressor.

Global Variables

DUMMY_REGRESSOR_PARAMETERS : list List of parameters for the DummyRegressor class.

DUMMY_REGRESSOR_PARAMETERS module-attribute

DUMMY_REGRESSOR_PARAMETERS = [
    Option(
        name="strategy",
        option_type=str,
        choices=["mean", "median", "quantile", "constant"],
        description="Strategy to use to generate predictions.",
    ),
    Option(
        name="constant",
        option_type=float,
        description='The explicit constant as predicted by the "constant" strategy.',
    ),
    Option(
        name="quantile",
        option_type=float,
        description='The quantile to predict using the "quantile" strategy.',
    ),
]

List of parameters for configuring DummyRegressor.

You can import DUMMY_REGRESSOR_PARAMETERS directly from dummy:

from nextmv_sklearn.dummy import DUMMY_REGRESSOR_PARAMETERS

This list contains the options that can be passed to the DummyRegressor model in scikit-learn. The parameters include: - strategy: Strategy to use to generate predictions. - constant: The explicit constant as predicted by the "constant" strategy. - quantile: The quantile to predict using the "quantile" strategy.

See Also

DummyRegressorOptions : Class that uses these parameters. sklearn.dummy.DummyRegressor : The scikit-learn class these options configure.

DummyRegressorOptions

DummyRegressorOptions()

Options for the sklearn.dummy.DummyRegressor.

You can import the DummyRegressorOptions class directly from dummy:

from nextmv_sklearn.dummy import DummyRegressorOptions

This class provides a wrapper for the options used by scikit-learn's DummyRegressor. It allows for easier configuration and integration with the Nextmv platform.

ATTRIBUTE DESCRIPTION
params

List of Nextmv Option objects for DummyRegressor parameters.

TYPE: list

Examples:

>>> from nextmv_sklearn.dummy import DummyRegressorOptions
>>> options = DummyRegressorOptions()
>>> nextmv_options = options.to_nextmv()

Initialize the DummyRegressorOptions.

Creates a new instance with default parameters for the sklearn.dummy.DummyRegressor.

Source code in nextmv-scikit-learn/nextmv_sklearn/dummy/options.py
def __init__(self):
    """Initialize the DummyRegressorOptions.

    Creates a new instance with default parameters for the
    sklearn.dummy.DummyRegressor.
    """
    self.params = DUMMY_REGRESSOR_PARAMETERS

params instance-attribute

to_nextmv

to_nextmv() -> Options

Converts the options to a Nextmv options object.

RETURNS DESCRIPTION
Options

A Nextmv options object containing the parameters for the sklearn.dummy.DummyRegressor.

Examples:

>>> options = DummyRegressorOptions()
>>> nextmv_options = options.to_nextmv()
>>> # Use nextmv_options in your Nextmv application
Source code in nextmv-scikit-learn/nextmv_sklearn/dummy/options.py
def to_nextmv(self) -> nextmv.Options:
    """Converts the options to a Nextmv options object.

    Returns
    -------
    nextmv.Options
        A Nextmv options object containing the parameters for the
        sklearn.dummy.DummyRegressor.

    Examples
    --------
    >>> options = DummyRegressorOptions()
    >>> nextmv_options = options.to_nextmv()
    >>> # Use nextmv_options in your Nextmv application
    """

    return nextmv.Options(*self.params)