title: using brand as a feature in product categorization
body: <p>I am working on classifying  products into categories  using scikit-learn , I have trained a logistic regression model which has done well. I want to improve the performance of the classifier and I have been wondering if the brand of the product could have an impact on improving the classification. As you know in the pipeline of a classifier there are steps like stemming and tokenization etc so is there a way to add brand treatment as an extra feature to the pipeline so that the algorithm can used to classify products? 
  The data I am using is a dataset of products(title,brand,description etc...) with their categories as labels.</p>
  
  <p>code:</p>
  
  <pre><code>with open('file_path') as json_data:
      d = json.load(json_data)
  
  def train(classifier, X, y):
      X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=33)
      print("X_train:")
      print(len(X_train))
      print("X_test:")
      print(len(X_test))
      print("y_train:")
      print(len(y_train))
      print("y_test:")
      print(len(y_test))
      classifier.fit(X_train, y_train)
      print "Accuracy: %s" % classifier.score(X_test, y_test)
      return classifier
  
  
  
  target = np.asarray(d["target"])
  data=d["data"]
  categs=d["categs"]
  
  trial = Pipeline([
      ('vectorizer', TfidfVectorizer(tokenizer=stemming_tokenizer,
                               stop_words=stopwords.words('french') + list(string.punctuation))),
      ('classifier', linear_model.LogisticRegression(C=1e2,n_jobs=-1)),
  ])
  
  print("start train...")
  clf=train(trial, data, target)
  print("finished train")
  </code></pre>