Fix initialize method for net: only initialize weight and bias if it is None, enabling transfer/continuous learning. This feature is already possible in the previous version since net.compile method was previously separated. In this version, it can be used as follows:
model = smash.Model(*smash.factory.load_dataset("lez"))
ret = model.optimize("ann",
optimize_options={"termination_crit": dict(epochs=10), "random_state":11},
return_options={"net": True}) # pre-train the neural network
net = ret.net.copy() # net is now the pre-trained model
net.set_trainable([0,0,0,0,1,0,0]) # set trainable layers
ret2 = model.optimize("ann",
optimize_options={"net": net, "termination_crit": dict(epochs=50)},
return_options={"net": True}) # continuous learning
Fix set_trainable method: do not update weight and bias when trainable is set to False.