> ## Documentation Index
> Fetch the complete documentation index at: https://nixtla-old-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> NeuralForecast contains user-friendly implementations of neural forecasting models that allow for easy transition of computing capabilities (GPU/CPU), computation parallelization, and hyperparameter tuning.

# AutoModels

All the NeuralForecast models are “global” because we train them with
all the series from the input pd.DataFrame data `Y_df`, yet the
optimization objective is, momentarily, “univariate” as it does not
consider the interaction between the output predictions across time
series. Like the StatsForecast library, `core.NeuralForecast` allows you
to explore collections of models efficiently and contains functions for
convenient wrangling of input and output pd.DataFrames predictions.

First we load the AirPassengers dataset such that you can run all the
examples.

```python theme={null}
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

from neuralforecast.tsdataset import TimeSeriesDataset
from neuralforecast.utils import AirPassengersDF as Y_df
```

```python theme={null}
# Split train/test and declare time series dataset
Y_train_df = Y_df[Y_df.ds<='1959-12-31'] # 132 train
Y_test_df = Y_df[Y_df.ds>'1959-12-31']   # 12 test
dataset, *_ = TimeSeriesDataset.from_df(Y_train_df)
```

# 1. Automatic Forecasting

## A. RNN-Based

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L61" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoRNN

> ```text theme={null}
>  AutoRNN (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f1320942da0>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320942da0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoRNN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=-1, encoder_hidden_size=8)
model = AutoRNN(h=12, config=config, num_samples=1, cpus=1)

model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoRNN(h=12, config=None, num_samples=1, cpus=1, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L136" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoLSTM

> ```text theme={null}
>  AutoLSTM (h, loss=MAE(), valid_loss=None, config=None,
>            search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>            object at 0x7f1320937310>, num_samples=10,
>            refit_with_val=False, cpus=4, gpus=0, verbose=False,
>            alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320937310> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoLSTM.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=-1, encoder_hidden_size=8)
model = AutoLSTM(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoLSTM(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L207" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoGRU

> ```text theme={null}
>  AutoGRU (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f1320e7c2b0>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320e7c2b0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoGRU.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=-1, encoder_hidden_size=8)
model = AutoGRU(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoGRU(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L278" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTCN

> ```text theme={null}
>  AutoTCN (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f13208f1ae0>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f13208f1ae0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTCN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=-1, encoder_hidden_size=8)
model = AutoTCN(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTCN(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L348" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoDeepAR

> ```text theme={null}
>  AutoDeepAR (h, loss=DistributionLoss(), valid_loss=MQLoss(), config=None,
>              search_alg=<ray.tune.search.basic_variant.BasicVariantGenerat
>              or object at 0x7f1320ecec80>, num_samples=10,
>              refit_with_val=False, cpus=4, gpus=0, verbose=False,
>              alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | DistributionLoss      | DistributionLoss()                                                               | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | MQLoss                | MQLoss()                                                                         | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ecec80> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoDeepAR.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, lstm_hidden_size=8)
model = AutoDeepAR(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoDeepAR(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L419" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoDilatedRNN

> ```text theme={null}
>  AutoDilatedRNN (h, loss=MAE(), valid_loss=None, config=None,
>                  search_alg=<ray.tune.search.basic_variant.BasicVariantGen
>                  erator object at 0x7f132090feb0>, num_samples=10,
>                  refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                  alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f132090feb0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoDilatedRNN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=-1, encoder_hidden_size=8)
model = AutoDilatedRNN(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoDilatedRNN(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L491" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoBiTCN

> ```text theme={null}
>  AutoBiTCN (h, loss=MAE(), valid_loss=None, config=None,
>             search_alg=<ray.tune.search.basic_variant.BasicVariantGenerato
>             r object at 0x7f1320a9c9d0>, num_samples=10,
>             refit_with_val=False, cpus=4, gpus=0, verbose=False,
>             alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a9c9d0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoBiTCN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoBiTCN(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoBiTCN(h=12, config=None, backend='optuna')
```

## B. MLP-Based

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L559" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoMLP

> ```text theme={null}
>  AutoMLP (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f1320ad7a60>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ad7a60> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoMLP.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoMLP(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoMLP(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L627" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoNBEATS

> ```text theme={null}
>  AutoNBEATS (h, loss=MAE(), valid_loss=None, config=None,
>              search_alg=<ray.tune.search.basic_variant.BasicVariantGenerat
>              or object at 0x7f1320ad5390>, num_samples=10,
>              refit_with_val=False, cpus=4, gpus=0, verbose=False,
>              alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ad5390> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoNBEATS.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12,
              mlp_units=3*[[8, 8]])
model = AutoNBEATS(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoNBEATS(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L693" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoNBEATSx

> ```text theme={null}
>  AutoNBEATSx (h, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f1320ac6cb0>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ac6cb0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoNBEATSx.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12,
              mlp_units=3*[[8, 8]])
model = AutoNBEATSx(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoNBEATSx(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L759" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoNHITS

> ```text theme={null}
>  AutoNHITS (h, loss=MAE(), valid_loss=None, config=None,
>             search_alg=<ray.tune.search.basic_variant.BasicVariantGenerato
>             r object at 0x7f1320ab4100>, num_samples=10,
>             refit_with_val=False, cpus=4, gpus=0, verbose=False,
>             alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ab4100> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoNHITS.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, 
              mlp_units=3 * [[8, 8]])
model = AutoNHITS(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoNHITS(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L838" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoDLinear

> ```text theme={null}
>  AutoDLinear (h, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f1320a9cd90>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a9cd90> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoDLinear.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoDLinear(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoDLinear(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L905" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoNLinear

> ```text theme={null}
>  AutoNLinear (h, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f1320ab6b00>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ab6b00> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoNLinear.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoNLinear(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoNLinear(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L971" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTiDE

> ```text theme={null}
>  AutoTiDE (h, loss=MAE(), valid_loss=None, config=None,
>            search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>            object at 0x7f1320ad4a60>, num_samples=10,
>            refit_with_val=False, cpus=4, gpus=0, verbose=False,
>            alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ad4a60> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTiDE.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoTiDE(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTiDE(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1045" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoDeepNPTS

> ```text theme={null}
>  AutoDeepNPTS (h, loss=MAE(), valid_loss=None, config=None,
>                search_alg=<ray.tune.search.basic_variant.BasicVariantGener
>                ator object at 0x7f1320dd1000>, num_samples=10,
>                refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320dd1000> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoDeepNPTS.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoDeepNPTS(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoDeepNPTS(h=12, config=None, backend='optuna')
```

## C. KAN-Based

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1114" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoKAN

> ```text theme={null}
>  AutoKAN (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f1320a491e0>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a491e0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoKAN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoKAN(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoKAN(h=12, config=None, backend='optuna')
```

## D. Transformer-Based

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1183" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTFT

> ```text theme={null}
>  AutoTFT (h, loss=MAE(), valid_loss=None, config=None,
>           search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>           object at 0x7f1320de5780>, num_samples=10, refit_with_val=False,
>           cpus=4, gpus=0, verbose=False, alias=None, backend='ray',
>           callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320de5780> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTFT.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoTFT(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTFT(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1251" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoVanillaTransformer

> ```text theme={null}
>  AutoVanillaTransformer (h, loss=MAE(), valid_loss=None, config=None,
>                          search_alg=<ray.tune.search.basic_variant.BasicVa
>                          riantGenerator object at 0x7f1320a54a90>,
>                          num_samples=10, refit_with_val=False, cpus=4,
>                          gpus=0, verbose=False, alias=None, backend='ray',
>                          callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a54a90> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoVanillaTransformer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoVanillaTransformer(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoVanillaTransformer(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1319" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoInformer

> ```text theme={null}
>  AutoInformer (h, loss=MAE(), valid_loss=None, config=None,
>                search_alg=<ray.tune.search.basic_variant.BasicVariantGener
>                ator object at 0x7f1320a31660>, num_samples=10,
>                refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a31660> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoInformer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoInformer(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoInformer(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1387" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoAutoformer

> ```text theme={null}
>  AutoAutoformer (h, loss=MAE(), valid_loss=None, config=None,
>                  search_alg=<ray.tune.search.basic_variant.BasicVariantGen
>                  erator object at 0x7f1320a489d0>, num_samples=10,
>                  refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                  alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a489d0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoAutoformer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=8)
model = AutoAutoformer(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoAutoformer(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1455" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoFEDformer

> ```text theme={null}
>  AutoFEDformer (h, loss=MAE(), valid_loss=None, config=None,
>                 search_alg=<ray.tune.search.basic_variant.BasicVariantGene
>                 rator object at 0x7f1320c40220>, num_samples=10,
>                 refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                 alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320c40220> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoFEDFormer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=64)
model = AutoFEDformer(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoFEDformer(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1522" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoPatchTST

> ```text theme={null}
>  AutoPatchTST (h, loss=MAE(), valid_loss=None, config=None,
>                search_alg=<ray.tune.search.basic_variant.BasicVariantGener
>                ator object at 0x7f13209ed420>, num_samples=10,
>                refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f13209ed420> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoPatchTST.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=16)
model = AutoPatchTST(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoPatchTST(h=12, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1592" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoiTransformer

> ```text theme={null}
>  AutoiTransformer (h, n_series, loss=MAE(), valid_loss=None, config=None,
>                    search_alg=<ray.tune.search.basic_variant.BasicVariantG
>                    enerator object at 0x7f1320da8490>, num_samples=10,
>                    refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                    alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320da8490> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoiTransformer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=16)
model = AutoiTransformer(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoiTransformer(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1677" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTimeXer

> ```text theme={null}
>  AutoTimeXer (h, n_series, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f13209ff2e0>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f13209ff2e0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTimeXer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, patch_len=12)
model = AutoTimeXer(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTimeXer(h=12, n_series=1, config=None, backend='optuna')
```

## E. CNN Based

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1762" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTimesNet

> ```text theme={null}
>  AutoTimesNet (h, loss=MAE(), valid_loss=None, config=None,
>                search_alg=<ray.tune.search.basic_variant.BasicVariantGener
>                ator object at 0x7f1320a13760>, num_samples=10,
>                refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a13760> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTimesNet.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=32)
model = AutoTimesNet(h=12, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTimesNet(h=12, config=None, backend='optuna')
```

## F. Multivariate

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1830" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoStemGNN

> ```text theme={null}
>  AutoStemGNN (h, n_series, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f1320bce500>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320bce500> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoStemGNN.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoStemGNN(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoStemGNN(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1915" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoHINT

> ```text theme={null}
>  AutoHINT (cls_model, h, loss, valid_loss, S, config,
>            search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>            object at 0x7f13209ff790>, num_samples=10, cpus=4, gpus=0,
>            refit_with_val=False, verbose=False, alias=None, backend='ray',
>            callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**                       | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | ------------------------------ | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| cls\_model       | PyTorch/PyTorchLightning model |                                                                                  | See `neuralforecast.models` [collection here](https://nixtla.github.io/neuralforecast/models.html).                                                                                                                                                                                                                                                                                                                    |
| h                | int                            |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| loss             | PyTorch module                 |                                                                                  | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | PyTorch module                 |                                                                                  | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| S                |                                |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| config           | dict or callable               |                                                                                  | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator          | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f13209ff790> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                            | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| cpus             | int                            | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                            | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| refit\_with\_val | bool                           | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| verbose          | bool                           | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType                       | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                            | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType                       | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Perform a simple hyperparameter optimization with 
# NHITS and then reconcile with HINT
from neuralforecast.losses.pytorch import GMM, sCRPS

base_config = dict(max_steps=1, val_check_steps=1, input_size=8)
base_model = AutoNHITS(h=4, loss=GMM(n_components=2, quantiles=quantiles), 
                       config=base_config, num_samples=1, cpus=1)
model = HINT(h=4, S=S_df.values,
             model=base_model,  reconciliation='MinTraceOLS')

model.fit(dataset=dataset)
y_hat = model.predict(dataset=hint_dataset)

# Perform a conjunct hyperparameter optimization with 
# NHITS + HINT reconciliation configurations
nhits_config = {
       "learning_rate": tune.choice([1e-3]),                                     # Initial Learning rate
       "max_steps": tune.choice([1]),                                            # Number of SGD steps
       "val_check_steps": tune.choice([1]),                                      # Number of steps between validation
       "input_size": tune.choice([5 * 12]),                                      # input_size = multiplier * horizon
       "batch_size": tune.choice([7]),                                           # Number of series in windows
       "windows_batch_size": tune.choice([256]),                                 # Number of windows in batch
       "n_pool_kernel_size": tune.choice([[2, 2, 2], [16, 8, 1]]),               # MaxPool's Kernelsize
       "n_freq_downsample": tune.choice([[168, 24, 1], [24, 12, 1], [1, 1, 1]]), # Interpolation expressivity ratios
       "activation": tune.choice(['ReLU']),                                      # Type of non-linear activation
       "n_blocks":  tune.choice([[1, 1, 1]]),                                    # Blocks per each 3 stacks
       "mlp_units":  tune.choice([[[512, 512], [512, 512], [512, 512]]]),        # 2 512-Layers per block for each stack
       "interpolation_mode": tune.choice(['linear']),                            # Type of multi-step interpolation
       "random_seed": tune.randint(1, 10),
       "reconciliation": tune.choice(['BottomUp', 'MinTraceOLS', 'MinTraceWLS'])
    }
model = AutoHINT(h=4, S=S_df.values,
                 cls_model=NHITS,
                 config=nhits_config,
                 loss=GMM(n_components=2, level=[80, 90]),
                 valid_loss=sCRPS(level=[80, 90]),
                 num_samples=1, cpus=1)
model.fit(dataset=dataset)
y_hat = model.predict(dataset=hint_dataset)
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L1987" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTSMixer

> ```text theme={null}
>  AutoTSMixer (h, n_series, loss=MAE(), valid_loss=None, config=None,
>               search_alg=<ray.tune.search.basic_variant.BasicVariantGenera
>               tor object at 0x7f1320a1f490>, num_samples=10,
>               refit_with_val=False, cpus=4, gpus=0, verbose=False,
>               alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320a1f490> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTSMixer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoTSMixer(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTSMixer(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L2073" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTSMixerx

> ```text theme={null}
>  AutoTSMixerx (h, n_series, loss=MAE(), valid_loss=None, config=None,
>                search_alg=<ray.tune.search.basic_variant.BasicVariantGener
>                ator object at 0x7f1320bcdea0>, num_samples=10,
>                refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320bcdea0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTSMixerx.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoTSMixerx(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTSMixerx(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L2159" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoMLPMultivariate

> ```text theme={null}
>  AutoMLPMultivariate (h, n_series, loss=MAE(), valid_loss=None,
>                       config=None, search_alg=<ray.tune.search.basic_varia
>                       nt.BasicVariantGenerator object at 0x7f1320bbbc70>,
>                       num_samples=10, refit_with_val=False, cpus=4,
>                       gpus=0, verbose=False, alias=None, backend='ray',
>                       callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320bbbc70> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoMLPMultivariate.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12)
model = AutoMLPMultivariate(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoMLPMultivariate(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L2244" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoSOFTS

> ```text theme={null}
>  AutoSOFTS (h, n_series, loss=MAE(), valid_loss=None, config=None,
>             search_alg=<ray.tune.search.basic_variant.BasicVariantGenerato
>             r object at 0x7f1320bae470>, num_samples=10,
>             refit_with_val=False, cpus=4, gpus=0, verbose=False,
>             alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320bae470> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoSOFTS.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, hidden_size=16)
model = AutoSOFTS(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoSOFTS(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L2329" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoTimeMixer

> ```text theme={null}
>  AutoTimeMixer (h, n_series, loss=MAE(), valid_loss=None, config=None,
>                 search_alg=<ray.tune.search.basic_variant.BasicVariantGene
>                 rator object at 0x7f1320ba16c0>, num_samples=10,
>                 refit_with_val=False, cpus=4, gpus=0, verbose=False,
>                 alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ba16c0> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoTimeMixer.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, d_model=16)
model = AutoTimeMixer(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoTimeMixer(h=12, n_series=1, config=None, backend='optuna')
```

***

<a href="https://github.com/Nixtla/neuralforecast/blob/main/neuralforecast/auto.py#L2415" target="_blank" style={{ float: "right", fontSize: "smaller" }}>source</a>

### AutoRMoK

> ```text theme={null}
>  AutoRMoK (h, n_series, loss=MAE(), valid_loss=None, config=None,
>            search_alg=<ray.tune.search.basic_variant.BasicVariantGenerator
>            object at 0x7f1320ba3340>, num_samples=10,
>            refit_with_val=False, cpus=4, gpus=0, verbose=False,
>            alias=None, backend='ray', callbacks=None)
> ```

\*Class for Automatic Hyperparameter Optimization, it builds on top of
`ray` to give access to a wide variety of hyperparameter optimization
tools ranging from classic grid search, to Bayesian optimization and
HyperBand algorithm.

The validation loss to be optimized is defined by the `config['loss']`
dictionary value, the config also contains the rest of the
hyperparameter search space.

It is important to note that the success of this hyperparameter
optimization heavily relies on a strong correlation between the
validation and test periods.\*

|                  | **Type**              | **Default**                                                                      | **Details**                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------- | --------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| h                | int                   |                                                                                  | Forecast horizon                                                                                                                                                                                                                                                                                                                                                                                                       |
| n\_series        |                       |                                                                                  |                                                                                                                                                                                                                                                                                                                                                                                                                        |
| loss             | MAE                   | MAE()                                                                            | Instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| valid\_loss      | NoneType              | None                                                                             | Instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).                                                                                                                                                                                                                                                                                                   |
| config           | NoneType              | None                                                                             | Dictionary with ray.tune defined search space or function that takes an optuna trial and returns a configuration dict.                                                                                                                                                                                                                                                                                                 |
| search\_alg      | BasicVariantGenerator | \<ray.tune.search.basic\_variant.BasicVariantGenerator object at 0x7f1320ba3340> | For ray see [https://docs.ray.io/en/latest/tune/api\_docs/suggestion.html](https://docs.ray.io/en/latest/tune/api_docs/suggestion.html)<br />For optuna see [https://optuna.readthedocs.io/en/stable/reference/samplers/index.html](https://optuna.readthedocs.io/en/stable/reference/samplers/index.html).                                                                                                            |
| num\_samples     | int                   | 10                                                                               | Number of hyperparameter optimization steps/samples.                                                                                                                                                                                                                                                                                                                                                                   |
| refit\_with\_val | bool                  | False                                                                            | Refit of best model should preserve val\_size.                                                                                                                                                                                                                                                                                                                                                                         |
| cpus             | int                   | 4                                                                                | Number of cpus to use during optimization. Only used with ray tune.                                                                                                                                                                                                                                                                                                                                                    |
| gpus             | int                   | 0                                                                                | Number of gpus to use during optimization, default all available. Only used with ray tune.                                                                                                                                                                                                                                                                                                                             |
| verbose          | bool                  | False                                                                            | Track progress.                                                                                                                                                                                                                                                                                                                                                                                                        |
| alias            | NoneType              | None                                                                             | Custom name of the model.                                                                                                                                                                                                                                                                                                                                                                                              |
| backend          | str                   | ray                                                                              | Backend to use for searching the hyperparameter space, can be either ‘ray’ or ‘optuna’.                                                                                                                                                                                                                                                                                                                                |
| callbacks        | NoneType              | None                                                                             | List of functions to call during the optimization process.<br />ray reference: [https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html](https://docs.ray.io/en/latest/tune/tutorials/tune-metrics.html)<br />optuna reference: [https://optuna.readthedocs.io/en/stable/tutorial/20\_recipes/007\_optuna\_callback.html](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/007_optuna_callback.html) |

```python theme={null}
# Use your own config or AutoRMoK.default_config
config = dict(max_steps=1, val_check_steps=1, input_size=12, learning_rate=1e-2)
model = AutoRMoK(h=12, n_series=1, config=config, num_samples=1, cpus=1)

# Fit and predict
model.fit(dataset=dataset)
y_hat = model.predict(dataset=dataset)

# Optuna
model = AutoRMoK(h=12, n_series=1, config=None, backend='optuna')
```

# TESTS
