Ejemplo n.º 1
0
# %% Choose settings and classifier
test_season = '2018-2019'  # hold-out season for validation
level = 'match'  # match or team level features to use
shuffle = True  # whether to shuffle or not the data in k-fold cross validation
norm = True  # whether to normalise or not the features
min_round = 5  # minimum number of first rounds to skip in every season
nsplits = 5  # number of folds in k-fold cross validation
random_state = 10  # random state for the classifier
params = {
    'n_estimators': np.arange(5, 200, 5),
    # 'learning_rate': np.arange(0.3, 1.5, 0.1)}
}  # params for the grid search
model = AdaBoostClassifier(random_state=random_state)

# %% load feature data
df = load_features(level)

# choose features
if level == 'match':
    feats = [
        'Position_x', 'Position_y', 'Offence_x', 'Offence_y', 'Defence_x',
        'Defence_y', 'form_x', 'form_y', 'Diff_x', 'Diff_y', 'Home F4',
        'Away F4'
    ]
elif level == 'team':
    feats = [
        'Home', 'Away', 'Position', 'Offence', 'Defence', 'form', 'F4', 'Diff'
    ]
n_feats = len(feats)

# seasons for calibration
Ejemplo n.º 2
0
                knn = ItemBase(reviews_data)
                result = knn.get_recommended_games(game_id, games_data)

                return render_template(
                    'predict.html',
                    tables=[result.to_html(index=False, classes='table')],
                    titles="Suggestion for " + name + "'s players")
            else:
                username = request.form.get('username')
                result = user_base.get_predict(username)

                return render_template(
                    'predict.html',
                    tables=[result.to_html(index=False, classes='table')],
                    titles="Suggestion for user:"******"No suggestion for ")


if __name__ == '__main__':
    games_data = data_processing.load_games_data()
    game_features = data_processing.load_features(games_data,
                                                  method='Content-based')
    reviews_data = data_processing.load_reviews()
    tf_idf = TF_IDF(games_data, game_features)
    user_base = UserBase(reviews_data, games_data)

    app.run(debug=True)