def main(): # Data loading root_data_path = os.path.join(get_project_root_path(), "data/") data_reader = RecSys2019Reader(root_data_path) data_reader = New_DataSplitter_leave_k_out( data_reader, k_out_value=K_OUT, use_validation_set=False, allow_cold_users=ALLOW_COLD_USERS, force_new_split=True, seed=get_split_seed()) data_reader.load_data() URM_train, URM_test = data_reader.get_holdout_split() ICM_all, _ = get_ICM_train_new(data_reader) UCM_all, _ = get_UCM_train_new(data_reader) # Ignoring users ignore_users = get_ignore_users( URM_train, data_reader.get_original_user_id_to_index_mapper(), lower_threshold=LOWER_THRESHOLD, upper_threshold=UPPER_THRESHOLD, ignore_non_target_users=IGNORE_NON_TARGET_USERS) evaluator = EvaluatorHoldout(URM_test, cutoff_list=[CUTOFF], ignore_users=ignore_users) # Model evaluation model = get_model(URM_train, ICM_all, UCM_all) print(evaluator.evaluateRecommender(model))
from src.data_management.RecSys2019Reader import RecSys2019Reader from src.data_management.dataframe_preprocesser import get_preprocessed_dataframe from src.tuning.holdout_validation.run_parameter_search_advanced_top_pop import run_parameter_search_advanced_top_pop from src.utils.general_utility_functions import get_split_seed if __name__ == '__main__': # Data loading data_reader = RecSys2019Reader("../../data/") data_reader = New_DataSplitter_leave_k_out(data_reader, k_out_value=3, use_validation_set=False, force_new_split=True, seed=get_split_seed()) data_reader.load_data() URM_train, URM_test = data_reader.get_holdout_split() mapper = data_reader.get_original_user_id_to_index_mapper() df = get_preprocessed_dataframe("../../data/", keep_warm_only=True) # Setting evaluator # warm_users_mask = np.ediff1d(URM_train.tocsr().indptr) > 0 # warm_users = np.arange(URM_train.shape[0])[warm_users_mask] # ignore_users = warm_users cutoff_list = [10] evaluator = EvaluatorHoldout(URM_test, cutoff_list=cutoff_list) # HP tuning print("Start tuning...") version_path = "../../report/hp_tuning/advanced_top_pop/" now = datetime.now().strftime('%b%d_%H-%M-%S') now = now + "_k_out_value_3_eval/" version_path = version_path + now