{
  "id": 70127,
  "title": "Error Importing Sklearn Cross_Validation",
  "url": "/competitions/PLAsTiCC-2018/discussion/70127",
  "author_name": "",
  "post_date": "2018-10-31T04:02:46.123204800Z",
  "votes": 12,
  "comment_count": 32,
  "views": 0,
  "content": "<p>Hello, \nIs anyone getting an error when importing the cross validation module?</p>\n\n<p><code>\nfrom sklearn.cross_validation import train_test_split\n</code></p>\n\n<hr>\n\n<p>ModuleNotFoundError                       Traceback (most recent call last)\n in ()\n      7 \n      8 from sklearn import metrics\n----&gt; 9 from sklearn.cross_validation import train_test_split\n     10 from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier\n     11 </p>\n\n<p>ModuleNotFoundError: No module named 'sklearn.cross_validation'</p>",
  "messages": [
    {
      "id": "412963",
      "postDate": "10/31/2018 04:02:46",
      "content": "<p>Hello, \nIs anyone getting an error when importing the cross validation module?</p>\n\n<p><code>\nfrom sklearn.cross_validation import train_test_split\n</code></p>\n\n<hr>\n\n<p>ModuleNotFoundError                       Traceback (most recent call last)\n in ()\n      7 \n      8 from sklearn import metrics\n----&gt; 9 from sklearn.cross_validation import train_test_split\n     10 from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier\n     11 </p>\n\n<p>ModuleNotFoundError: No module named 'sklearn.cross_validation'</p>",
      "rawMarkdown": "Hello, \nIs anyone getting an error when importing the cross validation module?\n\n```\nfrom sklearn.cross_validation import train_test_split\n```\n\n\n---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)",
      "votes": null
    },
    {
      "id": "412967",
      "postDate": "10/31/2018 04:08:33",
      "content": "<p>The module is sklearn.model_selection afaik <a href=\"http://scikit-learn.org/stable/modules/cross_validation.html\">http://scikit-learn.org/stable/modules/cross_validation.html</a></p>",
      "rawMarkdown": "The module is sklearn.model_selection afaik http://scikit-learn.org/stable/modules/cross_validation.html",
      "votes": null
    },
    {
      "id": "412970",
      "postDate": "10/31/2018 04:18:41",
      "content": "<p>I was surprised cause it worker earlier today and then just stopped. Either way, thanks for the solution!</p>",
      "rawMarkdown": "I was surprised cause it worker earlier today and then just stopped. Either way, thanks for the solution!",
      "votes": null
    },
    {
      "id": "413044",
      "postDate": "10/31/2018 07:42:30",
      "content": "<p>Use sklearn.model_selection instead of sklearn.cross_validation reason is in new version of sklearn cross_validation is changed to model_selection \nA small request please reply if this answer helps u .Thank You</p>",
      "rawMarkdown": "Use sklearn.model_selection instead of sklearn.cross_validation reason is in new version of sklearn cross_validation is changed to model_selection \nA small request please reply if this answer helps u .Thank You",
      "votes": null
    },
    {
      "id": "413062",
      "postDate": "10/31/2018 08:13:26",
      "content": "<p>sklearn must have been updated to a more recent version, that's all.</p>",
      "rawMarkdown": "sklearn must have been updated to a more recent version, that's all.",
      "votes": null
    },
    {
      "id": "413186",
      "postDate": "10/31/2018 12:40:10",
      "content": "<p>I can't find in the change log which version cross_validation module was removed but looks like model_selection module was introduced in version 0.18 so guessing cross_validation module was deprecated and removed not so long after that. There is a GH issue related to it here <a href=\"https://github.com/scikit-learn/scikit-learn/issues/6161\">https://github.com/scikit-learn/scikit-learn/issues/6161</a></p>",
      "rawMarkdown": "I can't find in the change log which version cross_validation module was removed but looks like model_selection module was introduced in version 0.18 so guessing cross_validation module was deprecated and removed not so long after that. There is a GH issue related to it here https://github.com/scikit-learn/scikit-learn/issues/6161",
      "votes": null
    },
    {
      "id": "443353",
      "postDate": "12/21/2018 13:32:08",
      "content": "<p>Thanks. Apparently, it's under model_selection. Been tearing my head apart all day.</p>",
      "rawMarkdown": "Thanks. Apparently, it's under model_selection. Been tearing my head apart all day.",
      "votes": null
    },
    {
      "id": "444227",
      "postDate": "12/23/2018 15:30:22",
      "content": "<p>Thanks for your post. It worked for me now.</p>",
      "rawMarkdown": "Thanks for your post. It worked for me now.",
      "votes": null
    },
    {
      "id": "460124",
      "postDate": "01/23/2019 03:32:00",
      "content": "<p>The former code \"from sklearn.cross_validation import train_test_split\" has deprecated. The new one is below. I had the same problem, now it's gone.</p>\n\n<p>\"from sklearn.model_selection import train_test_split\"</p>",
      "rawMarkdown": "The former code \"from sklearn.cross_validation import train_test_split\" has deprecated. The new one is below. I had the same problem, now it's gone.\n\n\"from sklearn.model_selection import train_test_split\"",
      "votes": null
    },
    {
      "id": "467026",
      "postDate": "02/06/2019 11:01:31",
      "content": "<p>Friends,</p>\n\n<p>Thanks for the suggestion!\nThe below changes has worked for me.\nfrom sklearn.model_selection import train_test_split.</p>",
      "rawMarkdown": "Friends,\n\nThanks for the suggestion!\nThe below changes has worked for me.\nfrom sklearn.model_selection import train_test_split.",
      "votes": null
    },
    {
      "id": "480731",
      "postDate": "02/28/2019 15:36:52",
      "content": "<p>yes it does tyvm</p>",
      "rawMarkdown": "yes it does tyvm",
      "votes": null
    },
    {
      "id": "485430",
      "postDate": "03/07/2019 11:27:53",
      "content": "<p>use model_selection instead of cross_validation for splitting data into training set and test set.\nuse this-(from sklearn.model_selection import train_test_split)</p>",
      "rawMarkdown": "use model_selection instead of cross_validation for splitting data into training set and test set.\nuse this-(from sklearn.model_selection import train_test_split)",
      "votes": null
    },
    {
      "id": "508594",
      "postDate": "04/06/2019 12:54:30",
      "content": "<p>Wow man thanks a lot. Can I get your number. You are just amazing. Please give your number so that I can ask you few doubts like this..</p>",
      "rawMarkdown": "Wow man thanks a lot. Can I get your number. You are just amazing. Please give your number so that I can ask you few doubts like this..",
      "votes": null
    },
    {
      "id": "524387",
      "postDate": "04/28/2019 16:45:26",
      "content": "<p>hey it's not working for me</p>",
      "rawMarkdown": "hey it's not working for me",
      "votes": null
    },
    {
      "id": "533066",
      "postDate": "05/18/2019 11:18:42",
      "content": "<p>Thank You!!!</p>",
      "rawMarkdown": "Thank You!!!",
      "votes": null
    },
    {
      "id": "582684",
      "postDate": "07/23/2019 12:54:38",
      "content": "<p>it might be sklearn.model_selection. But anyway, your reply really helps me.</p>",
      "rawMarkdown": "it might be sklearn.model_selection. But anyway, your reply really helps me.",
      "votes": null
    },
    {
      "id": "588883",
      "postDate": "07/31/2019 07:23:29",
      "content": "<p>thanks</p>",
      "rawMarkdown": "thanks",
      "votes": null
    },
    {
      "id": "591145",
      "postDate": "08/03/2019 07:58:14",
      "content": "<p>it is nor working to me too</p>",
      "rawMarkdown": "it is nor working to me too",
      "votes": null
    },
    {
      "id": "597418",
      "postDate": "08/12/2019 10:20:48",
      "content": "",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "604140",
      "postDate": "08/21/2019 04:46:22",
      "content": "<p>Yes, It was deprecated from 0.17.1 and removed in the latest version. We have use <strong>sklearn.model_selection import train_test_split</strong></p>",
      "rawMarkdown": "Yes, It was deprecated from 0.17.1 and removed in the latest version. We have use **sklearn.model_selection import train_test_split**",
      "votes": null
    },
    {
      "id": "609229",
      "postDate": "08/27/2019 14:18:00",
      "content": "<p>Thank u soo muchh asaad bhai...ur solution made my work done....Thanks a lottttttt</p>",
      "rawMarkdown": "Thank u soo muchh asaad bhai...ur solution made my work done....Thanks a lottttttt",
      "votes": null
    },
    {
      "id": "609234",
      "postDate": "08/27/2019 14:19:26",
      "content": "<p>*<em>please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...</em>*I would be very grateful to you</p>",
      "rawMarkdown": "**please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...**I would be very grateful to you",
      "votes": null
    },
    {
      "id": "609235",
      "postDate": "08/27/2019 14:19:36",
      "content": "<p>*<em>please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...</em>*I would be very grateful to you</p>",
      "rawMarkdown": "**please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...**I would be very grateful to you",
      "votes": null
    },
    {
      "id": "659717",
      "postDate": "10/28/2019 06:39:38",
      "content": "<p>me too..for two days i am breaking my head for this..finally got to know we need to use model_selection</p>",
      "rawMarkdown": "me too..for two days i am breaking my head for this..finally got to know we need to use model_selection",
      "votes": null
    },
    {
      "id": "661955",
      "postDate": "10/30/2019 23:03:53",
      "content": "<p>gracias parcero</p>",
      "rawMarkdown": "gracias parcero",
      "votes": null
    },
    {
      "id": "754131",
      "postDate": "02/23/2020 05:02:54",
      "content": "<p>thank you so much dude</p>",
      "rawMarkdown": "thank you so much dude",
      "votes": null
    },
    {
      "id": "817205",
      "postDate": "04/23/2020 00:10:07",
      "content": "<p>much appreciated!</p>",
      "rawMarkdown": "much appreciated!",
      "votes": null
    },
    {
      "id": "845578",
      "postDate": "05/13/2020 09:42:51",
      "content": "<p>Thanks \nThis works</p>",
      "rawMarkdown": "Thanks \nThis works",
      "votes": null
    },
    {
      "id": "920246",
      "postDate": "07/08/2020 13:05:00",
      "content": "<p>Finally a <em>working</em> solution, Thanks!</p>",
      "rawMarkdown": "Finally a *working* solution, Thanks!",
      "votes": null
    },
    {
      "id": "936463",
      "postDate": "07/20/2020 08:34:08",
      "content": "<p>NameError: name 'sklearn' is not defined</p>\n<p>Can anyone help with this?</p>",
      "rawMarkdown": "NameError: name 'sklearn' is not defined\n \nCan anyone help with this?",
      "votes": null
    },
    {
      "id": "1043989",
      "postDate": "10/09/2020 11:58:35",
      "content": "<p>Thanks a lot buddy</p>",
      "rawMarkdown": "Thanks a lot buddy",
      "votes": null
    },
    {
      "id": "1286162",
      "postDate": "04/27/2021 16:14:05",
      "content": "<p>Thank you so much it worked for me :)</p>",
      "rawMarkdown": "Thank you so much it worked for me :)",
      "votes": null
    },
    {
      "id": "1286163",
      "postDate": "04/27/2021 16:14:05",
      "content": "<p>Thank you so much it worked for me :)</p>",
      "rawMarkdown": "Thank you so much it worked for me :)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 936463,
      "author_name": "aienjoyai",
      "author_url": "",
      "post_date": "07/20/2020 08:34:08",
      "content": "<p>NameError: name 'sklearn' is not defined</p>\n<p>Can anyone help with this?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 1043989,
      "author_name": "scientistshubham",
      "author_url": "",
      "post_date": "10/09/2020 11:58:35",
      "content": "<p>Thanks a lot buddy</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 412967,
      "author_name": "jackvial",
      "author_url": "",
      "post_date": "10/31/2018 04:08:33",
      "content": "<p>The module is sklearn.model_selection afaik <a href=\"http://scikit-learn.org/stable/modules/cross_validation.html\">http://scikit-learn.org/stable/modules/cross_validation.html</a></p>",
      "votes": null,
      "replies": [
        {
          "id": 412970,
          "author_name": "dannyk2018",
          "author_url": "",
          "post_date": "10/31/2018 04:18:41",
          "content": "<p>I was surprised cause it worker earlier today and then just stopped. Either way, thanks for the solution!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 413062,
          "author_name": "cpmpml",
          "author_url": "",
          "post_date": "10/31/2018 08:13:26",
          "content": "<p>sklearn must have been updated to a more recent version, that's all.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 413186,
          "author_name": "jackvial",
          "author_url": "",
          "post_date": "10/31/2018 12:40:10",
          "content": "<p>I can't find in the change log which version cross_validation module was removed but looks like model_selection module was introduced in version 0.18 so guessing cross_validation module was deprecated and removed not so long after that. There is a GH issue related to it here <a href=\"https://github.com/scikit-learn/scikit-learn/issues/6161\">https://github.com/scikit-learn/scikit-learn/issues/6161</a></p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 413044,
      "author_name": "asad76",
      "author_url": "",
      "post_date": "10/31/2018 07:42:30",
      "content": "<p>Use sklearn.model_selection instead of sklearn.cross_validation reason is in new version of sklearn cross_validation is changed to model_selection \nA small request please reply if this answer helps u .Thank You</p>",
      "votes": null,
      "replies": [
        {
          "id": 444227,
          "author_name": "spscientist",
          "author_url": "",
          "post_date": "12/23/2018 15:30:22",
          "content": "<p>Thanks for your post. It worked for me now.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 480731,
          "author_name": "humza777",
          "author_url": "",
          "post_date": "02/28/2019 15:36:52",
          "content": "<p>yes it does tyvm</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 508594,
          "author_name": "varun12345",
          "author_url": "",
          "post_date": "04/06/2019 12:54:30",
          "content": "<p>Wow man thanks a lot. Can I get your number. You are just amazing. Please give your number so that I can ask you few doubts like this..</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 582684,
          "author_name": "yuanzilin",
          "author_url": "",
          "post_date": "07/23/2019 12:54:38",
          "content": "<p>it might be sklearn.model_selection. But anyway, your reply really helps me.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 588883,
          "author_name": "dimaka",
          "author_url": "",
          "post_date": "07/31/2019 07:23:29",
          "content": "<p>thanks</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 609229,
          "author_name": "misba1997",
          "author_url": "",
          "post_date": "08/27/2019 14:18:00",
          "content": "<p>Thank u soo muchh asaad bhai...ur solution made my work done....Thanks a lottttttt</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 609235,
          "author_name": "misba1997",
          "author_url": "",
          "post_date": "08/27/2019 14:19:36",
          "content": "<p>*<em>please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...</em>*I would be very grateful to you</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 661955,
          "author_name": "jeiksoncastiblanco",
          "author_url": "",
          "post_date": "10/30/2019 23:03:53",
          "content": "<p>gracias parcero</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 754131,
          "author_name": "jmsayson",
          "author_url": "",
          "post_date": "02/23/2020 05:02:54",
          "content": "<p>thank you so much dude</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 817205,
          "author_name": "ryanamoudi",
          "author_url": "",
          "post_date": "04/23/2020 00:10:07",
          "content": "<p>much appreciated!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 845578,
          "author_name": "silentlycrazy",
          "author_url": "",
          "post_date": "05/13/2020 09:42:51",
          "content": "<p>Thanks \nThis works</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 920246,
          "author_name": "anuragvardhan",
          "author_url": "",
          "post_date": "07/08/2020 13:05:00",
          "content": "<p>Finally a <em>working</em> solution, Thanks!</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1286162,
          "author_name": "suchismitabh",
          "author_url": "",
          "post_date": "04/27/2021 16:14:05",
          "content": "<p>Thank you so much it worked for me :)</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1286163,
          "author_name": "suchismitabh",
          "author_url": "",
          "post_date": "04/27/2021 16:14:05",
          "content": "<p>Thank you so much it worked for me :)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 443353,
      "author_name": "tiwiex",
      "author_url": "",
      "post_date": "12/21/2018 13:32:08",
      "content": "<p>Thanks. Apparently, it's under model_selection. Been tearing my head apart all day.</p>",
      "votes": null,
      "replies": [
        {
          "id": 659717,
          "author_name": "priyachocos",
          "author_url": "",
          "post_date": "10/28/2019 06:39:38",
          "content": "<p>me too..for two days i am breaking my head for this..finally got to know we need to use model_selection</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 460124,
      "author_name": "ahmetfarukcakmak",
      "author_url": "",
      "post_date": "01/23/2019 03:32:00",
      "content": "<p>The former code \"from sklearn.cross_validation import train_test_split\" has deprecated. The new one is below. I had the same problem, now it's gone.</p>\n\n<p>\"from sklearn.model_selection import train_test_split\"</p>",
      "votes": null,
      "replies": [
        {
          "id": 524387,
          "author_name": "rituk1996",
          "author_url": "",
          "post_date": "04/28/2019 16:45:26",
          "content": "<p>hey it's not working for me</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 591145,
          "author_name": "sasmito",
          "author_url": "",
          "post_date": "08/03/2019 07:58:14",
          "content": "<p>it is nor working to me too</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 597418,
          "author_name": "miguelaroque",
          "author_url": "",
          "post_date": "08/12/2019 10:20:48",
          "content": "",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 467026,
      "author_name": "sathiabama",
      "author_url": "",
      "post_date": "02/06/2019 11:01:31",
      "content": "<p>Friends,</p>\n\n<p>Thanks for the suggestion!\nThe below changes has worked for me.\nfrom sklearn.model_selection import train_test_split.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 485430,
      "author_name": "bhadauria4544",
      "author_url": "",
      "post_date": "03/07/2019 11:27:53",
      "content": "<p>use model_selection instead of cross_validation for splitting data into training set and test set.\nuse this-(from sklearn.model_selection import train_test_split)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 533066,
      "author_name": "dawit2011",
      "author_url": "",
      "post_date": "05/18/2019 11:18:42",
      "content": "<p>Thank You!!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 604140,
      "author_name": "indrajitkumar",
      "author_url": "",
      "post_date": "08/21/2019 04:46:22",
      "content": "<p>Yes, It was deprecated from 0.17.1 and removed in the latest version. We have use <strong>sklearn.model_selection import train_test_split</strong></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 609234,
      "author_name": "misba1997",
      "author_url": "",
      "post_date": "08/27/2019 14:19:26",
      "content": "<p>*<em>please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...</em>*I would be very grateful to you</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "412963": "Hello, \nIs anyone getting an error when importing the cross validation module?\n\n```\nfrom sklearn.cross_validation import train_test_split\n```\n\n\n---------------------------------------------------------------------------\nModuleNotFoundError                       Traceback (most recent call last)",
    "412967": "The module is sklearn.model_selection afaik http://scikit-learn.org/stable/modules/cross_validation.html",
    "412970": "I was surprised cause it worker earlier today and then just stopped. Either way, thanks for the solution!",
    "413044": "Use sklearn.model_selection instead of sklearn.cross_validation reason is in new version of sklearn cross_validation is changed to model_selection \nA small request please reply if this answer helps u .Thank You",
    "413062": "sklearn must have been updated to a more recent version, that's all.",
    "413186": "I can't find in the change log which version cross_validation module was removed but looks like model_selection module was introduced in version 0.18 so guessing cross_validation module was deprecated and removed not so long after that. There is a GH issue related to it here https://github.com/scikit-learn/scikit-learn/issues/6161",
    "443353": "Thanks. Apparently, it's under model_selection. Been tearing my head apart all day.",
    "444227": "Thanks for your post. It worked for me now.",
    "460124": "The former code \"from sklearn.cross_validation import train_test_split\" has deprecated. The new one is below. I had the same problem, now it's gone.\n\n\"from sklearn.model_selection import train_test_split\"",
    "467026": "Friends,\n\nThanks for the suggestion!\nThe below changes has worked for me.\nfrom sklearn.model_selection import train_test_split.",
    "480731": "yes it does tyvm",
    "485430": "use model_selection instead of cross_validation for splitting data into training set and test set.\nuse this-(from sklearn.model_selection import train_test_split)",
    "508594": "Wow man thanks a lot. Can I get your number. You are just amazing. Please give your number so that I can ask you few doubts like this..",
    "524387": "hey it's not working for me",
    "533066": "Thank You!!!",
    "582684": "it might be sklearn.model_selection. But anyway, your reply really helps me.",
    "588883": "thanks",
    "591145": "it is nor working to me too",
    "597418": "",
    "604140": "Yes, It was deprecated from 0.17.1 and removed in the latest version. We have use **sklearn.model_selection import train_test_split**",
    "609229": "Thank u soo muchh asaad bhai...ur solution made my work done....Thanks a lottttttt",
    "609234": "**please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...**I would be very grateful to you",
    "609235": "**please send ur mail ID or number that i could approach u fr help..am a beginner in python so,,,please help...**I would be very grateful to you",
    "659717": "me too..for two days i am breaking my head for this..finally got to know we need to use model_selection",
    "661955": "gracias parcero",
    "754131": "thank you so much dude",
    "817205": "much appreciated!",
    "845578": "Thanks \nThis works",
    "920246": "Finally a *working* solution, Thanks!",
    "936463": "NameError: name 'sklearn' is not defined\n \nCan anyone help with this?",
    "1043989": "Thanks a lot buddy",
    "1286162": "Thank you so much it worked for me :)",
    "1286163": "Thank you so much it worked for me :)"
  },
  "source": "meta"
}