Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.linear_model import LogisticRegression as Model
- def train(features, target):
- model = Model()
- model.fit(features, target)
- return model
- def predict(model, new_features):
- preds = model.predict(new_features)
- return preds
- 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]]
- target = [1, 0, 1, 0, 1, 0, 1, 1, 1]
- model = train(feats, target)
- test = [[10000, 1000, 0]]
- predictions = predict(model, test)
- print(predictions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement