unorderable types: dict() <= int() in running OneVsRest Classifier
<p>I am running a multilabel classification on the input data with 330 features and about 800 records. I am leveraging RandomForestClassifier with following param_grid:</p>

<pre><code>&gt; param_grid = {"n_estimators": [20],
&gt;                "max_depth": [6],
&gt;               "max_features": [80, 150],
&gt;               "min_samples_leaf": [1, 3, 10],
&gt;               "bootstrap": [True, False],
&gt;               "criterion": ["gini", "entropy"],
&gt;                "oob_score": [True, False]}
</code></pre>

<p>After cleaning up the data, this is how I am setting up the classifier and fit the model and apply a decision_fucntion:</p>

<pre><code>classifier = OneVsRestClassifier(RandomForestClassifier(param_grid))
y_score = classifier.fit(X_train, y_train).descition_function(X_test)
</code></pre>

<p>X_train shape - (800, 334), Y_train shape - (800, 4).
Number of classifications - 4. Running the code in sklearn 0.18</p>

<p>However, runnning into the below error message:</p>

<pre><code> ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-164-db76d3122db8&gt; in &lt;module&gt;()
      1 classifier = OneVsRestClassifier(RandomForestClassifier(param_grid))
----&gt; 2 y_score = classifier.fit(X_train, y_train).descition_function(X_test)
      3 #clf = RandomForestClassifier()
      4 #gr_search = grid_search.GridSearchCV(clf, param_grid02, cv=10, scoring = 'accuracy')

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/multiclass.py in fit(self, X, y)
    214                 "not %s" % self.label_binarizer_.classes_[i],
    215                 self.label_binarizer_.classes_[i]])
--&gt; 216             for i, column in enumerate(columns))
    217 
    218         return self

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py in __call__(self, iterable)
    756             # was dispatched. In particular this covers the edge
    757             # case of Parallel used with an exhausted iterator.
--&gt; 758             while self.dispatch_one_batch(iterator):
    759                 self._iterating = True
    760             else:

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py in dispatch_one_batch(self, iterator)
    606                 return False
    607             else:
--&gt; 608                 self._dispatch(tasks)
    609                 return True
    610 

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py in _dispatch(self, batch)
    569         dispatch_timestamp = time.time()
    570         cb = BatchCompletionCallBack(dispatch_timestamp, len(batch), self)
--&gt; 571         job = self._backend.apply_async(batch, callback=cb)
    572         self._jobs.append(job)
    573 

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py in apply_async(self, func, callback)
    107     def apply_async(self, func, callback=None):
    108         """Schedule a func to be run"""
--&gt; 109         result = ImmediateResult(func)
    110         if callback:
    111             callback(result)

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/_parallel_backends.py in __init__(self, batch)
    320         # Don't delay the application, to avoid keeping the input
    321         # arguments in memory
--&gt; 322         self.results = batch()
    323 
    324     def get(self):

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py in __call__(self)
    129 
    130     def __call__(self):
--&gt; 131         return [func(*args, **kwargs) for func, args, kwargs in self.items]
    132 
    133     def __len__(self):

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/externals/joblib/parallel.py in &lt;listcomp&gt;(.0)
    129 
    130     def __call__(self):
--&gt; 131         return [func(*args, **kwargs) for func, args, kwargs in self.items]
    132 
    133     def __len__(self):

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/multiclass.py in _fit_binary(estimator, X, y, classes)
     78     else:
     79         estimator = clone(estimator)
---&gt; 80         estimator.fit(X, y)
     81     return estimator
     82 

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/ensemble/forest.py in fit(self, X, y, sample_weight)
    281 
    282         # Check parameters
--&gt; 283         self._validate_estimator()
    284 
    285         if not self.bootstrap and self.oob_score:

/Users/ayada/anaconda/lib/python3.5/site-packages/sklearn/ensemble/base.py in _validate_estimator(self, default)
     94         """Check the estimator and the n_estimator attribute, set the
     95         `base_estimator_` attribute."""
---&gt; 96         if self.n_estimators &lt;= 0:
     97             raise ValueError("n_estimators must be greater than zero, "
     98                              "got {0}.".format(self.n_estimators))

TypeError: unorderable types: dict() &lt;= int()
</code></pre>

<p>Why are you trying to initialize RandomForestClassifier with parameter grid?</p>

<p>If you want to do a Grid Search - look at examples here:
<a href="http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV" rel="nofollow">http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV</a></p>

python scikit-learn sklearn-pandas