old_contents: from sklearn.externals import joblib
  import sklearn as sk
  from warnings import warn
  from featureextraction import entry2vec, url2vec
  
  
  classifier_path = 'classifier.pickle'
  try:
      classifier = joblib.load(classifier_path)
  except IOError:
      warn("Creating new classifier")
      classifier = sk.linear_model.passive_aggressive.PassiveAggressiveClassifier(
      )
  
  
  def score_entry(entry):
      X = entry2vec(entry)
      try:
          score = classifier.decision_function(X=[X])[0]
      except sk.exceptions.NotFittedError as e:
          score =  1
      return score
  
  def score_feed(parsed_feed):
      return [score_entry(e) for e in parsed_feed.entries]
  
  def learn_entry(feedback, url):
      X = url2vec(url)
      classifier.partial_fit(X=[X], y=[int(feedback)], classes=[0, 1])
      joblib.dump(classifier, classifier_path)
  
new_contents: from featureextraction import url2vec, FailedExtraction
  import numpy
  import sklearn.linear_model as lm
  import sklearn as sk
  from sklearn.externals import joblib
  import traceback
  from warnings import warn
  
  user = 'piccolbo@gmail.com'
  
  
  def score_entry(entry, classifier_db):
      try:
          X = url2vec(entry.link, entry)
          probs = classifier_db[user].predict_proba(X=X)
          return probs[:, 1].mean()
      except Exception, e:
          warn("Failed Scoring")
          warn(entry.link)
          warn(traceback.format_exc())
          return 0.5
  
  
  def score_feed(parsed_feed, classifier_db):
      return [score_entry(e, classifier_db) for e in parsed_feed.entries]
  
  
  def store_feedback(feedback, url, training_db):
      training_db[url] = feedback
      training_db.sync()
  
  
  def store_unlabelled(url, training_db):
      if not training_db.has_key[url]:
          training_db[url] = None
  
  
  def url2vec_or_None(url):
      try:
          return url2vec(url)
      except:
          return None
  
  
  def learn(training_db, classifier_db):
      classifier = lm.LogisticRegressionCV(n_jobs=-1)
      Xy = [(X, [int(feedback)] * X.shape[0])
            for X, feedback in [(url2vec_or_None(url), feedback)
                                for url, feedback in training_db.iteritems()]
            if X is not None]
      X = numpy.concatenate([X_ for X_, _ in Xy], axis=0)
      y = numpy.concatenate([y_ for _, y_ in Xy], axis=0)
      classifier.fit(X=X, y=y)
      warn("Classifier Score: {score}".format(score=classifier.score(X=X, y=y)))
      classifier_db[user] = classifier
      classifier_db.sync()
  
subject: store data for unsupervised training, switch to logistic regression