def calculate(me, observation):
 scores = []
 assert (len(me.feature_fns) == len(me.alphas))
 for klass in me.classes:
  lprob = 0.0
  for (fn, alpha) in zip(me.feature_fns, me.alphas):
   lprob += (fn(observation, klass) * alpha)
  scores.append(lprob)
 return scores

def calculate ( me , observation ) : scores = [ ] assert ( len ( me . feature_fns ) == len ( me . alphas ) ) for klass in me . classes : lprob = 0.0 for ( fn , alpha ) in zip ( me . feature_fns , me . alphas ) : lprob += ( fn ( observation , klass ) * alpha ) scores . append ( lprob ) return scores
calculate -> weight dict calculate the probability for each class .