1 from sklearn.linear_model import LogisticRegression
3 import cPickle as pickle
10 def init(fname = './model.pkl'):
13 predictors = pickle.load(f)
26 def predict(index, features):
27 pp = predictors[index]
28 true_class = int(pp.classes_[1] == 1)
29 prob = pp.predict_proba([features])[0, true_class]
34 if __name__ == '__main__':
37 feature=[1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2,2,2]
38 print predict(len(predictors) - 1, feature)