model_selection_multiseries
¶
backtesting_forecaster_multiseries(forecaster, series, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, refit=False, interval=None, n_boot=500, random_state=123, in_sample_residuals=True, n_jobs='auto', verbose=False, show_progress=True, suppress_warnings=False)
¶
Backtesting for multi-series and multivariate forecasters.
- If
refit
isFalse
, the model will be trained only once using theinitial_train_size
first observations. - If
refit
isTrue
, the model is trained on each iteration, increasing the training set. - If
refit
is aninteger
, the model will be trained every that number of iterations. - If
forecaster
is already trained andinitial_train_size
isNone
, no initial train will be done and all data will be used to evaluate the model. However, the firstlen(forecaster.last_window)
observations are needed to create the initial predictors, so no predictions are calculated for them.
A copy of the original forecaster is created so that it is not modified during the process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate, ForecasterRnn)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. If |
`None`
|
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
Time series to be predicted. If |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
interval |
list
|
Confidence of the prediction interval estimated. Sequence of percentiles
to compute, which must be between 0 and 100 inclusive. If |
`None`
|
n_boot |
int
|
Number of bootstrapping iterations used to estimate prediction intervals. |
`500`
|
random_state |
int
|
Sets a seed to the random generator, so that boot intervals are always deterministic. |
`123`
|
in_sample_residuals |
bool
|
If |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds and index of training and validation sets used for backtesting. |
`False`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
metrics_levels |
pandas DataFrame
|
Value(s) of the metric(s). Index are the levels and columns the metrics. |
backtest_predictions |
pandas DataFrame
|
Value of predictions and their estimated interval if
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
|
grid_search_forecaster_multiseries(forecaster, series, param_grid, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid=None, refit=False, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None)
¶
Exhaustive search over specified parameter values for a Forecaster object. Validation is done using multi-series backtesting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
param_grid |
dict
|
Dictionary with parameters names ( |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
(list, dict)
|
Lists of lags to try, containing int, lists, numpy ndarray, or range
objects. If |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
|
random_search_forecaster_multiseries(forecaster, series, param_distributions, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid=None, refit=False, n_iter=10, random_state=123, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None)
¶
Random search over specified parameter values or distributions for a Forecaster object. Validation is done using multi-series backtesting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
param_distributions |
dict
|
Dictionary with parameters names ( |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
(list, dict)
|
Lists of lags to try, containing int, lists, numpy ndarray, or range
objects. If |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
n_iter |
int
|
Number of parameter settings that are sampled per lags configuration. n_iter trades off runtime vs quality of the solution. |
`10`
|
random_state |
int
|
Sets a seed to the random sampling for reproducible output. |
`123`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 |
|
bayesian_search_forecaster_multiseries(forecaster, series, search_space, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid='deprecated', refit=False, n_trials=10, random_state=123, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None, engine='optuna', kwargs_create_study={}, kwargs_study_optimize={})
¶
Bayesian optimization for a Forecaster object using multi-series backtesting and optuna library. New in version 0.12.0
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
search_space |
Callable
|
Function with argument |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
deprecated
|
Deprecated since version 0.12.0 and will be removed in 0.13.0. Use
|
'deprecated'
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
n_trials |
int
|
Number of parameter settings that are sampled in each lag configuration. |
`10`
|
random_state |
int
|
Sets a seed to the sampling for reproducible output. |
`123`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
engine |
str
|
Bayesian optimization runs through the optuna library. |
`'optuna'`
|
kwargs_create_study |
dict
|
Keyword arguments (key, value mappings) to pass to optuna.create_study(). If default, the direction is set to 'minimize' and a TPESampler(seed=123) sampler is used during optimization. |
`{}`
|
kwargs_study_optimize |
dict
|
Other keyword arguments (key, value mappings) to pass to study.optimize(). |
`{}`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
best_trial |
optuna object
|
The best optimization result returned as a FrozenTrial optuna object. |
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 |
|
select_features_multiseries(forecaster, selector, series, exog=None, select_only=None, force_inclusion=None, subsample=0.5, random_state=123, verbose=True)
¶
Feature selection using any of the sklearn.feature_selection module selectors
(such as RFECV
, SelectFromModel
, etc.). Two groups of features are
evaluated: autoregressive features and exogenous features. By default, the
selection process is performed on both sets of features at the same time,
so that the most relevant autoregressive and exogenous features are selected.
However, using the select_only
argument, the selection process can focus
only on the autoregressive or exogenous features without taking into account
the other features. Therefore, all other features will remain in the model.
It is also possible to force the inclusion of certain features in the final
list of selected features using the force_inclusion
parameter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiseriesCustom)
|
Forecaster model. |
required |
selector |
object
|
A feature selector from sklearn.feature_selection. |
required |
series |
pandas DataFrame
|
Target time series to which the feature selection will be applied. |
required |
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
select_only |
str
|
Decide what type of features to include in the selection process.
|
`None`
|
force_inclusion |
(list, str)
|
Features to force include in the final list of selected features.
|
`None`
|
subsample |
(int, float)
|
Proportion of records to use for feature selection. |
`0.5`
|
random_state |
int
|
Sets a seed for the random subsample so that the subsampling process is always deterministic. |
`123`
|
verbose |
bool
|
Print information about feature selection process. |
`True`
|
Returns:
Name | Type | Description |
---|---|---|
selected_autoreg |
list
|
List of selected autoregressive features. |
selected_exog |
list
|
List of selected exogenous features. |
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 |
|
backtesting_forecaster_multivariate(forecaster, series, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, refit=False, interval=None, n_boot=500, random_state=123, in_sample_residuals=True, n_jobs='auto', verbose=False, show_progress=True, suppress_warnings=False)
¶
This function is an alias of backtesting_forecaster_multiseries.
Backtesting for multi-series and multivariate forecasters.
If refit
is False, the model is trained only once using the initial_train_size
first observations. If refit
is True, the model is trained in each iteration
increasing the training set. A copy of the original forecaster is created so
it is not modified during the process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. If |
`None`
|
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
Time series to be predicted. If |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
interval |
list
|
Confidence of the prediction interval estimated. Sequence of percentiles
to compute, which must be between 0 and 100 inclusive. If |
`None`
|
n_boot |
int
|
Number of bootstrapping iterations used to estimate prediction intervals. |
`500`
|
random_state |
int
|
Sets a seed to the random generator, so that boot intervals are always deterministic. |
`123`
|
in_sample_residuals |
bool
|
If |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds and index of training and validation sets used for backtesting. |
`False`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
Returns:
Name | Type | Description |
---|---|---|
metrics_levels |
pandas DataFrame
|
Value(s) of the metric(s). Index are the levels and columns the metrics. |
backtest_predictions |
pandas DataFrame
|
Value of predictions and their estimated interval if
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 |
|
grid_search_forecaster_multivariate(forecaster, series, param_grid, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid=None, refit=False, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None)
¶
This function is an alias of grid_search_forecaster_multiseries.
Exhaustive search over specified parameter values for a Forecaster object. Validation is done using multi-series backtesting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
param_grid |
dict
|
Dictionary with parameters names ( |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
(list, dict)
|
Lists of lags to try, containing int, lists, numpy ndarray, or range
objects. If |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 |
|
random_search_forecaster_multivariate(forecaster, series, param_distributions, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid=None, refit=False, n_iter=10, random_state=123, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None)
¶
This function is an alias of random_search_forecaster_multiseries.
Random search over specified parameter values or distributions for a Forecaster object. Validation is done using multi-series backtesting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
param_distributions |
dict
|
Dictionary with parameters names ( |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
(list, dict)
|
Lists of lags to try, containing int, lists, numpy ndarray, or range
objects. If |
`None`
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
n_iter |
int
|
Number of parameter settings that are sampled per lags configuration. n_iter trades off runtime vs quality of the solution. |
`10`
|
random_state |
int
|
Sets a seed to the random sampling for reproducible output. |
`123`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 |
|
bayesian_search_forecaster_multivariate(forecaster, series, search_space, steps, metric, initial_train_size, fixed_train_size=True, gap=0, allow_incomplete_fold=True, levels=None, exog=None, lags_grid='deprecated', refit=False, n_trials=10, random_state=123, return_best=True, n_jobs='auto', verbose=True, show_progress=True, suppress_warnings=False, output_file=None, engine='optuna', kwargs_create_study={}, kwargs_study_optimize={})
¶
This function is an alias of bayesian_search_forecaster_multiseries.
Bayesian optimization for a Forecaster object using multi-series backtesting and optuna library. New in version 0.12.0
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forecaster |
(ForecasterAutoregMultiSeries, ForecasterAutoregMultiSeriesCustom, ForecasterAutoregMultiVariate)
|
Forecaster model. |
required |
series |
pandas DataFrame, dict
|
Training time series. |
required |
search_space |
Callable
|
Function with argument |
required |
steps |
int
|
Number of steps to predict. |
required |
metric |
(str, Callable, list)
|
Metric used to quantify the goodness of fit of the model.
|
required |
initial_train_size |
int
|
Number of samples in the initial train split. |
required |
fixed_train_size |
bool
|
If True, train size doesn't increase but moves by |
`True`
|
gap |
int
|
Number of samples to be excluded after the end of each training set and before the test set. |
`0`
|
allow_incomplete_fold |
bool
|
Last fold is allowed to have a smaller number of samples than the
|
`True`
|
levels |
(str, list)
|
level ( |
`None`
|
exog |
pandas Series, pandas DataFrame, dict
|
Exogenous variables. |
`None`
|
lags_grid |
deprecated
|
Deprecated since version 0.12.0 and will be removed in 0.13.0. Use
|
'deprecated'
|
refit |
(bool, int)
|
Whether to re-fit the forecaster in each iteration. If |
`False`
|
n_trials |
int
|
Number of parameter settings that are sampled in each lag configuration. |
`10`
|
random_state |
int
|
Sets a seed to the sampling for reproducible output. |
`123`
|
return_best |
bool
|
Refit the |
`True`
|
n_jobs |
(int, auto)
|
The number of jobs to run in parallel. If |
`'auto'`
|
verbose |
bool
|
Print number of folds used for cv or backtesting. |
`True`
|
show_progress |
bool
|
Whether to show a progress bar. |
`True`
|
suppress_warnings |
bool
|
If |
False
|
output_file |
str
|
Specifies the filename or full path where the results should be saved.
The results will be saved in a tab-separated values (TSV) format. If
|
`None`
|
engine |
str
|
Bayesian optimization runs through the optuna library. |
`'optuna'`
|
kwargs_create_study |
dict
|
Keyword arguments (key, value mappings) to pass to optuna.create_study(). If default, the direction is set to 'minimize' and a TPESampler(seed=123) sampler is used during optimization. |
`{}`
|
kwargs_study_optimize |
dict
|
Other keyword arguments (key, value mappings) to pass to study.optimize(). |
`{}`
|
Returns:
Name | Type | Description |
---|---|---|
results |
pandas DataFrame
|
Results for each combination of parameters.
|
best_trial |
optuna object
|
The best optimization result returned as a FrozenTrial optuna object. |
Source code in skforecast\model_selection_multiseries\model_selection_multiseries.py
2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 |
|