{"action":"closed","issue":{"url":"https://api.github.com/repos/oppia/oppia/issues/4166","repository_url":"https://api.github.com/repos/oppia/oppia","labels_url":"https://api.github.com/repos/oppia/oppia/issues/4166/labels{/name}","comments_url":"https://api.github.com/repos/oppia/oppia/issues/4166/comments","events_url":"https://api.github.com/repos/oppia/oppia/issues/4166/events","html_url":"https://github.com/oppia/oppia/issues/4166","id":280401083,"node_id":"MDU6SXNzdWUyODA0MDEwODM=","number":4166,"title":"SVMPredictionService makes incorrect predictions for TextInput when following libsvm's approach.","user":{"login":"anmolshkl","id":6338799,"node_id":"MDQ6VXNlcjYzMzg3OTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6338799?v=4","gravatar_id":"","url":"https://api.github.com/users/anmolshkl","html_url":"https://github.com/anmolshkl","followers_url":"https://api.github.com/users/anmolshkl/followers","following_url":"https://api.github.com/users/anmolshkl/following{/other_user}","gists_url":"https://api.github.com/users/anmolshkl/gists{/gist_id}","starred_url":"https://api.github.com/users/anmolshkl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anmolshkl/subscriptions","organizations_url":"https://api.github.com/users/anmolshkl/orgs","repos_url":"https://api.github.com/users/anmolshkl/repos","events_url":"https://api.github.com/users/anmolshkl/events{/privacy}","received_events_url":"https://api.github.com/users/anmolshkl/received_events","type":"User","site_admin":false},"labels":[{"id":383795018,"node_id":"MDU6TGFiZWwzODM3OTUwMTg=","url":"https://api.github.com/repos/oppia/oppia/labels/frontend","name":"frontend","color":"d4c5f9","default":false},{"id":309197616,"node_id":"MDU6TGFiZWwzMDkxOTc2MTY=","url":"https://api.github.com/repos/oppia/oppia/labels/needs%20debugging","name":"needs debugging","color":"efffaf","default":false},{"id":528004103,"node_id":"MDU6TGFiZWw1MjgwMDQxMDM=","url":"https://api.github.com/repos/oppia/oppia/labels/talk-to:%20@anmolshkl","name":"talk-to: @anmolshkl","color":"eeeeee","default":false}],"state":"closed","locked":false,"assignee":{"login":"prasanna08","id":8678373,"node_id":"MDQ6VXNlcjg2NzgzNzM=","avatar_url":"https://avatars0.githubusercontent.com/u/8678373?v=4","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false},"assignees":[{"login":"prasanna08","id":8678373,"node_id":"MDQ6VXNlcjg2NzgzNzM=","avatar_url":"https://avatars0.githubusercontent.com/u/8678373?v=4","gravatar_id":"","url":"https://api.github.com/users/prasanna08","html_url":"https://github.com/prasanna08","followers_url":"https://api.github.com/users/prasanna08/followers","following_url":"https://api.github.com/users/prasanna08/following{/other_user}","gists_url":"https://api.github.com/users/prasanna08/gists{/gist_id}","starred_url":"https://api.github.com/users/prasanna08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasanna08/subscriptions","organizations_url":"https://api.github.com/users/prasanna08/orgs","repos_url":"https://api.github.com/users/prasanna08/repos","events_url":"https://api.github.com/users/prasanna08/events{/privacy}","received_events_url":"https://api.github.com/users/prasanna08/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2017-12-08T07:42:54Z","updated_at":"2018-10-08T04:15:19Z","closed_at":"2018-10-08T04:15:19Z","author_association":"CONTRIBUTOR","body":"SVMPredictionService is unable to make correct predictions and achieves a below par accuracy of 12% for TextInputPredictionServiceSpec, whereas the Python implementation (scikit) achieves an accuracy of nearly 89%. However, upon modifying [`sum -= intercept[p]`](https://github.com/anmolshkl/oppia/blob/f11c34e1404c96dfd8ccc5e35a3ca1dd6ae2e286/extensions/classifiers/SVMPredictionService.js#L107)  to `sum += intercept[p]`, it works perfectly fine and is able to achieve 89% test accuracy for TextInputPredictionServiceSpec. It should be noted that libsvm (i.e. the c++ implementation for SVC algorithm) uses [`sum -= model->rho[p]`](https://github.com/cjlin1/libsvm/blob/master/svm.cpp#L2555). It could be the case that libsvm or scikit (which uses libsvm) manipulates `rho` (or intercept) to have an opposite sign somewhere in the code and uses \"-\" instead of \"+\". This needs to be investigated."}}
{"actor":{"display_login":"seanlip"}}