Skip to content

Commit

Permalink
Merge pull request #33 from BBVA/develop
Browse files Browse the repository at this point in the history
New version 4.0
  • Loading branch information
SIPVZ authored May 21, 2020
2 parents 5e6d352 + aa96589 commit 504e140
Show file tree
Hide file tree
Showing 24 changed files with 638 additions and 621 deletions.
25 changes: 2 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
FROM tiangolo/uwsgi-nginx-flask:python3.6

RUN apt-get update && apt-get install -y redis-server python3-celery python-celery-common python3-redis


COPY ./ /app

COPY ./requirements.txt /tmp/
RUN pip3 install numpy sqlalchemy
RUN pip install --upgrade --no-deps statsmodels
RUN pip3 install --requirement /tmp/requirements.txt

RUN pip install -U numpy

RUN pip3 install pandas scipy patsy matplotlib numdifftools seaborn
RUN pip3 install pyflux
RUN pip3 install pyramid-arima
RUN pip3 install tensorflow==1.14.0
RUN pip3 install -U statsmodels
RUN pip3 install tbats
RUN pip3 install celery
RUN pip install redis
RUN service redis-server start
RUN pip install h5py


COPY ./config/timeout.conf /etc/nginx/conf.d/
RUN chmod -R g=u /etc/passwd /app

RUN pip install mxnet==1.4.1 gluonts && apt-get update && apt-get install -y redis-server python3-celery python-celery-common python3-redis && rm -rf /var/lib/apt/lists/* && pip3 install numpy pandas && pip3 install --requirement /tmp/requirements.txt && pip3 install fbprophet && chmod -R g=u /etc/passwd /app && pip install --upgrade pyflux && pip install --upgrade numpy && rm -fr /root/.cache/pip && service redis-server start
134 changes: 117 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,49 @@ To use TIMECOP engine you will need to send a univariate or multivariate time se

![alt text](https://raw.githubusercontent.com/BBVA/timecop/master/doc/img/flow_chart.jpg)

## Installation

To use timecop the easiest way is to deploy the docker image made with the last version.
The steps to use the docker images are:

1. Install docker
2. Download timecop docker image:

**docker pull trakuo/timecop:devel**
3. Execute a container with the timecop image:

**docker run --name timecoprunning -p 3000:80 trakuo/timecop:devel**
5. Open web test page to test timecop is running

**http://localhost:3000/static/index.html**


## Main Features
- [x] **Future**: Forecast n steps
- [x] **Past**: Sensibility custom anomaly detection
- [x] **Now**: Sensibility custom anomaly detection

#### Secondary Features
- [x] Delta / Full timesteps upload
- [x] Train / Use best known model in production envirotnment
- [x] Python API for easy integration in notebooks / python apps
- [x] Backend Database



## Algorithms
#### Univariate

- [x] Long Short Term Memory networks
- [x] Facebook prophet
- [x] vector autoregression
- [x] Gluon-ts
- [x] Holtwinters
- [x] ARIMA
- [ ] TBATS


#### Multivariate
- [x] Long Short Term Memory networks
- [x] vector autoregression
- [ ] Vector error correction model
- [ ] SArimaX

## Metrics
- [x] Mean Absolute Error
- [x] Mean Squeared Error
- [x] Root Mean Squeared Error
- [x] Symmetric mean absolute percentage error
- [x] Mean Absolute Percentage Error


## Advanced features
- [x] Trend
- [x] ChangePoints
- [ ] Confidence interval

## Web test page

Expand Down Expand Up @@ -166,6 +192,80 @@ An example response will be:
}

```
## Python API Getting Started with the python API

A python package to invoke Timecop from any python code, using the RESTful Web Server API for you.
For more information, go to the [pip module](https://pypi.org/project/timecopts/)

###### UNIVARIATE

```
import timecopts as tc
TS=[1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
URL = 'URL_timecop_server'
output_json = tc.timecop_univariate(URL,name='test_timeseries', TS, train=True, restart=True)
```

###### MULTIVARIATE


```
import timecopts as tc
TS_main=[1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries= []
temp = {}
temp['data'] = [1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries.append(temp)
temp2 = {}
temp2['data'] = [1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries.append(temp2)
URL = 'URL_timecop_server'
output_json = tc.timecop_multivariate(URL,name='test_timeseries', TS_main,TS_timeseries, train=True, restart=True)
```





## Python API Getting Started with the python API

A python package to invoke Timecop from any python code, using the RESTful Web Server API for you.
For more information, go to the [pip module](https://pypi.org/project/timecopts/)

###### UNIVARIATE

```
import timecopts as tc
TS=[1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
URL = 'URL_timecop_server'
output_json = tc.timecop_univariate(URL,name='test_timeseries', TS, train=True, restart=True)
```

###### MULTIVARIATE


```
import timecopts as tc
TS_main=[1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries= []
temp = {}
temp['data'] = [1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries.append(temp)
temp2 = {}
temp2['data'] = [1,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9]
TS_timeseries.append(temp2)
URL = 'URL_timecop_server'
output_json = tc.timecop_multivariate(URL,name='test_timeseries', TS_main,TS_timeseries, train=True, restart=True)
```



#### Response explained
Expand Down
Binary file removed Timecop_modelsv1.db
Binary file not shown.
Loading

0 comments on commit 504e140

Please sign in to comment.