title: TypeError: fit() missing 1 required positional argument: 'y' (using sklearn - ExtraTreesRegressor)
body: <p>Just trying out the Sklearn python library and I re-purposed some code I was using for Linear regression to fit a regression tree model as an example I saw (here's the example code):</p>
  <pre><code>def fit(self, X, y):
          &quot;&quot;&quot;
          Fit a Random Forest model to data `X` and targets `y`.
  
          Parameters
          ----------
          X : array-like
              Input values.
          y: array-like
              Target values.
          &quot;&quot;&quot;
          self.X = X
          self.y = y
          self.n = self.X.shape[0]
          self.model = ExtraTreesRegressor(**self.params)
          self.model.fit(X, y)
  </code></pre>
  <p>Here's the code I've written/repurposed</p>
  <pre><code>data = pd.read_csv(&quot;rmsearch.csv&quot;, sep=&quot;,&quot;)
  data = data[[&quot;price&quot;, &quot;type&quot;, &quot;number_bedrooms&quot;]]
  predict = &quot;price&quot;
  
  X = np.array(data.drop([predict], 1))
  y = np.array(data[predict])
  x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size=0.2)
  
  etr = ensemble.ExtraTreesRegressor
  etr.fit(x_train, y_train)
  acc = etr.score(x_test, y_test)
  print(&quot;Accuracy; &quot;, acc)
  </code></pre>
  <p>and I am getting this error:</p>
  <pre><code>etr.fit(x_train, y_train)
  TypeError: fit() missing 1 required positional argument: 'y'
  </code></pre>
  <p>I know fit() takes 'X', 'y', and 'sample_weight'  as input. but, sample_weight defaults to none.  the other examples haven't helped me much but it could also be that I'm fairly new to python and not able to spot a simple coding error.</p>
  <p>fit() documentation:</p>
  <p><a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.ExtraTreesRegressor.html#sklearn.ensemble.ExtraTreesRegressor.fit" rel="nofollow noreferrer">https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.ExtraTreesRegressor.html#sklearn.ensemble.ExtraTreesRegressor.fit</a></p>
  <p>Thanks for your help in advance.</p>