Harry-Westwood / Y4-Project-InterNeuralStellar

Bayesian Hierarchical Modelling and Machine Learning of Stellar Populations
1 stars 0 forks source link

Figured out how to extract weights and set them again #21

Closed Harry-Westwood closed 4 years ago

Harry-Westwood commented 4 years ago

@grd349 model.get_weights() returns a 2D array where the first column is weights and the second is biases. model.set_weights() takes a 2D array and changes all the weights and biases accordingly.

For example: a = np.array(model.get_weights()) model.set_weights(a)

Using this to save weights at the end of some training, the model could then be recompiled with a different learning rate, and then training could continue.

model.save_weights(), also exists but I haven't looked into it to see its functionality.

grd349 commented 4 years ago

That's super - thanks @Harry-Westwood Excellent job!