def api_train_model(): parser = DataParser() model = RandomForestClassifier(n_estimators=10) prediction_model = PredictionModel(parser, model) prediction_model.train_model() PredictionModelEntity.store(prediction_model) return jsonify({'accuracy': average(prediction_model.cross_validate())})
def api_show_game(game_id): game = Game.query.get(game_id) prediction_model = PredictionModelEntity.load() prediction = prediction_model.predict(game) return prediction