Advertisement
Dennnhhhickk

Untitled

Jul 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. from sklearn.linear_model import LogisticRegression as Model
  2. def train(features, target):
  3. model = Model()
  4. model.fit(features, target)
  5. return model
  6.  
  7. def predict(model, new_features):
  8. preds = model.predict(new_features)
  9. return preds
  10.  
  11. feats = [[5, 2, 0], [10, 2, 0], [10, 10, 0], [5, 2, 0], [2, 10, 0], [10, 9, 0], [10, 2, 1], [5, 2, 246], [10, 9, 232]]
  12. target = [1, 0, 1, 0, 1, 0, 1, 1, 1]
  13. model = train(feats, target)
  14. test = [[10000, 1000, 0]]
  15. predictions = predict(model, test)
  16. print(predictions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement