Skip to content

Commit 0674efa

Browse files
authored
Merge pull request #400 from unit8co/develop
v0.9.1
2 parents 601461e + c36a360 commit 0674efa

37 files changed

+692
-380
lines changed

.github/workflows/develop.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [macos-latest, ubuntu-latest]
14-
python-version: [3.7, 3.8, 3.9]
15-
flavour: ['core', 'all']
14+
python-version: [3.9]
15+
flavour: ['all']
1616

1717
steps:
1818
- name: "1. Clone repository"
@@ -38,14 +38,14 @@ jobs:
3838

3939
- name: "4. Setup pip"
4040
run: |
41-
./gradlew setupPip
41+
./gradlew installPipLatest
4242
4343
- name: "5. Attach cache for pip"
4444
uses: actions/cache@v1
4545
id: cache
4646
with:
4747
path: ~/.cache/pip
48-
key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements/core.txt', 'requirements/dev.txt', 'requirements/fbprophet.txt', 'requirements/pmdarima.txt', 'requirements/torch.txt') }}
48+
key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }}
4949

5050
- name: "6. Tests"
5151
run: |
@@ -57,10 +57,10 @@ jobs:
5757
- name: "1. Clone repository"
5858
uses: actions/checkout@v2
5959

60-
- name: "2. Set up Python 3.8"
60+
- name: "2. Set up Python 3.9"
6161
uses: actions/setup-python@v1
6262
with:
63-
python-version: 3.8
63+
python-version: 3.9
6464

6565
- name: "3. Install pandoc"
6666
run: |
@@ -88,7 +88,7 @@ jobs:
8888
id: cache
8989
with:
9090
path: ~/.cache/pip
91-
key: tests-${{ runner.os }}-3.8-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }}
91+
key: tests-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }}
9292

9393
- name: "7. Build docs"
9494
run: |
@@ -103,10 +103,10 @@ jobs:
103103
- name: "1. Clone repository"
104104
uses: actions/checkout@v2
105105

106-
- name: "2. Set up Python 3.8"
106+
- name: "2. Set up Python 3.9"
107107
uses: actions/setup-python@v1
108108
with:
109-
python-version: 3.8
109+
python-version: 3.9
110110

111111
# downloading gradle multiple times in parallel can yield to connection errors
112112
- name: "3. Cache gradle distribution"
@@ -124,4 +124,3 @@ jobs:
124124
- name: "4. Run examples ${{matrix.example-name}}"
125125
run: |
126126
./gradlew checkExample -PexampleName=${{matrix.example-name}}
127-

.github/workflows/merge.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
os: [macos-latest, ubuntu-latest]
1515
python-version: [3.7, 3.8, 3.9]
16-
flavour: ['core', 'all', 'pmdarima', 'torch', 'fbprophet']
16+
flavour: ['all']
1717

1818
steps:
1919
- name: "1. Clone repository"
@@ -39,14 +39,14 @@ jobs:
3939

4040
- name: "4. Setup pip"
4141
run: |
42-
./gradlew setupPip
42+
./gradlew installPipLatest
4343
4444
- name: "5. Attach cache for pip"
4545
uses: actions/cache@v1
4646
id: cache
4747
with:
4848
path: ~/.cache/pip
49-
key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements/core.txt', 'requirements/dev.txt', 'requirements/fbprophet.txt', 'requirements/pmdarima.txt', 'requirements/torch.txt') }}
49+
key: tests-${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements-latest.txt') }}
5050

5151
- name: "6. Tests"
5252
run: |
@@ -61,10 +61,10 @@ jobs:
6161
- name: "1. Clone repository"
6262
uses: actions/checkout@v2
6363

64-
- name: "2. Set up Python 3.8"
64+
- name: "2. Set up Python 3.9"
6565
uses: actions/setup-python@v1
6666
with:
67-
python-version: 3.8
67+
python-version: 3.9
6868

6969
# downloading gradle multiple times in parallel can yield to connection errors
7070
- name: "3. Cache gradle distribution"
@@ -79,6 +79,7 @@ jobs:
7979
path: ~/.gradle/caches
8080
key: tests-${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle') }}
8181

82+
# TODO: why is this a matrix? there is no pip caching, and we restart this for each item in the matrix
8283
- name: "4. Run examples ${{matrix.example-name}}"
8384
run: |
8485
./gradlew checkExample -PexampleName=${{matrix.example-name}}
@@ -90,10 +91,10 @@ jobs:
9091
- name: "1. Clone repository"
9192
uses: actions/checkout@v2
9293

93-
- name: "2. Set up Python 3.8"
94+
- name: "2. Set up Python 3.9"
9495
uses: actions/setup-python@v1
9596
with:
96-
python-version: 3.8
97+
python-version: 3.9
9798

9899
- name: "3. Install pandoc"
99100
run: |
@@ -121,7 +122,7 @@ jobs:
121122
id: cache
122123
with:
123124
path: ~/.cache/pip
124-
key: release-${{ runner.os }}-3.8-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }}
125+
key: release-${{ runner.os }}-3.9-pip-${{ hashFiles('requirements/core.txt', 'requirements/release.txt') }}
125126

126127
- name: "7. Build docs"
127128
run: |

.github/workflows/release.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
token: ${{ secrets.RELEASE_WORKFLOW_TOKEN }}
1818
fetch-depth: '1'
1919

20-
- name: "2. Set up Python 3.8"
20+
- name: "2. Set up Python 3.9"
2121
uses: actions/setup-python@v1
2222
with:
23-
python-version: 3.8
23+
python-version: 3.9
2424

2525
- name: "3. Update pip"
2626
run: |
@@ -128,10 +128,10 @@ jobs:
128128
- name: "1. Clone repository"
129129
uses: actions/checkout@v2
130130

131-
- name: "2. Set up Python 3.8"
131+
- name: "2. Set up Python 3.9"
132132
uses: actions/setup-python@v1
133133
with:
134-
python-version: 3.8
134+
python-version: 3.9
135135

136136
- name: "3. Install pandoc"
137137
run: |

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ coverage.xml
1717
docs_env
1818
.DS_Store
1919
.gradle
20+
21+
# used by CI to build with latest versions of dependencies
22+
requirements-latest.txt

CHANGELOG.md

+27-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,33 @@
44
Darts is still in an early development phase and we cannot always guarantee backwards compatibility. Changes that may **break code which uses a previous release of Darts** are marked with a "🔴".
55

66
## [Unreleased](https://github.com/unit8co/darts/tree/develop)
7-
[Full Changelog](https://github.com/unit8co/darts/compare/0.9.0...develop)
7+
[Full Changelog](https://github.com/unit8co/darts/compare/0.9.1...develop)
8+
9+
## [0.9.1](https://github.com/unit8co/darts/tree/0.9.1) (2021-07-17)
10+
### For users of the library:
11+
12+
**Added:**
13+
- Improved `GaussianProcessFilter`, now handling missing values, and better handling
14+
time series indexed by datetimes.
15+
- Improved Gaussian Process notebook.
16+
17+
**Fixed:**
18+
- `TimeSeries` now supports indexing using `pandas.Int64Index` and not just `pandas.RangeIndex`,
19+
which solves some indexing issues.
20+
- We have changed all factory methods of `TimeSeries` to have `fill_missing_dates=False` by
21+
default. This is because in some cases inferring the frequency for missing dates and
22+
resampling the series is causing significant performance overhead.
23+
- Fixed backtesting to make it work with integer-indexed series.
24+
- Fixed a bug that was causing inference to crash on GPUs for some models.
25+
- Fixed the default folder name, which was causing issues on Windows systems.
26+
- We have slightly improved the documentation rendering and fixed the titles
27+
of the documentation pages for `RNNModel` and `BlockRNNModel` to distinguish them.
28+
29+
**Changed:**
30+
- The dependencies are not pinned to some exact versions anymore.
31+
32+
### For developers of the library:
33+
- We have fixed the building process.
834

935
## [0.9.0](https://github.com/unit8co/darts/tree/0.9.0) (2021-07-09)
1036
### For users of the library:

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
graft requirements

README.md

+21-22
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,21 @@ Here's a breakdown of the forecasting models currently implemented in Darts. We
112112
on bringing more models and features.
113113

114114
Model | Univariate | Multivariate | Probabilistic | Multiple-series training | Past-observed covariates support | Future-known covariates support
115-
--- | --- | --- | --- | --- | --- | --- |
116-
`ARIMA` | x | | x | | | |
117-
`VARIMA` | x | x | | | | |
118-
`AutoARIMA` | x | | | | | |
119-
`ExponentialSmoothing` | x | | x | | | |
120-
`Theta` and `FourTheta` | x | | | | | |
121-
`Prophet` | x | | | | | |
122-
`FFT` (Fast Fourier Transform) | x | | | | | |
123-
Regression Models (incl `RandomForest` and `LinearRegressionModel`) | x | | | | | |
124-
`RNNModel` (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version | x | x | x | x | x | x |
125-
`BlockRNNModel` (incl. LSTM and GRU) | x | x | | x | x | (x) |
126-
`NBEATSModel` | x | x | | x | x | (x) |
127-
`TCNModel` | x | x | x | x | x | (x) |
128-
`TransformerModel` | x | x | | x | x | (x) |
129-
Naive Baselines | x | | | | | |
130-
115+
--- | --- | --- | --- | --- | --- | ---
116+
`ARIMA` | x | | x | | |
117+
`VARIMA` | x | x | | | |
118+
`AutoARIMA` | x | | | | |
119+
`ExponentialSmoothing` | x | | x | | |
120+
`Theta` and `FourTheta` | x | | | | |
121+
`Prophet` | x | | | | |
122+
`FFT` (Fast Fourier Transform) | x | | | | |
123+
Regression Models (incl `RandomForest` and `LinearRegressionModel`) | x | | | | |
124+
`RNNModel` (incl. LSTM and GRU); equivalent to DeepAR in its probabilistic version | x | x | x | x | x | x
125+
`BlockRNNModel` (incl. LSTM and GRU) | x | x | | x | x | ( x )
126+
`NBEATSModel` | x | x | | x | x | ( x )
127+
`TCNModel` | x | x | x | x | x | ( x )
128+
`TransformerModel` | x | x | | x | x | ( x )
129+
Naive Baselines | x | | | | |
131130

132131
## Contribute
133132

@@ -145,12 +144,12 @@ If what you want to tell us is not a suitable github issue, feel free to send us
145144

146145
### Preconditions
147146

148-
Some of the models depend on `fbprophet` and `torch`, which have non-Python dependencies.
147+
Some of the models depend on `prophet` and `torch`, which have non-Python dependencies.
149148
A Conda environment is thus recommended because it will handle all of those in one go.
150149

151150
The following steps assume running inside a conda environment.
152151
If that's not possible, first follow the official instructions to install
153-
[fbprophet](https://facebook.github.io/prophet/docs/installation.html#python)
152+
[prophet](https://facebook.github.io/prophet/docs/installation.html#python)
154153
and [torch](https://pytorch.org/get-started/locally/), then skip to
155154
[Install darts](#install-darts)
156155

@@ -166,11 +165,11 @@ Don't forget to activate your virtual environment
166165

167166
#### MAC
168167

169-
conda install -c conda-forge -c pytorch pip fbprophet pytorch
168+
conda install -c conda-forge -c pytorch pip prophet pytorch
170169

171170
#### Linux and Windows
172171

173-
conda install -c conda-forge -c pytorch pip fbprophet pytorch cpuonly
172+
conda install -c conda-forge -c pytorch pip prophet pytorch cpuonly
174173

175174
### Install darts
176175

@@ -181,7 +180,7 @@ we also maintain the `u8darts` package, which provides the following alternate l
181180

182181
* Install core only (without neural networks, Prophet or AutoARIMA): `pip install u8darts`
183182
* Install core + neural networks (PyTorch): `pip install 'u8darts[torch]'`
184-
* Install core + Facebook Prophet: `pip install 'u8darts[fbprophet]'`
183+
* Install core + Facebook Prophet: `pip install 'u8darts[prophet]'`
185184
* Install core + AutoARIMA: `pip install 'u8darts[pmdarima]'`
186185

187186
### Running the examples only, without installing:
@@ -213,7 +212,7 @@ alternatively you can run
213212
./gradlew lint # to run linter
214213
```
215214

216-
To run the tests for specific flavours of the library, replace `_all` with `_core`, `_fbprophet`, `_pmdarima` or `_torch`.
215+
To run the tests for specific flavours of the library, replace `_all` with `_core`, `_prophet`, `_pmdarima` or `_torch`.
217216

218217
### Documentation
219218

build.gradle

+26-5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ task setupPip(type: Exec) {
5757
commandLine "python", "-m", "pip", "install", "--upgrade", "pip"
5858
}
5959

60+
task installPipLatest {
61+
dependsOn setupPip
62+
doLast {
63+
exec {
64+
commandLine "pip", "install", "pip-tools"
65+
}
66+
exec {
67+
commandLine "pip-compile", "-o", "requirements-latest.txt"
68+
}
69+
exec {
70+
commandLine "pip", "install", "-r", "requirements-latest.txt"
71+
}
72+
}
73+
}
74+
6075
void createPipInstallTask(String flavour) {
6176
String taskName = "pip_" + flavour;
6277
String taskArgument = "requirements/" + flavour + ".txt";
@@ -65,7 +80,7 @@ void createPipInstallTask(String flavour) {
6580
}
6681
}
6782

68-
String[] flavours = ["core", "fbprophet", "pmdarima", "dev", "torch", "release"];
83+
String[] flavours = ["core", "prophet", "pmdarima", "dev", "torch", "release"];
6984

7085
for(String flavour : flavours) {
7186
createPipInstallTask(flavour);
@@ -79,7 +94,7 @@ task pipInstall() {
7994
doFirst {
8095
setupPip
8196
}
82-
dependsOn pip_core, pip_dev, pip_fbprophet, pip_pmdarima, pip_torch, pip_release
97+
dependsOn pip_core, pip_dev, pip_prophet, pip_pmdarima, pip_torch, pip_release
8398
}
8499

85100
// Tests
@@ -115,19 +130,25 @@ void createPipRelatedTask(String flavour) {
115130
}
116131
}
117132

118-
flavours = ["core", "fbprophet", "pmdarima", "torch"];
133+
flavours = ["core", "prophet", "pmdarima", "torch"];
119134

120135
for(String flavour : flavours) {
121136
createPipRelatedTask(flavour);
122137
}
123138

124139
task unitTest_all(type: Exec) {
125-
dependsOn pip_core, pip_dev, pip_fbprophet, pip_pmdarima, pip_torch
140+
dependsOn installPipLatest, pip_dev
141+
doFirst {
142+
installPipLatest
143+
}
126144
commandLine "python", "-m", "unittest"
127145
}
128146

129147
task coverageTest_all() {
130-
dependsOn pip_core, pip_dev, pip_fbprophet, pip_pmdarima, pip_torch
148+
dependsOn installPipLatest, pip_dev
149+
doFirst {
150+
installPipLatest
151+
}
131152
doLast {
132153
coverageTestSteps()
133154
}

darts/datasets/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ def __init__(self):
140140
uri=_DEFAULT_PATH+"/monthly-milk-incomplete.csv",
141141
hash="49b275c7e2f8f28a6a05224be1a049a4",
142142
header_time="Month",
143-
format_time="%Y-%m"
143+
format_time="%Y-%m",
144+
freq='M'
144145
))
145146

146147

@@ -197,7 +198,8 @@ def __init__(self):
197198
uri=_DEFAULT_PATH+"/temps.csv",
198199
hash="ce5b5e4929793ec8b6a54711110acebf",
199200
header_time="Date",
200-
format_time="%m/%d/%Y"
201+
format_time="%m/%d/%Y",
202+
freq='D'
201203
))
202204

203205

darts/datasets/dataset_loaders.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class DatasetLoaderMetadata:
2323
# used to convert the string date to pd.Datetime
2424
# https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
2525
format_time: str = None
26+
# used to indicate the freq when we already know it
27+
freq: str = None
2628

2729

2830
class DatasetLoadingException(BaseException):
@@ -145,5 +147,5 @@ def _load_from_disk(self, path_to_file: Path, metadata: DatasetLoaderMetadata) -
145147
df = pd.read_csv(path_to_file)
146148
if metadata.header_time is not None:
147149
df = self._format_time_column(df)
148-
return TimeSeries.from_dataframe(df=df, time_col=metadata.header_time)
150+
return TimeSeries.from_dataframe(df=df, time_col=metadata.header_time, freq=metadata.freq)
149151
return TimeSeries.from_dataframe(df)

0 commit comments

Comments
 (0)