title: Scikit learn linear regression with several outputs
body: <p>I'm trying to use scikit learn to do linear regression with several outputs</p>
  
  <p>code (random data as example):</p>
  
  <pre><code>from sklearn import datasets, linear_model
  import numpy as np
  
  X = np.random.rand(300,10)
  y = np.random.rand(300,9)
  reg_model = linear_model.LinearRegression()
  reg_model.fit(X,y)
  </code></pre>
  
  <p>I get the collowing error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  /Users/sorensonderby/Documents/workspaces/workspace/Chemoinformatics_proect/notebooks/&lt;ipython-input-116-e235c7159573&gt; in &lt;module&gt;()
        5 y = np.random.rand(300,9)
        6 reg_model = linear_model.LinearRegression()
  ----&gt; 7 reg_model.fit(X,y)
        8 
  
  /Library/Python/2.7/site-packages/scikit_learn-0.10-py2.7-macosx-10.7-intel.egg/sklearn/linear_model/base.pyc in fit(self, X, y)
      178                     linalg.lstsq(X, y)
      179 
  --&gt; 180         self._set_intercept(X_mean, y_mean, X_std)
      181         return self
      182 
  
  /Library/Python/2.7/site-packages/scikit_learn-0.10-py2.7-macosx-10.7-intel.egg/sklearn/linear_model/base.pyc in _set_intercept(self, X_mean, y_mean, X_std)
      106         """
      107         if self.fit_intercept:
  --&gt; 108             self.coef_ = self.coef_ / X_std
      109             self.intercept_ = y_mean - np.dot(X_mean, self.coef_.T)
      110         else:
  
  ValueError: operands could not be broadcast together with shapes (10,9) (10)
  </code></pre>
  
  <p>I read the api for the fit method which says that x should be n_sample x n_features and y should be n_sample x n_targets. 
  <a href="http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html#sklearn.linear_model.LinearRegression.fit" rel="nofollow">Link to fit method</a></p>
  
  <p>What am I doing wrong?</p>