train.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:jarvis 作者: whittlbc 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号