Code Monkey home page Code Monkey logo

tensorflow-dain's Introduction

DAIN

A TensorFlow 2.x Implemention of Deep Adaptive Input Normalization for Time Series Using Keras API

TL;DR: Here is a trainable neural layer for time series normalization.

Usage

from tensorflow import keras
from dain import Dain

dim = 1000 # number of rows in a sample
n_features = 100 # number of features in a row

model = keras.Sequential()
model.add(Dain(dim, n_features))
model.add(...)

# training
# raw_features.shape == (batch_size, dim, n_features)
model.fit(raw_features, targets)

Components

DAIN (Passalis et al., 2019) behaviors as z-score standardization with feature selection in a trainable/adaptive way. The authors claim the preprocessing layer generalizes preprocessing well for time series data with the key components:

  • Adaptive Averaging (updates on mean value)
  • Adaptive Scaling (updates on standard diavation)
  • Gating (suppresses unrelated features)

Future Work

In the original pytorch version, a learning rate multiplier for Adam optimizer is used to apply different fine-tuned learning rates on the DAIN weights. This is not implemented in the TensorFlow Keras Implemention. As an alternative, please refer to a keras-contrib implementation here.

tensorflow-dain's People

Contributors

llouislu avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

mseravalli

tensorflow-dain's Issues

module 'keras.api._v2.keras.layers' has no attribute 'LaDainyer'

Hi
When I try to execute the code, I encounter the following call error.
Thank you.
Help me.


AttributeError Traceback (most recent call last)

in ()
15 #---------------USE DAIN-----------------
16 #Adaptive Input Normalization layer
---> 17 from dain import Dain

/content/drive/MyDrive/real-------------/dain.py in ()
4
5
----> 6 class Dain(layers.LaDainyer):
7 def init(self, dim, n_features, name="dain", **kwargs):
8 # input tensor: (batch_size, rows, n_features)

AttributeError: module 'keras.api._v2.keras.layers' has no attribute 'LaDainyer'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.