rfho/examples/data_hypercleaner.py
def main(saver=None, run_baseline=True, run_oracle=True, run_optimization=True,
         T=2000, lr=.1, R_search_space=(1000, 1500, 2000, 2500)):
    # TODO ...
    """
    This method should replicate ICML experiment....
    
    :param R_search_space: 
    :param saver: 
    :param run_baseline: 
    :param run_oracle: 
    :param run_optimization: 
    :param T: 
    :param lr: 
    :return: 
    """
    data = load_std_data()
    x = tf.placeholder(tf.float32, name='x')
    y = tf.placeholder(tf.float32, name='y')
    model = rf.LinearModel(x, 28 * 28, 10)

    if run_baseline:
        # baseline_lrate = args.lr * args.p_train * args.N_all_ / N_unflipped  # better lr of optimizer i'd say
        baseline(saver, model, y, data, T, lr, name='Baseline')  # could run for more iterations...

    if run_oracle:
        lmd_oracle = np.ones(data.train.num_examples + data.validation.num_examples)
        lmd_oracle[data.train.info['noisy examples']] = 0.
        # for ind in data.train.info['noisy examples']:
        #     lmd_oracle[ind] = 0.
        baseline(saver, model, y, data, T, lr, lmd=lmd_oracle, name='Oracle')

    lmd_dict = {}
    if run_optimization:
        for R in R_search_space:
            normalized_lr = lr * data.train.num_examples / R
            lmd_dict[R] = data_hyper_cleaner(saver, model, y, data, T, lr=normalized_lr, R=R,
                                             hyper_optimizer_kwargs={'lr': 0.005},
                                             # i think we used this one in the paper
                                             append_string='_R%d' % R)
            lmd_optimized = np.ones(data.train.num_examples + data.validation.num_examples)
            lmd_optimized *= np.max(lmd_dict[R])  # there's no reason to overweight the validation examples...
            lmd_optimized[:data.train.num_examples] = lmd_dict[R]
            baseline(saver, model, y, data, T, lr=.1 / np.max(lmd_dict[R]), lmd=lmd_optimized,
                     name='_R%d_Final Round' % R)

    This method should replicate ICML experiment....
    
    :param R_search_space: 
    :param saver: 
    :param run_baseline: 
    :param run_oracle: 
    :param run_optimization: 
    :param T: 
    :param lr: 
    :return: 
    
This method should replicate ICML experiment
This method should replicate ICML experiment
def main(saver=None, run_baseline=True, run_oracle=True, run_optimization=True,
         T=2000, lr=.1, R_search_space=(1000, 1500, 2000, 2500)):
    data = load_std_data()
    x = tf.placeholder(tf.float32, name='x')
    y = tf.placeholder(tf.float32, name='y')
    model = rf.LinearModel(x, 28 * 28, 10)
    if run_baseline:
        baseline(saver, model, y, data, T, lr, name='Baseline')  
    if run_oracle:
        lmd_oracle = np.ones(data.train.num_examples + data.validation.num_examples)
        lmd_oracle[data.train.info['noisy examples']] = 0.
        baseline(saver, model, y, data, T, lr, lmd=lmd_oracle, name='Oracle')
    lmd_dict = {}
    if run_optimization:
        for R in R_search_space:
            normalized_lr = lr * data.train.num_examples / R
            lmd_dict[R] = data_hyper_cleaner(saver, model, y, data, T, lr=normalized_lr, R=R,
                                             hyper_optimizer_kwargs={'lr': 0.005},
                                             append_string='_R%d' % R)
            lmd_optimized = np.ones(data.train.num_examples + data.validation.num_examples)
            lmd_optimized *= np.max(lmd_dict[R])  
            lmd_optimized[:data.train.num_examples] = lmd_dict[R]
            baseline(saver, model, y, data, T, lr=.1 / np.max(lmd_dict[R]), lmd=lmd_optimized,
                     name='_R%d_Final Round' % R)
def main ( saver = None , run_baseline = True , run_oracle = True , run_optimization = True , T = 2000 , lr = .1 , R_search_space = ( 1000 , 1500 , 2000 , 2500 ) ) : data = load_std_data ( ) x = tf . placeholder ( tf . float32 , name = 'x' ) y = tf . placeholder ( tf . float32 , name = 'y' ) model = rf . LinearModel ( x , 28 * 28 , 10 ) if run_baseline : baseline ( saver , model , y , data , T , lr , name = 'Baseline' ) if run_oracle : lmd_oracle = np . ones ( data . train . num_examples + data . validation . num_examples ) lmd_oracle [ data . train . info [ 'noisy examples' ] ] = 0. baseline ( saver , model , y , data , T , lr , lmd = lmd_oracle , name = 'Oracle' ) lmd_dict = { } if run_optimization : for R in R_search_space : normalized_lr = lr * data . train . num_examples / R lmd_dict [ R ] = data_hyper_cleaner ( saver , model , y , data , T , lr = normalized_lr , R = R , hyper_optimizer_kwargs = { 'lr' : 0.005 } , append_string = '_R%d' % R ) lmd_optimized = np . ones ( data . train . num_examples + data . validation . num_examples ) lmd_optimized *= np . max ( lmd_dict [ R ] ) lmd_optimized [ : data . train . num_examples ] = lmd_dict [ R ] baseline ( saver , model , y , data , T , lr = .1 / np . max ( lmd_dict [ R ] ) , lmd = lmd_optimized , name = '_R%d_Final Round' % R )
This method should replicate ICML experiment....
This method should replicate ICML experiment ....
# TODO ... """
    This method should replicate ICML experiment....
    
    :param R_search_space: 
    :param saver: 
    :param run_baseline: 
    :param run_oracle: 
    :param run_optimization: 
    :param T: 
    :param lr: 
    :return: 
    """ # baseline_lrate = args.lr * args.p_train * args.N_all_ / N_unflipped  # better lr of optimizer i'd say # could run for more iterations... # for ind in data.train.info['noisy examples']: #     lmd_oracle[ind] = 0. # i think we used this one in the paper # there's no reason to overweight the validation examples...
None
saver
None
run_baseline
None
run_oracle
None
run_optimization
None
T
None
lr
None
R_search_space
None