e2e-model-learning
e2e-model-learning copied to clipboard
The NLL loss function in the newsvendor task is wrongly used.
The NLL loss function in the newsvendor task is wrongly used. NLLLoss() (in PyTorch) expects a log-probability as input. But your code sends the raw probability into it. So it is actually minimizing -sum pi. instead of minimizing - sum log(pi). Though this weird loss can still kind of maximize the likelihood, it is different from your description. This happens in your task_net and mle_net.
Another bug: your main.py for "# Nonlinear MLE net" actually is doing linear MLE net. You need to send the parameter "is_nonlinear=True".