{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/1886","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/1886/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/1886/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/1886/events","html_url":"https://github.com/fchollet/keras/pull/1886","id":138290739,"number":1886,"title":"implement one-hot encoding in the backend + related objective function","user":{"login":"cmyr","id":3330916,"avatar_url":"https://avatars.githubusercontent.com/u/3330916?v=3","gravatar_id":"","url":"https://api.github.com/users/cmyr","html_url":"https://github.com/cmyr","followers_url":"https://api.github.com/users/cmyr/followers","following_url":"https://api.github.com/users/cmyr/following{/other_user}","gists_url":"https://api.github.com/users/cmyr/gists{/gist_id}","starred_url":"https://api.github.com/users/cmyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmyr/subscriptions","organizations_url":"https://api.github.com/users/cmyr/orgs","repos_url":"https://api.github.com/users/cmyr/repos","events_url":"https://api.github.com/users/cmyr/events{/privacy}","received_events_url":"https://api.github.com/users/cmyr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-03T20:38:17Z","updated_at":"2016-03-03T23:43:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fchollet/keras/pulls/1886","html_url":"https://github.com/fchollet/keras/pull/1886","diff_url":"https://github.com/fchollet/keras/pull/1886.diff","patch_url":"https://github.com/fchollet/keras/pull/1886.patch"},"body":"This is a possible implementation for allowing training with scalar (non-binary-matrix/one-hot) targets, by passing a custom objective and doing one-hot encoding on the fly in the backend. For this to work I've had to add a new argument to `model.compile`, so I thought I'd see if this would be useful to anyone else, or if anyone knew of a better way to achieve this. It's working, but could use a bit more documentation and there are probably a few tests missing.\r\n\r\nThis was my first time really digging into both theano and tensorflow, so please let me know if anything looks especially weird / unidiomatic. :smiley: \r\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/192023183","html_url":"https://github.com/fchollet/keras/pull/1886#issuecomment-192023183","issue_url":"https://api.github.com/repos/fchollet/keras/issues/1886","id":192023183,"user":{"login":"cmyr","id":3330916,"avatar_url":"https://avatars.githubusercontent.com/u/3330916?v=3","gravatar_id":"","url":"https://api.github.com/users/cmyr","html_url":"https://github.com/cmyr","followers_url":"https://api.github.com/users/cmyr/followers","following_url":"https://api.github.com/users/cmyr/following{/other_user}","gists_url":"https://api.github.com/users/cmyr/gists{/gist_id}","starred_url":"https://api.github.com/users/cmyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmyr/subscriptions","organizations_url":"https://api.github.com/users/cmyr/orgs","repos_url":"https://api.github.com/users/cmyr/repos","events_url":"https://api.github.com/users/cmyr/events{/privacy}","received_events_url":"https://api.github.com/users/cmyr/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T23:43:02Z","updated_at":"2016-03-03T23:43:02Z","body":"Been thinking about this a bit more, and realized one option that avoids having a new compile flag would be to do like `np.expand_dims(y)` on our 2-D targets. Not sure if this has any consequences I'm not thinking of?\r\n\r\nAlso now thinking about how this would work with the `standardize_weights` function."}}