Open bstellato opened 5 years ago
So I was running this and got a runtime warning:
RuntimeWarning: overflow encountered in exp
normalized_outputs = np.reciprocal(1 + np.exp(-outputs)) # Normalize using sigmoid
It's still running so I can't confirm, but I think the issue might be here: https://github.com/bstellato/mlopt/blob/develop_learner_multilabel/mlopt/learners/pytorch/pytorch.py#L92 https://github.com/bstellato/mlopt/blob/develop_learner_multilabel/mlopt/learners/pytorch/pytorch.py#L104
Unlike the one-hot case, I need to wrap the sigmoid around the net outputs to get 0-1s: https://github.com/bstellato/mlopt/blob/develop_learner_multilabel/mlopt/learners/pytorch/pytorch.py#L299 which is not being done before the calls to the MSE function.
I think it is just a warning. A solution could be this little trick which needs to be adapted to the vectorized case. Another solution is to silence that working inside the function call. In any case it should not affect the output of your code.
Add option to have multiple labels in the PyTorch learner. This is helpful when the strategy for the integer variables corresponds to the actual integer variables vector. (Similar holds for active constraints).
This PR also adds the
n_layers
as parameter.TODO
onehot
flag to initialize learner. This also adapts the learner cost function.onehot
encoding or the multiple labels for active constraints and integer variables.