Skip to main content

No project description provided

Project description

MultiInputTimeSeriesGenerator

Build Status

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

image

This is what we want as multi input timeseries generator

image

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

MultiInputTimeseriesGenerator-0.0.7.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page