Likelihoods for RegressionModel

class darts.utils.likelihood_models.sklearn.GaussianLikelihood(n_outputs, random_state=None)[source]

Bases: SKLearnLikelihood

Gaussian distribution [1].

Parameters
  • n_outputs (int) – The number of predicted outputs per model call. 1 if multi_models=False, otherwise output_chunk_length.

  • random_state (Optional[int, None]) – Optionally, control the randomness of the sampling.

References

1

https://en.wikipedia.org/wiki/Normal_distribution

Attributes

num_parameters

Returns the number of distribution parameters for a single target value.

parameter_names

Returns the likelihood parameter names.

type

Returns the likelihood type.

Methods

component_names(input_series)

Generates names for the parameters of the Likelihood.

predict(model, x, num_samples, ...)

Generates sampled or direct likelihood parameter predictions.

predict_likelihood_parameters(model_output)

Returns the distribution parameters as a array, extracted from the raw model outputs.

sample(model_output)

Samples a prediction from the likelihood distribution and the predicted parameters.

component_names(input_series)

Generates names for the parameters of the Likelihood.

Return type

list[str]

property num_parameters: int

Returns the number of distribution parameters for a single target value.

Return type

int

property parameter_names: list[str]

Returns the likelihood parameter names.

Return type

list[str]

predict(model, x, num_samples, predict_likelihood_parameters, **kwargs)

Generates sampled or direct likelihood parameter predictions.

Parameters
  • model – The Darts RegressionModel.

  • x (ndarray) – The input feature array passed to the underlying estimator’s predict() method.

  • num_samples (int) – Number of times a prediction is sampled from the likelihood model / distribution. If 1 and predict_likelihood_parameters=False, returns median / mean predictions.

  • predict_likelihood_parameters (bool) – If set to True, generates likelihood parameter predictions instead of sampling from the likelihood model / distribution. Only supported with num_samples = 1 and n<=output_chunk_length.

  • kwargs – Some kwargs passed to the underlying estimator’s predict() method.

Return type

ndarray

predict_likelihood_parameters(model_output)[source]

Returns the distribution parameters as a array, extracted from the raw model outputs.

Return type

ndarray

sample(model_output)[source]

Samples a prediction from the likelihood distribution and the predicted parameters.

Return type

ndarray

property type: LikelihoodType

Returns the likelihood type.

Return type

LikelihoodType

class darts.utils.likelihood_models.sklearn.PoissonLikelihood(n_outputs, random_state=None)[source]

Bases: SKLearnLikelihood

Poisson distribution [1].

Parameters
  • n_outputs (int) – The number of predicted outputs per model call. 1 if multi_models=False, otherwise output_chunk_length.

  • random_state (Optional[int, None]) – Optionally, control the randomness of the sampling.

References

1

https://en.wikipedia.org/wiki/Poisson_distribution

Attributes

num_parameters

Returns the number of distribution parameters for a single target value.

parameter_names

Returns the likelihood parameter names.

type

Returns the likelihood type.

Methods

component_names(input_series)

Generates names for the parameters of the Likelihood.

predict(model, x, num_samples, ...)

Generates sampled or direct likelihood parameter predictions.

predict_likelihood_parameters(model_output)

Returns the distribution parameters as a array, extracted from the raw model outputs.

sample(model_output)

Samples a prediction from the likelihood distribution and the predicted parameters.

component_names(input_series)

Generates names for the parameters of the Likelihood.

Return type

list[str]

property num_parameters: int

Returns the number of distribution parameters for a single target value.

Return type

int

property parameter_names: list[str]

Returns the likelihood parameter names.

Return type

list[str]

predict(model, x, num_samples, predict_likelihood_parameters, **kwargs)

Generates sampled or direct likelihood parameter predictions.

Parameters
  • model – The Darts RegressionModel.

  • x (ndarray) – The input feature array passed to the underlying estimator’s predict() method.

  • num_samples (int) – Number of times a prediction is sampled from the likelihood model / distribution. If 1 and predict_likelihood_parameters=False, returns median / mean predictions.

  • predict_likelihood_parameters (bool) – If set to True, generates likelihood parameter predictions instead of sampling from the likelihood model / distribution. Only supported with num_samples = 1 and n<=output_chunk_length.

  • kwargs – Some kwargs passed to the underlying estimator’s predict() method.

Return type

ndarray

predict_likelihood_parameters(model_output)[source]

Returns the distribution parameters as a array, extracted from the raw model outputs.

Return type

ndarray

sample(model_output)[source]

Samples a prediction from the likelihood distribution and the predicted parameters.

Return type

ndarray

property type: LikelihoodType

Returns the likelihood type.

Return type

LikelihoodType

class darts.utils.likelihood_models.sklearn.QuantileRegression(n_outputs, random_state=None, quantiles=None)[source]

Bases: SKLearnLikelihood

Quantile Regression [1].

Parameters
  • n_outputs (int) – The number of predicted outputs per model call. 1 if multi_models=False, otherwise output_chunk_length.

  • random_state (Optional[int, None]) – Optionally, control the randomness of the sampling.

  • quantiles (Optional[list[float], None]) – A list of quantiles. Default: [0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99].

References

1

https://en.wikipedia.org/wiki/Quantile_regression

Attributes

num_parameters

Returns the number of distribution parameters for a single target value.

parameter_names

Returns the likelihood parameter names.

type

Returns the likelihood type.

Methods

component_names(input_series)

Generates names for the parameters of the Likelihood.

predict(model, x, num_samples, ...)

Generates sampled or direct likelihood parameter predictions.

predict_likelihood_parameters(model_output)

Returns the distribution parameters as a array, extracted from the raw model outputs.

sample(model_output)

Samples a prediction from the likelihood distribution and the predicted parameters.

component_names(input_series)

Generates names for the parameters of the Likelihood.

Return type

list[str]

property num_parameters: int

Returns the number of distribution parameters for a single target value.

Return type

int

property parameter_names: list[str]

Returns the likelihood parameter names.

Return type

list[str]

predict(model, x, num_samples, predict_likelihood_parameters, **kwargs)

Generates sampled or direct likelihood parameter predictions.

Parameters
  • model – The Darts RegressionModel.

  • x (ndarray) – The input feature array passed to the underlying estimator’s predict() method.

  • num_samples (int) – Number of times a prediction is sampled from the likelihood model / distribution. If 1 and predict_likelihood_parameters=False, returns median / mean predictions.

  • predict_likelihood_parameters (bool) – If set to True, generates likelihood parameter predictions instead of sampling from the likelihood model / distribution. Only supported with num_samples = 1 and n<=output_chunk_length.

  • kwargs – Some kwargs passed to the underlying estimator’s predict() method.

Return type

ndarray

predict_likelihood_parameters(model_output)[source]

Returns the distribution parameters as a array, extracted from the raw model outputs.

Return type

ndarray

sample(model_output)[source]

Samples a prediction from the likelihood distribution and the predicted parameters.

Return type

ndarray

property type: LikelihoodType

Returns the likelihood type.

Return type

LikelihoodType

class darts.utils.likelihood_models.sklearn.SKLearnLikelihood(likelihood_type, parameter_names, n_outputs, random_state=None)[source]

Bases: Likelihood, ABC

Base class for sklearn wrapper (e.g. RegressionModel) likelihoods.

Parameters
  • likelihood_type (LikelihoodType) – A pre-defined LikelihoodType.

  • parameter_names (list[str]) – The likelihood (distribution) parameter names.

  • n_outputs (int) – The number of predicted outputs per model call. 1 if multi_models=False, otherwise output_chunk_length.

  • random_state (Optional[int, None]) – Optionally, control the randomness of the sampling.

Attributes

num_parameters

Returns the number of distribution parameters for a single target value.

parameter_names

Returns the likelihood parameter names.

type

Returns the likelihood type.

Methods

component_names(input_series)

Generates names for the parameters of the Likelihood.

predict(model, x, num_samples, ...)

Generates sampled or direct likelihood parameter predictions.

predict_likelihood_parameters(model_output)

Returns the distribution parameters as a array, extracted from the raw model outputs.

sample(model_output)

Samples a prediction from the likelihood distribution and the predicted parameters.

component_names(input_series)

Generates names for the parameters of the Likelihood.

Return type

list[str]

property num_parameters: int

Returns the number of distribution parameters for a single target value.

Return type

int

property parameter_names: list[str]

Returns the likelihood parameter names.

Return type

list[str]

predict(model, x, num_samples, predict_likelihood_parameters, **kwargs)[source]

Generates sampled or direct likelihood parameter predictions.

Parameters
  • model – The Darts RegressionModel.

  • x (ndarray) – The input feature array passed to the underlying estimator’s predict() method.

  • num_samples (int) – Number of times a prediction is sampled from the likelihood model / distribution. If 1 and predict_likelihood_parameters=False, returns median / mean predictions.

  • predict_likelihood_parameters (bool) – If set to True, generates likelihood parameter predictions instead of sampling from the likelihood model / distribution. Only supported with num_samples = 1 and n<=output_chunk_length.

  • kwargs – Some kwargs passed to the underlying estimator’s predict() method.

Return type

ndarray

abstract predict_likelihood_parameters(model_output)[source]

Returns the distribution parameters as a array, extracted from the raw model outputs.

Return type

ndarray

abstract sample(model_output)[source]

Samples a prediction from the likelihood distribution and the predicted parameters.

Return type

ndarray

property type: LikelihoodType

Returns the likelihood type.

Return type

LikelihoodType