<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Let's copy the LSTM model into a new model and transfer the weights
Step1:  So it works with LSTM!
Trained accuracy 51%, copied accuracy 51%
Let's try it with JZS1 then!
<ASSISTANT_TASK:>
Python Code:
lstmcopy = model_from_yaml(lstmyaml)
print(lstmcopy.evaluate(trainX,trainy,show_accuracy=True))
lstmweights=lstmmodel.get_weights()
lstmcopy.set_weights(lstmweights)
print("Original:", lstmmodel.evaluate(trainX,trainy,show_accuracy=True))
print("Copy:",lstmcopy.evaluate(trainX,trainy,show_accuracy=True))
Explanation: Let's copy the LSTM model into a new model and transfer the weights
End of explanation
jzs1model = Sequential()
jzs1model.add(JZS1(33,60, return_sequences=True))
jzs1model.add(JZS1(60,60))
jzs1model.add(Dense(60,33))
jzs1model.compile(optimizer=SGD(lr=0.1,momentum=0.8),loss='mse',class_mode="categorical")
print("Initial loss")
print(jzs1model.evaluate(trainX,trainy,show_accuracy=True))
print("Training")
import time
start=time.time()
jzs1model.fit(trainX,trainy,nb_epoch = 5, show_accuracy=True,verbose=1)
print("Turning verbose off and training 100 epochs, this will take approx.", 20*(time.time()-start),"seconds")
from sys import stdout
stdout.flush()
jzs1model.fit(trainX,trainy,nb_epoch = 100, show_accuracy=True,verbose=0)
print("New loss")
print(jzs1model.evaluate(trainX,trainy,show_accuracy=True))
jzs1yaml=jzs1model.to_yaml()
print(jzs1yaml)
jzs1copy = model_from_yaml(jzs1yaml)
print("Untrained:",jzs1copy.evaluate(trainX,trainy,show_accuracy=True))
jzs1weights = jzs1model.get_weights()
jzs1copy.set_weights(jzs1weights)
print("Original:", jzs1model.evaluate(trainX,trainy,show_accuracy=True))
print("Copy:",jzs1copy.evaluate(trainX,trainy,show_accuracy=True))
Explanation: So it works with LSTM!
Trained accuracy 51%, copied accuracy 51%
Let's try it with JZS1 then!
End of explanation
<END_TASK>