{"action":"opened","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/868","labels_url":"https://api.github.com/repos/fchollet/keras/issues/868/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/868/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/868/events","html_url":"https://github.com/fchollet/keras/issues/868","id":112669236,"number":868,"title":"Using custom loss function with model_from_json","user":{"login":"jpeg729","id":3158606,"avatar_url":"https://avatars.githubusercontent.com/u/3158606?v=3","gravatar_id":"","url":"https://api.github.com/users/jpeg729","html_url":"https://github.com/jpeg729","followers_url":"https://api.github.com/users/jpeg729/followers","following_url":"https://api.github.com/users/jpeg729/following{/other_user}","gists_url":"https://api.github.com/users/jpeg729/gists{/gist_id}","starred_url":"https://api.github.com/users/jpeg729/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpeg729/subscriptions","organizations_url":"https://api.github.com/users/jpeg729/orgs","repos_url":"https://api.github.com/users/jpeg729/repos","events_url":"https://api.github.com/users/jpeg729/events{/privacy}","received_events_url":"https://api.github.com/users/jpeg729/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-21T20:09:41Z","updated_at":"2015-10-21T20:09:41Z","closed_at":null,"body":"It doesn't work.\r\n```\r\nTraceback (most recent call last):\r\n  File \"myFile.py\", line 100, in <module>\r\n    model = model_from_json(open('savefile.json').read())\r\n  File \"build/bdist.linux-x86_64/egg/keras/models.py\", line 116, in model_from_json\r\n  File \"build/bdist.linux-x86_64/egg/keras/models.py\", line 142, in model_from_config\r\n  File \"build/bdist.linux-x86_64/egg/keras/models.py\", line 346, in compile\r\n  File \"build/bdist.linux-x86_64/egg/keras/objectives.py\", line 64, in get\r\n  File \"build/bdist.linux-x86_64/egg/keras/utils/generic_utils.py\", line 12, in get_from_module\r\nException: Invalid objective: custom_loss_function\r\n```\r\n\r\nIt is obviously trying to load the loss function from the relevant keras module, and not finding it.\r\n\r\nHow about adding some parameters to model.model_from_json? Something like `model.model_from_json(\"savefile.json\", loss=my_custom_loss_function)` would be great.\r\n\r\nMore generally though, maybe we should add the possibility of giving a dictionary of named functions for all the custom functions the model might use: activation, loss, optimizer, ..."}}