def perform():
# Create a new grid search classifier from a sci-kit pipeline
model = GridSearchCV(pipeline(), gs_clf_params(), n_jobs=-1)
# Get your training and testing sets of data with 50/50 split
(train_data, train_targets), (test_data, test_targets) = dp.get_data()
# Train your model
model = model.fit(train_data, train_targets)
# Test it's accuracy
predictions = model.predict(test_data)
# Display the model's accuracy
print "\nModel Accuracy: {}\n".format(np.mean(predictions == test_targets))
# Save the trained model to disk
save_model(model)
评论列表
文章目录