title: Scikit python error: AttributeError: 'NoneType' object has no attribute 'shape'
body: <p>My task is binary classification. 
  My model looks like this: </p>
  
  <pre><code>elif info['task']=='binary.classification': 
          name0 = "LogisticRegression"
          name1 = "SGDClassifier"
          model0 = LogisticRegression() 
          model1 = SGDClassifier(n_iter = np.ceil(10**6 / self.train_num),loss = 'log', verbose = verbose)
  
          self.classifiers.update({name0:model0, name1:model1})
  
          for key in self.classifiers:
              self.model = self.classifiers[key]  
              self.predict_method = self.model.predict_proba
  </code></pre>
  
  <p>This is what my Fit and Predict methods look like:</p>
  
  <pre><code>def fit(self, Xtrain, Ytrain):
      self.model.fit(Xtrain, Ytrain)          
  
      # Train a calibration model postprocessor
  
      if self.task != 'regression'  and self.postprocessor!=None:
          Yhat = self.predict_method(Xtrain)
          if len(Yhat.shape)==1: # IG modif Feb3 2015
              Yhat = np.reshape(Yhat,(-1,1))           
          self.postprocessor.fit(Yhat, Ytrain)
  
      return self
  
  def predict(self, X):
      print "predict(self, X)"
  
      prediction = self.predict_method(X)
  
      # Calibrate proba
      if self.task != 'regression' and self.postprocessor!=None:        
          prediction = self.postprocessor.predict_proba(prediction)
      # Keep only 2nd column because the second one is 1-first    
      if self.target_num==1 and len(prediction.shape)&gt;1 and prediction.shape[1]&gt;1:
          prediction = prediction[:,1]
      # Make sure the normalization is correct
      if self.task=='multiclass.classification':
          eps = 1e-15
          norma = np.sum(prediction, axis=1)
          for k in range(prediction.shape[0]):
              prediction[k,:] /= sp.maximum(norma[k], eps)  
      return prediction
  </code></pre>
  
  <p>I keep getting the following error:</p>
  
  <pre><code>File "/Applications/anaconda/lib/python2.7/site-packages/sklearn/linear_model/base.py", line 193, in decision_function
  n_features = self.coef_.shape[1]
  AttributeError: 'NoneType' object has no attribute 'shape'
  </code></pre>
  
  <p>How can I solve this?
  It has something to do with the Predict and Fit methods.</p>