Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixture Density example #977

Open
eraly opened this issue Apr 27, 2020 · 0 comments
Open

Mixture Density example #977

eraly opened this issue Apr 27, 2020 · 0 comments

Comments

@eraly
Copy link
Contributor

eraly commented Apr 27, 2020

From stack overflow here

I have built and trained a Mixed Density Network with Keras mostly following this medium post which contains an implementation of the mean negative log-likelihood to be used as the loss function. Now I want to load the trained model (both the structure of the net and the weights) on DL4J to serve the predictions but I get the runtime error: UnsupportedKerasConfigurationException: Unknown Keras loss function.

I was expecting this since the loss function isn't embedded in Keras, however I see DL4J has it's own LossMixtureDensity for this purpose, contained in the package org.deeplearning4j.nn.modelimport.keras.utils, but I don't know how to bind my custom loss function to it. Is there any way to do it?

As a second choice alternative, I was thinking about writing a "twin" MDN directly in DL4J and then just loading the trained weights, but it's my first time with DL4J and I'm not sure on how to do it: my output layer concatenates the coefficients of the mixture, the means and standard deviations with different activation functions, while the example provided in the deeplearning4j-examples repository seems to use a simple identity activation. Honestly I can't even understand how the example can work without e.g. imposing a softmax activation for the mixing coefficients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant