Example #1
0
def start_survey(username):

    # get the resulting jobs
    user_status = utils_users.get_user_status(username)

    win_idx_pair = user_status['dataset pairwise'].comparisons[-1, 0]
    win_pair = user_status['dataset pairwise'].datapoints[win_idx_pair]
    win_pair = utils_jobs.job_array_to_job_dict(win_pair)
    win_pair['ID'] = 'pairwise'

    win_idx_clust = user_status['logs clustering'][-1][0][0]
    win_clust = user_status['dataset clustering'].datapoints[win_idx_clust]
    win_clust = utils_jobs.job_array_to_job_dict(win_clust)
    win_clust['ID'] = 'clustering'

    win_idx_rank = user_status['logs ranking'][-1][0]
    win_rank = user_status['dataset ranking'].datapoints[win_idx_rank]
    win_rank = utils_jobs.job_array_to_job_dict(win_rank)
    win_rank['ID'] = 'ranking'

    # shuffle the results
    winners = [win_pair, win_clust, win_rank]
    winners = np.random.permutation(winners)

    return render_template('survey.html', username=username, winners=winners)
Example #2
0
def start_survey(username):

    # get the resulting traffic
    user_status = utils_users.get_user_status(username)

    win_idx_pair = user_status['dataset pairwise'].comparisons[-1, 0]
    win_pair = -1 * user_status['dataset pairwise'].datapoints[win_idx_pair]

    win_idx_rank = user_status['logs ranking'][-1][0]
    win_rank = -1 * user_status['dataset ranking'].datapoints[win_idx_rank]

    # shuffle the results
    order = np.random.permutation([0, 1])
    winner_ids = np.array([win_idx_pair, win_idx_rank])[order]
    winners = np.array([win_pair, win_rank])[order]

    # get the object abbreviations
    obj_names = data_traffic.get_objective_names()
    obj_abbrev = data_traffic.get_objective_abbrev()

    return render_template('survey_traffic.html',
                           username=username,
                           winners=winners,
                           winner_ids=winner_ids,
                           obj_names=obj_names,
                           obj_abbrev=obj_abbrev)
Example #3
0
def register_user():
    username = request.form['username']

    # if the input is not OK, set username to None and return
    if not re.match('^\w+$', username):
        return render_template('index.html', username='******')

    # check if user exists already and completed the survey
    user_status = utils_users.get_user_status(username)
    if len(user_status['survey results']) > 0:
        return render_template('index.html', username='******')

    utils_users.register_user(username)

    return render_template("persona_tutorial.html", username=username)
Example #4
0
def get_next_start_jobs(username):
    # get the user's stats
    user_status = utils_users.get_user_status(username)
    experiment_index = np.sum([
        user_status[k] for k in [
            'experiment pairwise',
            'experiment clustering',
            'experiment ranking',
        ]
    ])
    if experiment_index < 3:
        job_idx = user_status['order start jobs'][experiment_index]
        start_job_indices = specs_jobs.START_JOB_INDICES[job_idx]
        start_jobs = get_jobs()[start_job_indices]
    else:
        start_jobs = None
    return start_jobs