def example(): """simple test and performance measure """ num_user = 944 num_item = 1683 num_hidden = 200 iterations = 400 corruption = 0.2 train = build_ml_100k_train_binary3() test = build_ml_100k_test_binary3() train_matrix = build_user_item_matrix(num_user, num_item, train) test_matrix = build_user_item_matrix(num_user, num_item, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] num_user = num_user - 1 num_item = num_item - 1 mf_model = CDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, corruption) train = build_ml_100k_train_binary1() test = build_ml_100k_test_binary1() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, corruption) train = build_ml_100k_train_binary2() test = build_ml_100k_test_binary2() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, corruption) train = build_ml_100k_train_binary4() test = build_ml_100k_test_binary4() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, corruption) train = build_ml_100k_train_binary5() test = build_ml_100k_test_binary5() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, corruption) return mf_model
def example(): """simple test and performance measure """ num_user = 6041 num_item = 3953 num_hidden = 500 iterations = 501 train = build_ml_1m_train_binary2() test = build_ml_1m_test_binary2() train_matrix = build_user_item_matrix(num_user, num_item, train) test_matrix = build_user_item_matrix(num_user, num_item, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] num_user = num_user - 1 num_item = num_item - 1 mf_model = CDAE_ML_1m(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, 0.2) train = build_ml_1m_train_binary4() test = build_ml_1m_test_binary4() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_1m(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, 0.2) train = build_ml_1m_train_binary5() test = build_ml_1m_test_binary5() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_1m(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, 0.2) train = build_ml_1m_train_binary3() test = build_ml_1m_test_binary3() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_1m(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, 0.2) train = build_ml_1m_train_binary1() test = build_ml_1m_test_binary1() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = CDAE_ML_1m(train_matrix.shape[0], num_item, train_matrix, test_matrix, num_hidden) mf_model.estimate(iterations, 0.2) return mf_model
def example(): """simple test and performance measure """ num_user = 943 num_item = 1682 num_hidden = 200 iterations = 400 pre_iterations = 400 alpha = 0.4 imputation_ratio = 0.02 train = build_ml_100k_train_binary3() test = build_ml_100k_test_binary3() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations, imputation_ratio) mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations, alpha) train = build_ml_100k_train_binary1() test = build_ml_100k_test_binary1() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations, imputation_ratio) mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations, alpha) train = build_ml_100k_train_binary2() test = build_ml_100k_test_binary2() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations, imputation_ratio) mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations, alpha) train = build_ml_100k_train_binary4() test = build_ml_100k_test_binary4() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations, imputation_ratio) mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations, alpha) train = build_ml_100k_train_binary5() test = build_ml_100k_test_binary5() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations, imputation_ratio) mf_model = IDAE_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations, alpha) return mf_model
def example(): """simple test and performance measure """ num_user = 944 num_item = 1683 num_hidden = 200 iterations = 400 pre_iterations = 400 train = build_ml_100k_train_binary3() test = build_ml_100k_test_binary3() train_matrix = build_user_item_matrix(num_user, num_item, train) test_matrix = build_user_item_matrix(num_user, num_item, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] num_user = num_user - 1 num_item = num_item - 1 mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations) mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations) train = build_ml_100k_train_binary1() test = build_ml_100k_test_binary1() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations) mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations) train = build_ml_100k_train_binary2() test = build_ml_100k_test_binary2() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations) mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations) train = build_ml_100k_train_binary4() test = build_ml_100k_test_binary4() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations) mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations) train = build_ml_100k_train_binary5() test = build_ml_100k_test_binary5() train_matrix = build_user_item_matrix(num_user + 1, num_item + 1, train) test_matrix = build_user_item_matrix(num_user + 1, num_item + 1, test) train_matrix = train_matrix.todense() test_matrix = test_matrix.todense() train_matrix = train_matrix[1:, 1:] test_matrix = test_matrix[1:, 1:] mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, train_matrix, num_hidden) output_matrix = mf_model.preTrain(pre_iterations) mf_model = DAE_with_imputation_ML_100k(train_matrix.shape[0], num_item, train_matrix, test_matrix, output_matrix, num_hidden) mf_model.estimate(iterations) return mf_model