Git Product home page Git Product logo

Comments (5)

philipperemy avatar philipperemy commented on August 30, 2024

@jmrichardson Hum it means that the network does not learn anything if the classes are well-balanced (50% chance of having 0, and 50% of having 1). Why don't you try another simple model? Are your features spatially correlated like an image? Because TCN is based on convolutions.

from keras-tcn.

jmrichardson avatar jmrichardson commented on August 30, 2024

Sorry, I assumed that we could use keras-tcn for multivariate tabular data since I saw an example in your repo for a univariate data set. I am learning more about CNNs and see that the filters convolve around image data to detect things like edges for images. Since my data set features are temporal (not IID) but not images I don't think I can use keras-tcn correct?

from keras-tcn.

philipperemy avatar philipperemy commented on August 30, 2024

@jmrichardson no you can here. If your data has shape (batch-size, timestep, input-dim), you can use a TCN. For example if you have 64 time series with 1000 time steps, you can use TCN. Your input will be (batch-size, 1000, 64). TCN uses 1-D convolutions.

from keras-tcn.

jmrichardson avatar jmrichardson commented on August 30, 2024

I think I have the right data shape... I have 83 time series with 31K rows. I used the following code to create a rolling window of 20 sequences/timesteps similar to your milk task example:

lookback_window = 20

# Get training data
X_train = np.array(X_train_split)
y_train = np.array(y_train_split)
x, y = [], []
for i in range(lookback_window, len(X_train)):
    x.append(X_train[i - lookback_window:i])
    y.append(y_train[i])
X_train = np.array(x)
y_train = np.array(y)

# Get validation data
X_val = np.array(X_val_split)
y_val = np.array(y_val_split)
x, y = [], []
for i in range(lookback_window, len(X_val)):
    x.append(X_val[i - lookback_window:i])
    y.append(y_val[i])
X_val = np.array(x)
y_val = np.array(y)

Here is the shape X_train shape:

print(X_train.shape)
print(y_train.shape)
(31066, 20, 83)
(31066,)

Here is the model code:

model = compiled_tcn(return_sequences=False,
                     num_feat=X_train.shape[2],
                     num_classes=2,
                     nb_filters=24,
                     kernel_size=8,
                     dilations=[2 ** i for i in range(9)],
                     nb_stacks=1,
                     max_len=X_train.shape[1],
                     use_skip_connections=True,
                     )

model.fit(X_train, y_train, validation_data=(X_val, y_val), epochs=1, batch_size=256)

from keras-tcn.

philipperemy avatar philipperemy commented on August 30, 2024

Sorry I don't have much time to look at code snippets. I don't see any errors here. Don't hesitate to post your question on a machine learning forum. I'll close this issue as I don't see any bugs here. Thanks!

from keras-tcn.

Related Issues (20)

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.