{"action":"created","issue":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4760","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4760/labels{/name}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4760/comments","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4760/events","html_url":"https://github.com/scikit-learn/scikit-learn/issues/4760","id":79440871,"number":4760,"title":"is random_state in LogisticRegression useless ?","user":{"login":"TomDLT","id":11065596,"avatar_url":"https://avatars.githubusercontent.com/u/11065596?v=3","gravatar_id":"","url":"https://api.github.com/users/TomDLT","html_url":"https://github.com/TomDLT","followers_url":"https://api.github.com/users/TomDLT/followers","following_url":"https://api.github.com/users/TomDLT/following{/other_user}","gists_url":"https://api.github.com/users/TomDLT/gists{/gist_id}","starred_url":"https://api.github.com/users/TomDLT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomDLT/subscriptions","organizations_url":"https://api.github.com/users/TomDLT/orgs","repos_url":"https://api.github.com/users/TomDLT/repos","events_url":"https://api.github.com/users/TomDLT/events{/privacy}","received_events_url":"https://api.github.com/users/TomDLT/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-05-22T12:41:48Z","updated_at":"2015-05-27T13:44:51Z","closed_at":null,"body":"In `LogisticRegression`:\r\n- the constructor adds a parameter `random_state` that is never used\r\n- the solver `'liblinear'` has a `random_state` optional parameter, but it is not used.\r\n\r\nI tried wiring correctly the parameter `random_state` to the solver, and tested it with multiple configurations, but I never obtained different results for different `random_state` values.\r\n\r\n_\r\nNote that the previous test was twice useless (the parameter was not wired, and seems not to change the result)\r\n````Python\r\ndef test_liblinear_random_state():\r\n    X, y = make_classification(n_samples=20)\r\n    lr1 = LogisticRegression(random_state=0)\r\n    lr1.fit(X, y)\r\n    lr2 = LogisticRegression(random_state=0)\r\n    lr2.fit(X, y)\r\n    assert_array_almost_equal(lr1.coef_, lr2.coef_)\r\n```\r\n\r\nPlease note also that new solver `'sag'` (#4738) will require a 'random_state` parameter."},"comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/105916029","html_url":"https://github.com/scikit-learn/scikit-learn/issues/4760#issuecomment-105916029","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/4760","id":105916029,"user":{"login":"TomDLT","id":11065596,"avatar_url":"https://avatars.githubusercontent.com/u/11065596?v=3","gravatar_id":"","url":"https://api.github.com/users/TomDLT","html_url":"https://github.com/TomDLT","followers_url":"https://api.github.com/users/TomDLT/followers","following_url":"https://api.github.com/users/TomDLT/following{/other_user}","gists_url":"https://api.github.com/users/TomDLT/gists{/gist_id}","starred_url":"https://api.github.com/users/TomDLT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomDLT/subscriptions","organizations_url":"https://api.github.com/users/TomDLT/orgs","repos_url":"https://api.github.com/users/TomDLT/repos","events_url":"https://api.github.com/users/TomDLT/events{/privacy}","received_events_url":"https://api.github.com/users/TomDLT/received_events","type":"User","site_admin":false},"created_at":"2015-05-27T13:44:51Z","updated_at":"2015-05-27T13:44:51Z","body":"> Print the value of the first random number to check it's different.\r\n\r\nTested : In `linear.cpp`, the `rand()` function is deterministic, and depends of the random state given in `LogisticRegression`. This proves that the seed is correctly passed to liblinear C solver.\r\n"}}