No project description provided
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for MultiInputTimeseriesGenerator-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3c1a3698d76ff38c7ec47b8a9f60c0b86d4d91afc987236ed805f832008c956 |
|
MD5 | 7abc766c0335086d5de66ae1be97c769 |
|
BLAKE2b-256 | 8494eafae3ace3d16a2562c400472df9b49a7ece91e1927248dd478fb1a7a7f2 |
Hashes for MultiInputTimeseriesGenerator-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67c7e9205456421a6e604fbb4c926c72ffeb08fead2cdfde2de9a4dc38a55ec1 |
|
MD5 | de9acbac86bbb22c28c62a30c67c62b7 |
|
BLAKE2b-256 | 76cf44386c2c00188049f9d5422ee8e814f29afd82a9830499a3dcca87fe3f26 |