def extend_mlp_exp(): for s in [5]: for i in [1, 3, 4, 5]: for a in ['relu']: for e in [1, 2, 3, 4, 5, 10, 15]: exp_data = { 'sparseness': s, 'index': i, 'epochs': 50, 'batch_size': 256, 'layers': [64, 32, 16, 8], 'reg_layers': [0, 0, 0, 0], 'fake_layers': [64, 32, 16, 8], 'fake_reg_layers': [0, 0, 0, 0], 'last_activation': a, 'fake_last_activation': a, 'learning_rate': 0.001, 'extend_near_num': e, 'learner': 'adagrad' } experiment.extend_mlp_model_exp.experiment(**exp_data) send_email(receiver='*****@*****.**', title='EXMLP实验结束', text="实验结束时间:{}".format(datetime.now()), **email_config)
def svd(): for s in [1, 3]: for i in [1]: for e in [0]: experiment.svd_exp.experiment(s, i, 0.1, e, matrix_type='rt') send_email(receiver='*****@*****.**', title='SVD实验结束', text="", **email_config)
def main_fork(): with Pool() as pool: extends = (1, 2, 3, 4, 5, 10, 15, 20) # extends = (1, 2) # pool.map_async(save_extend_array, [(s, i, extends, pool) for s in [5, 10, 15, 20] for i in range(1, 6)]) pool.starmap(save_extend_array, [(s, i, extends) for s in [5, 10, 15, 20] for i in range(1, 6)]) send_email(receiver='*****@*****.**', title='实验结束', text="", **email_config)
def ncf_exp(): for s in [1, 3]: for i in [1]: for e in [0, 1, 2, 3, 4, 5, 10, 15, 20]: for d in [8]: data = ExperimentData() data.sparseness = s data.data_index = i data.mf_dim = d data.epochs = 30 data.batch_size = 128 data.layers = [64, 32, 16] data.reg_layers = [0, 0, 0] data.learning_rate = 0.007 data.extend_near_num = e data.learner = 'adam' experiment.ncf_exp.experiment(data, 'relu', matrix_type='tp') send_email(receiver='*****@*****.**', title='NCF实验结束', text="", **email_config)
def mlp_exp(): for s in [5, 10, 15, 20]: for i in [1]: for a in ['relu']: for e in [0, 1, 2, 3, 4, 5, 10, 15, 20]: exp_data = { 'sparseness': s, 'index': i, 'epochs': 30, 'batch_size': 128, 'layers': [64, 32, 16], 'reg_layers': [0, 0, 0], 'last_activation': a, 'learning_rate': 0.007, 'extend_near_num': e, 'learner': 'adam', 'matrix_type': 'tp' } experiment.mlp_exp.experiment(**exp_data) send_email(receiver='*****@*****.**', title='MLP实验结束', text="", **email_config)
def gmf_exp(): for s in [1, 3]: for i in [1, 2, 3, 4, 5]: for a in ['relu']: for d in [128]: for e in [0, 1, 2, 3, 4, 5, 10, 15, 20]: exp_data = { 'sparseness': s, 'index': i, 'epochs': 30, 'batch_size': 128, 'mf_dim': d, 'regs': [0, 0], 'last_activation': a, 'learning_rate': 0.007, 'extend_near_num': e, 'learner': 'adagrad' } experiment.gmf_exp.experiment(**exp_data) send_email(receiver='*****@*****.**', title='GMF实验结束', text="实验结束时间:{}".format(datetime.now()), **email_config)
if __name__ == '__main__': os.environ["CUDA_VISIBLE_DEVICES"] = "1" all_exp_data = [] for s in [5]: for i in [2, 3, 4, 5]: for a in ['relu', 'sigmoid']: for e in [0, 5]: if i == 2 and a == 'relu' and e == 0: continue exp_data = { 'sparseness': s, 'index': i, 'epochs': 30, 'batch_size': 128, 'layers': [64, 32, 16], 'reg_layers': [0, 0, 0], 'last_activation': a, 'learning_rate': 0.007, 'extend_near_num': e, 'learner': 'adagrad' } all_exp_data.append(experiment(**exp_data)) text = '\n'.join(map(lambda d: str(d), all_exp_data)) send_email(receiver='*****@*****.**', title='MLP实验结束', text=text, **email_config)
VT1 = VT[:K, :] Sigma1 = np.eye(K) * Sigma[:K] R = np.matmul(np.matmul(U1, Sigma1), VT1) mae, rmse = evaluate(sparseness, index, R, matrix_type=matrix_type) exp_data["mae"] = float(mae) exp_data["rmse"] = float(rmse) exp_data['datetime'] = datetime.now() print(exp_data) auto_insert_database(database_remote_config, exp_data, f'svd_{matrix_type}') # insert_database('experiment_data.db', "experiment_svd_rt", exp_data) if __name__ == '__main__': args = [] for s in [1, 3]: for i in [1]: for e in [0]: args.append((s, i, 0.1, e)) from concurrent.futures import ThreadPoolExecutor with ThreadPoolExecutor() as executor: executor.map(lambda x: experiment(*x), args) executor.shutdown(wait=True) send_email(receiver='*****@*****.**', title='SVD实验结束', text="", **email_config)