mlech26l / ncps

PyTorch and TensorFlow implementation of NCP, LTC, and CfC wired neural models
https://www.nature.com/articles/s42256-020-00237-3
Apache License 2.0
1.86k stars 297 forks source link

How to define Output Dimension in NCP/LTC network? #59

Open Mariam-124 opened 6 months ago

Mariam-124 commented 6 months ago

Hi , I am trying to use a multivariant LST model for stock price prediction , and that model defines output dimension which is different from input dimension. But I am unable to understand how to add output dimension in NCP.

Previous model: _model = Sequential() model.add(LSTM(64, activation='relu', input_shape=(trainX.shape[1], trainX.shape[2]), return_sequences=True)) model.add(LSTM(32, activation='relu', returnsequences=False)) model.add(Dropout(0.2)) model.add(Dense(trainY.shape[1]))

My LTC Model is

wiring = wirings.AutoNCP(8,1) # 8 neurons in total, 1 output (motor neuron) model = keras.models.Sequential( [ keras.layers.InputLayer(input_shape=(None, 5)),

here we could potentially add layers before and after the LTC network

    LTC(wiring, return_sequences=True),
]

) model.compile( optimizer=keras.optimizers.Adam(0.01), loss='mean_squared_error' )

model.summary()

as I want my output to be 2 dimensional but this gives same output dimensions as input dimensions a 3

so please guide me as examples in docs only shows same input output dimensions