title: sklearn pipeline is not working
body: <p>I am new to sklearn pipeline and studying about it from sklearn documentation. I used it in sentiment analysis on <a href="http://www.cs.cornell.edu/people/pabo/movie-review-data/" rel="nofollow noreferrer">movie review</a> data. Data contains two columns, first <code>class</code> and second <code>text</code>.</p>
  <pre><code>input_file_df = pd.read_csv(&quot;movie-pang.csv&quot;)
  x_train = input_file_df[&quot;text&quot;] #used complete data as train data
  y_train = input_file_df[&quot;class&quot;]
  </code></pre>
  <p>I used only one feature, <code>sentiment score for each sentence.</code> I wrote custom transformer for this:</p>
  <pre><code>class GetWorldLevelSentiment(BaseEstimator, TransformerMixin):
  
  def __init__(self):
      pass
  
  def get_word_level_sentiment(self, word_list):
      sentiment_score = 1
      for word in word_list:
          word_sentiment = swn.senti_synsets(word)
  
          if len(word_sentiment) &gt; 0:
              word_sentiment = word_sentiment[0]
          else:
              continue
  
          if word_sentiment.pos_score() &gt; word_sentiment.neg_score():
              word_sentiment_score = word_sentiment.pos_score()
          elif word_sentiment.pos_score() &lt; word_sentiment.neg_score():
              word_sentiment_score = word_sentiment.neg_score()*(-1)
          else:
              word_sentiment_score = word_sentiment.pos_score()
  
          print word, &quot; &quot; , word_sentiment_score
          if word_sentiment_score != 0:
              sentiment_score = sentiment_score * word_sentiment_score
  
      return sentiment_score
  
  def transform(self, review_list, y=None):
      sentiment_score_list = list()
      for review in review_list:
          sentiment_score_list.append(self.get_word_level_sentiment(review.split()))
      
      return np.asarray(sentiment_score_list)
  
  def fit(self, x, y=None):
      return self
  </code></pre>
  <p>Pipeline which I used is:</p>
  <pre><code>pipeline = Pipeline([
  (&quot;word_level_sentiment&quot;,GetWorldLevelSentiment()),
  (&quot;clf&quot;, MultinomialNB())])
  </code></pre>
  <p>and then call fit on pipeline:</p>
  <pre><code>pipeline.fit(x_train, y_train)
  </code></pre>
  <p>But this is giving following error to me:</p>
  <p><code>This MultinomialNB instance is not fitted yet. Call 'fit' with appropriate arguments before using this method.</code></p>
  <p>Can someone please guide me what I am doing wrong here ?? It will be a great help.</p>