OdysseasKr / neural-disaggregator

Code for NILM experiments using Neural Networks. Uses Keras/Tensorflow and the NILMTK.
MIT License
138 stars 57 forks source link

I'm not good at programming. I hope you can give me some guidance #35

Open chowlay1996 opened 4 years ago

chowlay1996 commented 4 years ago

Hello! Thank you for your contribution. I would like to know how to add loss visualization function in RNN network. I would like to observe its fitting

OdysseasKr commented 4 years ago

Hello!

Since the models are built using Keras, you can get easily get the loss value per epoch. The model.fit function returns a History object containing all losses. You can then plot them with a few modifications in the code.

You can take a look at this blog post from Machine Learning Mastery that explains the whole process.

chowlay1996 commented 4 years ago

Thank you very much

chowlay1996 commented 4 years ago

I have learned this blog, but model.fit () requires numpy Array or List for data types of X and y. Train_mains, train_meter in your code does not belong to this type. How can I transform the type

OdysseasKr commented 4 years ago

In order to work with the Keras function, you need to modify the RNN disaggregator, not just the code that calls it.

Take a look at https://github.com/OdysseasKr/neural-disaggregator/blob/master/RNN/rnndisaggregator.py#L95 for the RNN.

This line

self.model.fit(mainchunk, meterchunk, epochs=epochs, batch_size=batch_size, shuffle=True)

receives two numpy arrays (mainchunk and meterchunk). This function returns the history object that you can use.

chowlay1996 commented 4 years ago

I'd appreciate you for your help