MultiInputTimeSeriesGenerator
Multi Input Timeseries Generator: It works Incase We have multi input, The keras timeseries generator only works for only single input. Keras timeseries generator can only generate sequences for single input.
In this Library we have added functionality of multi input by modifying keras source code to work it for multi input.
- ✨Multi Input Time Series Generator✨
Problem
This was the problem keras wasn't able to handle
This is what we want as multi input timeseries generator
We have given solution to this , We can make generator for equal instances.
Example working
gen=MultiInputTimeseriesGenerator(df[["ID","f2","f3"]].values,df[["output"]].values,length=2,batch_size=10,ptotal=3,same=0)
| ID | f2 | f3 | output |
|---|---|---|---|
| 1 | 2 | 3 | 1 |
| 1 | 2 | 5 | 2 |
| 1 | 2 | 3 | 5 |
| 2 | 9 | 7 | 3 |
| 2 | 8 | 3 | 4 |
| 2 | 78 | 24 | 5 |
Sequences Generated are : input:
| ID | f2 | f3 |
|---|---|---|
| 1 | 2 | 3 |
| 1 | 2 | 5 |
| output: 5 |
input:
| ID | f2 | f3 |
|---|---|---|
| 2 | 9 | 7 |
| 2 | 8 | 3 |
| output: 5 |
gen=MultiInputTimeseriesGenerator(df[["ID","f2","f3"]].values,df[["output"]].values,length=2,batch_size=10,ptotal=3,same=1)
Sequences Generated are : input:
| ID | f2 | f3 |
|---|---|---|
| 1 | 2 | 3 |
| 1 | 2 | 5 |
| output: 2 |
| ID | f2 | f3 |
|---|---|---|
| 1 | 2 | 5 |
| 1 | 2 | 3 |
| output: 5 |
input:
| ID | f2 | f3 |
|---|---|---|
| 2 | 9 | 7 |
| 2 | 8 | 3 |
| output: 4 |
input:
| ID | f2 | f3 |
|---|---|---|
| 2 | 8 | 3 |
| 2 | 78 | 24 |
| output: 5 |
Parameters
Parameters required to Pass
| Parameter | To be passed | Format |
|---|---|---|
| data | Independent Vairables (Input) | Numpy Array |
| targets | Dependent Vairable (Output) | Numpy Array |
| length | Sequence Length or Window Length | a number |
| ptotal | Total number of equal instances | a number |
| same | Same row output(1) or next row output(0) | 0 or 1 |
Calling
from MultiInputTimeseriesGenerator import MultiInputTimeseriesGenerator
gen=MultiInputTimeseriesGenerator(input,output,length=36,batch_size=1024,ptotal=36,same=0) # training generator
t_gen=MultiInputTimeseriesGenerator(input,output,length=36,batch_size=1024,ptotal=36,same=0) # testing generator
Passing to Model
history=model.fit_generator(gen,validation_data=t_gen,epochs =8 ,use_multiprocessing=False)
Can also do
gen[0]#independent vairable
gen[1]#dependent Vairable
gen[0][0]#single instance gen input
gen[0][1]#single instance gen output
gen[0][0][0] #single row
gen[0][0][0][0]#single value
1 can be used inplace of 0 to get output
Release files for MultiInputTimeseriesGenerator 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| MultiInputTimeseriesGenerator-0.0.7.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| MultiInputTimeseriesGenerator-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / MultiInputTimeseriesGenerator-0.0.7.tar.gz
| Download URL | MultiInputTimeseriesGenerator-0.0.7.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58cd6a0cdfb8f70dcb084d10671cdb7b08f2dbcb71ec393dbbc56cc4761fd158
|
|
BLAKE2b-256 checksum How to use checksums |
459b6be1d9f1569fe11e0e8f3b5aeb2caef9c17c5831a110d40513765130130b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.11
|
Release files / MultiInputTimeseriesGenerator-0.0.7-py3-none-any.whl
| Download URL | MultiInputTimeseriesGenerator-0.0.7-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac04e10c9029612445d5639503fd8805086fbf7467413b94283e6e4cceb5403e
|
|
BLAKE2b-256 checksum How to use checksums |
97dc63e16a7d17008ddc59ae63173cfb565269ac4f16d9dd6d952411fbe66401
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.11
|