Comments (14)
Max is now 20.
from cond_rnn.
Okay I pushed 3.2.1. Make sure your version is not python 3.11. I tested it with python3.8 and it works great.
!pip install --upgrade cond-rnn
from cond_rnn.
The following is the complete code modified by the test_con_rnn.py.
def create_conditions(NUM_SAMPLES, NUM_CLASSES):
conditions = np.zeros(shape=[NUM_SAMPLES, NUM_CLASSES])
for i, kk in enumerate(conditions):
kk[i % NUM_CLASSES] = 1
return conditions
def main():
i = Input(shape=[time_steps, input_dim], name='input_0')
c1 = Input(shape=[num_classes], name='input_1')
c2 = Input(shape=[num_classes], name='input_2')
c3 = Input(shape=[num_classes], name='input_3')
c4 = Input(shape=[num_classes], name='input_4')
c5 = Input(shape=[num_classes], name='input_5')
c6 = Input(shape=[num_classes], name='input_6')
c7 = Input(shape=[num_classes], name='input_7')
c8 = Input(shape=[num_classes], name='input_8')
c9 = Input(shape=[num_classes], name='input_9')
c10 = Input(shape=[num_classes], name='input_10')
# c11 = Input(shape=[num_classes], name='input_11')
# add the condition tensor here.
x = ConditionalRecurrent(LSTM(num_cells, return_sequences=True, name='cond_rnn_0'))([i,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10])
# and here too.
x = ConditionalRecurrent(LSTM(num_cells, return_sequences=False, name='cond_rnn_1'))([x,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10])
x = Dense(units=num_classes, activation='softmax')(x)
model = Model(inputs=[i,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10], outputs=[x])
# Define data.
test_inputs = np.random.uniform(size=(num_samples, time_steps, input_dim))
test_con = test_targets = create_conditions(num_samples, num_classes)
#print(test_con)
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(verbose=2, x = [test_inputs,test_con,test_con,test_con,test_con
,test_con,test_con,test_con,test_con,test_con,test_con], y=test_targets, epochs=10)
pred1 = model.predict([test_inputs,test_con,test_con,test_con,test_con
,test_con,test_con,test_con,test_con,test_con,test_con])
#print(pred1)
num_samples = 10
input_dim = 1
num_classes = 3
time_steps = 10
num_cells = 6
if __name__ == '__main__':
main()
from cond_rnn.
@hsinyuku oh yeah in the code I put 10 as the max number of conditions. I can increase it to 20.
from cond_rnn.
from cond_rnn.
@hsinyuku it's purely arbitrary. I will increase it now. Hang on.
from cond_rnn.
I pushed in in version 3.2.0 ;)
from cond_rnn.
from cond_rnn.
A stupid question: How can I get this new version. I am using !pip install in Colab. I re-installed but nothing changed
from cond_rnn.
!pip install --upgrade cond-rnn
should work.
from cond_rnn.
I tried first uninstall and install with upgrade as you suggested already. In the log it shows the following. You can see in the last 3 lines that it started by using 3.2.0 and then going back to 3.1.1.
In the end, the installed version is still 3.1.1 when I checked by !pip show cond-rnn
Found existing installation: cond-rnn 3.1.1
Uninstalling cond-rnn-3.1.1:
Would remove:
/usr/local/lib/python3.8/dist-packages/cond_rnn-3.1.1.dist-info/*
/usr/local/lib/python3.8/dist-packages/cond_rnn/*
Proceed (y/n)? y
Successfully uninstalled cond-rnn-3.1.1
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting cond-rnn
Using cached cond_rnn-3.2.0-py3-none-any.whl (7.1 kB)
Requirement already satisfied: protobuf<=3.20 in /usr/local/lib/python3.8/dist-packages (from cond-rnn) (3.19.6)
Using cached cond_rnn-3.1.1-py3-none-any.whl
from cond_rnn.
@hsinyuku my bad I think I know why. Give me a few minutes.
from cond_rnn.
Success !!! Thank you. I really appreciate your prompt response <3 Thank you also for the great package with clear explanation, example and easy to be used design. Love it.
from cond_rnn.
@hsinyuku Happy to hear that!! Thank you!!
from cond_rnn.
Related Issues (20)
- Dummy stations example HOT 3
- Sequential vs Functional API. Drop in model accuracy HOT 3
- Question on conditions HOT 5
- Bidirectional LSTM HOT 12
- Failed to load model with CondRNN layer HOT 1
- Question on processing time-series text data HOT 1
- [QUESTION] how to predicting future unseen dataframe? HOT 4
- [QUESTION]
- [QUESTION] Difference between ConditionalRNN and Other Approach HOT 10
- ConditionalRNN or ConditionalRecurrent? HOT 8
- Bidirectional Layer with Functional API HOT 8
- Basic conditional LSTM HOT 2
- Embeding Layer with ConditionalRecurrent HOT 3
- Simple LSTM HOT 7
- CondLSTM with Embedding layer HOT 12
- Confusion between conditions? HOT 6
- Adding dropout layer to stacked conditional RNNs HOT 1
- Installation issue HOT 3
- what does the static data shape? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cond_rnn.