import yaml

# Real-world data sets
def save_cfg_YeastBP():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 100.0,
               'threshold': 0.2}
    
    return configs

def save_cfg_YeastCC():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 20.0,
               'threshold': 0.3}
    
    return configs

def save_cfg_YeastMF():
    configs = {'max_epoch': 200,
               'lr': 1e-2,
               'alpha': 20.0,
               'threshold': 0.3}
    
    return configs

def save_cfg_Music_emotion():
    configs = {'max_epoch': 500,
               'lr': 1e-2,
               'alpha': 10.0,
               'threshold': 0.4}
    
    return configs

def save_cfg_Music_style():
    configs = {'max_epoch': 500,
               'lr': 3e-3,
               'alpha': 20.0,
               'drop_ratio': 0.9,
               'threshold': 0.4}
    
    return configs


# Synthetic data sets with noise level 1.0
def save_cfg_corel5k_level_1():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 10.0}
    
    return configs

def save_cfg_rcv1subset1_level_1():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 10.0,
               'drop_ratio': 0.5,
               'threshold': 0.4}
    
    return configs

def save_cfg_Corel16k001_level_1():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 20.0,
               'drop_ratio': 0.5}
    
    return configs

def save_cfg_iaprtc12_level_1():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 5.0,
               'threshold': 0.6}
    
    return configs

def save_cfg_espgame_level_1():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 1.0,
               'drop_ratio': 0.1}
    
    return configs


# Synthetic data sets with noise level 1.5
def save_cfg_corel5k_level_2():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 10.0,
               'drop_ratio': 0.9}
    
    return configs

def save_cfg_rcv1subset1_level_2():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 50.0,
               'threshold': 0.4}
    
    return configs

def save_cfg_Corel16k001_level_2():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 20.0,
               'drop_ratio': 0.3}
    
    return configs

def save_cfg_iaprtc12_level_2():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 5.0,
               'threshold': 0.6}
    
    return configs

def save_cfg_espgame_level_2():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 2.0,
               'drop_ratio': 0.5,
               'threshold': 0.6}
    
    return configs


# Synthetic data sets with noise level 2.0
def save_cfg_corel5k_level_3():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 100.0}
    
    return configs

def save_cfg_rcv1subset1_level_3():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 20.0,
               'drop_ratio': 0.7,
               'threshold': 0.4}
    
    return configs

def save_cfg_Corel16k001_level_3():
    configs = {'max_epoch': 200,
               'lr': 1e-2,
               'alpha': 50.0}
    
    return configs

def save_cfg_iaprtc12_level_3():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 5.0,
               'threshold': 0.7}
    
    return configs

def save_cfg_espgame_level_3():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 1.0,
               'drop_ratio': 0.9,
               'threshold': 0.6}
    
    return configs


# Synthetic data sets with noise level 2.5
def save_cfg_corel5k_level_4():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 2.0,
               'drop_ratio': 0.9,
               'threshold': 0.7}
    
    return configs

def save_cfg_rcv1subset1_level_4():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 2.0,
               'threshold': 0.8}
    
    return configs

def save_cfg_Corel16k001_level_4():
    configs = {'max_epoch': 200,
               'lr': 3e-3,
               'alpha': 2.0,
               'threshold': 0.7}
    
    return configs

def save_cfg_iaprtc12_level_4():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 2.0,
               'threshold': 0.8}
    
    return configs

def save_cfg_espgame_level_4():
    configs = {'max_epoch': 200,
               'lr': 1e-3,
               'alpha': 5.0,
               'threshold': 0.7}
    
    return configs


if __name__ == '__main__':
    realworld_datasets = ["YeastBP", "YeastCC", "YeastMF", "Music_emotion", "Music_style"]
    syn_datasets = ["corel5k", "rcv1subset1","Corel16k001", "iaprtc12", "espgame"]
    for dataset in realworld_datasets: 
        filename = dataset + '_cfgs.yaml'
        func = 'save_cfg_' + dataset
        
        configs = eval(func)()
        
        with open(filename, "w", encoding="utf-8") as f:
            yaml.dump(configs, f)
    
    for dataset in syn_datasets:
        filename = dataset + '_1.0_cfgs.yaml'
        func = 'save_cfg_' + dataset + '_level_1'
        
        configs = eval(func)()
        
        with open(filename, "w", encoding="utf-8") as f:
            yaml.dump(configs, f)
            
    for dataset in syn_datasets:
        filename = dataset + '_1.5_cfgs.yaml'
        func = 'save_cfg_' + dataset + '_level_2'
        
        configs = eval(func)()
        
        with open(filename, "w", encoding="utf-8") as f:
            yaml.dump(configs, f)
            
    for dataset in syn_datasets:
        filename = dataset + '_2.0_cfgs.yaml'
        func = 'save_cfg_' + dataset + '_level_3'
        
        configs = eval(func)()
        
        with open(filename, "w", encoding="utf-8") as f:
            yaml.dump(configs, f)
            
    for dataset in syn_datasets:
        filename = dataset + '_2.5_cfgs.yaml'
        func = 'save_cfg_' + dataset + '_level_4'
        
        configs = eval(func)()
        
        with open(filename, "w", encoding="utf-8") as f:
            yaml.dump(configs, f)