{
  "id": 2479,
  "title": "Exception when running basic_benchmark.py",
  "url": "/competitions/predict-closed-questions-on-stack-overflow/discussion/2479",
  "author_name": "",
  "post_date": "2012-08-28T14:50:52.697Z",
  "votes": null,
  "comment_count": 4,
  "views": 2446,
  "content": "<p>I try to make examples work on my computer but I have a problem when running the basic benchmark</p>\r\n<p>What can be the cause of this exception?&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Regards,</p>\r\n<pre><span style=\"white-space:normal\"><br></span></pre>\r\n<pre><span style=\"white-space:normal\"><br></span>C:\\Users\\A\\Documents\\GitHub\\Stack-Overflow-Competition&gt;<strong>C:\\Python32\\python.exe basic_benchmark.py</strong><br>Reading the data<br>Extracting features<br>Training the model<br>Traceback (most recent call last):<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 401, in retrieve<br>    self._output.append(job.get())<br>  File &quot;C:\\Python32\\lib\\multiprocessing\\pool.py&quot;, line 556, in get<br>    raise self._value<br>sklearn.externals.joblib.my_exceptions.TransportableException: TransportableExce<br>ption<br>___________________________________________________________________________<br>TypeError                                          Tue Aug 28 16:43:45 2012<br>PID: 6064                              Python 3.2.3: C:\\Python32\\python.exe<br>...........................................................................<br>C:\\Python32\\lib\\site-packages\\sklearn\\ensemble\\forest.py in _parallel_build_tree<br>s(n_trees=13.5, forest=RandomForestClassifier(bootstrap=True, compute_i...ate ob<br>ject at 0x04730F40&gt;,<br>            verbose=2), X=array([[      495.,         4.,         2.,     ...1.,<br>         3.,        71.,<br>             4793.]]), y=0     3<br>1     3<br>2     3<br>3     4<br>4     3<br>5     3<br>...   0<br>140271    3<br>Name: OpenStatus, Length: 140272, sample_mask=None, X_argsorted=None, seed=83466<br>4036, verbose=2)<br>     58                           sample_mask, X_argsorted, seed, verbose):<br>     59     &quot;&quot;&quot;Private function used to build a batch of trees within a job.&quot;&quot;&quot;<br>     60     random_state = check_random_state(seed)<br>     61     trees = []<br>     62<br>---&gt; 63     for i in range(n_trees):<br>        i = undefined<br>        n_trees = 13.5<br>     64         if verbose &gt; 1:<br>     65             print((&quot;building tree %d of %d&quot; % (i &#43; 1, n_trees)))<br>     66         seed = random_state.randint(MAX_INT)<br>     67<br><br>TypeError: 'float' object cannot be interpreted as an integer<br>___________________________________________________________________________<br><br>During handling of the above exception, another exception occurred:<br><br>Traceback (most recent call last):<br>  File &quot;basic_benchmark.py&quot;, line 43, in &lt;module&gt;<br>    main()<br>  File &quot;basic_benchmark.py&quot;, line 27, in main<br>    rf.fit(fea, data[&quot;OpenStatus&quot;])<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\ensemble\\forest.py&quot;, line 250, in<br>fit<br>    for i in range(n_jobs))<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 475, in __call__<br>    self.retrieve()<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 427, in retrieve<br>    raise exception_type(report)<br>sklearn.externals.joblib.my_exceptions.JoblibTypeError </pre>",
  "messages": [
    {
      "id": "13562",
      "postDate": "08/28/2012 14:50:52",
      "content": "<p>I try to make examples work on my computer but I have a problem when running the basic benchmark</p>\r\n<p>What can be the cause of this exception?&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>Regards,</p>\r\n<pre><span style=\"white-space:normal\"><br></span></pre>\r\n<pre><span style=\"white-space:normal\"><br></span>C:\\Users\\A\\Documents\\GitHub\\Stack-Overflow-Competition&gt;<strong>C:\\Python32\\python.exe basic_benchmark.py</strong><br>Reading the data<br>Extracting features<br>Training the model<br>Traceback (most recent call last):<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 401, in retrieve<br>    self._output.append(job.get())<br>  File &quot;C:\\Python32\\lib\\multiprocessing\\pool.py&quot;, line 556, in get<br>    raise self._value<br>sklearn.externals.joblib.my_exceptions.TransportableException: TransportableExce<br>ption<br>___________________________________________________________________________<br>TypeError                                          Tue Aug 28 16:43:45 2012<br>PID: 6064                              Python 3.2.3: C:\\Python32\\python.exe<br>...........................................................................<br>C:\\Python32\\lib\\site-packages\\sklearn\\ensemble\\forest.py in _parallel_build_tree<br>s(n_trees=13.5, forest=RandomForestClassifier(bootstrap=True, compute_i...ate ob<br>ject at 0x04730F40&gt;,<br>            verbose=2), X=array([[      495.,         4.,         2.,     ...1.,<br>         3.,        71.,<br>             4793.]]), y=0     3<br>1     3<br>2     3<br>3     4<br>4     3<br>5     3<br>...   0<br>140271    3<br>Name: OpenStatus, Length: 140272, sample_mask=None, X_argsorted=None, seed=83466<br>4036, verbose=2)<br>     58                           sample_mask, X_argsorted, seed, verbose):<br>     59     &quot;&quot;&quot;Private function used to build a batch of trees within a job.&quot;&quot;&quot;<br>     60     random_state = check_random_state(seed)<br>     61     trees = []<br>     62<br>---&gt; 63     for i in range(n_trees):<br>        i = undefined<br>        n_trees = 13.5<br>     64         if verbose &gt; 1:<br>     65             print((&quot;building tree %d of %d&quot; % (i &#43; 1, n_trees)))<br>     66         seed = random_state.randint(MAX_INT)<br>     67<br><br>TypeError: 'float' object cannot be interpreted as an integer<br>___________________________________________________________________________<br><br>During handling of the above exception, another exception occurred:<br><br>Traceback (most recent call last):<br>  File &quot;basic_benchmark.py&quot;, line 43, in &lt;module&gt;<br>    main()<br>  File &quot;basic_benchmark.py&quot;, line 27, in main<br>    rf.fit(fea, data[&quot;OpenStatus&quot;])<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\ensemble\\forest.py&quot;, line 250, in<br>fit<br>    for i in range(n_jobs))<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 475, in __call__<br>    self.retrieve()<br>  File &quot;C:\\Python32\\lib\\site-packages\\sklearn\\externals\\joblib\\parallel.py&quot;, lin<br>e 427, in retrieve<br>    raise exception_type(report)<br>sklearn.externals.joblib.my_exceptions.JoblibTypeError </pre>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "13563",
      "postDate": "08/28/2012 15:05:04",
      "content": "<p>to rule out problems with parallel jobs, try setting the <code>n_jobs</code> parameter to 1 for\r\n<code>sklearn.ensemble.RandomForestClassifier</code></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "13564",
      "postDate": "08/28/2012 16:07:46",
      "content": "<p>Sounds like a bug. Which version of scikit-learn are you using?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "13596",
      "postDate": "08/29/2012 08:49:39",
      "content": "<p>I tried&nbsp;<span>setting the&nbsp;</span><code>n_jobs</code><span>&nbsp;parameter to 1 for&nbsp;</span><code>sklearn.ensemble.RandomForestClassifier &nbsp;but I receive the same error.</code></p>\r\n<p>I am using the&nbsp;<a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/\">scikit-learn-0.11.win32-py3.2.‌exe</a>&nbsp;<span>&nbsp;from&nbsp;</span><a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn\">http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn</a></p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "14133",
      "postDate": "09/09/2012 18:02:18",
      "content": "<p>Looking at that stack trace my gut instinct would be that it's caused by using an old verstion of scipy/numpy, I'd try upgrading them and seeing if the error goes away.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 13563,
      "author_name": "stackunderflow",
      "author_url": "",
      "post_date": "08/28/2012 15:05:04",
      "content": "<p>to rule out problems with parallel jobs, try setting the <code>n_jobs</code> parameter to 1 for\r\n<code>sklearn.ensemble.RandomForestClassifier</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 13564,
      "author_name": "",
      "author_url": "",
      "post_date": "08/28/2012 16:07:46",
      "content": "<p>Sounds like a bug. Which version of scikit-learn are you using?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 13596,
      "author_name": "alexandrekowalczyk",
      "author_url": "",
      "post_date": "08/29/2012 08:49:39",
      "content": "<p>I tried&nbsp;<span>setting the&nbsp;</span><code>n_jobs</code><span>&nbsp;parameter to 1 for&nbsp;</span><code>sklearn.ensemble.RandomForestClassifier &nbsp;but I receive the same error.</code></p>\r\n<p>I am using the&nbsp;<a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/\">scikit-learn-0.11.win32-py3.2.‌exe</a>&nbsp;<span>&nbsp;from&nbsp;</span><a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn\">http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn</a></p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 14133,
      "author_name": "imran2",
      "author_url": "",
      "post_date": "09/09/2012 18:02:18",
      "content": "<p>Looking at that stack trace my gut instinct would be that it's caused by using an old verstion of scipy/numpy, I'd try upgrading them and seeing if the error goes away.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "13562": "",
    "13563": "",
    "13564": "",
    "13596": "",
    "14133": ""
  },
  "source": "meta"
}