Beispiel #1
0
def do_cv():
    # Load the user vectors.
    data = utility.load_vectors()
    outfile_string = "baseline_slice" + str(config.num_slices) \
                     + "_rec" + str(config.tuning_param['num_recs']) + ".txt"
    rates = list()
    st = state('Item Based', rates, outfile_string, "INFO", config.num_slices, config.tuning_param['num_recs'])
    for i in xrange(st.num_slices):
        st.cur_slice += 1
        train, test = utility.get_data_split(data, i)
        success = do_most_popular(train, test)
        st.rates = (success, len(test))
    return st
Beispiel #2
0
def do_cv():
    # Load the user vectors.
    data = utility.load_vectors()
    outfile_string = "user_slice" + str(config.num_slices) + "_rec" \
        + str(config.tuning_param['num_recs']) + "_users" + str(config.tuning_param['num_sims']) + ".txt"
    rates = list()
    st = state('User Based', rates, outfile_string, "INFO",
               config.num_slices, config.tuning_param['num_recs'], config.tuning_param['num_sims'])
    # Storage for the success rate.
    for i in range(st.num_slices):
        print "current slice: ", st.cur_slice
        st.cur_slice += 1
        train, test = utility.get_data_split(data, i)
        success = do_user_cf(train, test)
        st.rates = (success, len(test))
    return st