Esempio n. 1
0
    'alphatau': alphatau,
    'betatau': betatau,
    'alpha0': alpha0,
    'beta0': beta0,
    'lambdaU': lambdaU,
    'lambdaV': lambdaV
}
''' Load in data. '''
R, M = load_gdsc_ic50()
I, J = M.shape
''' Generate matrices M - one list of M's for each value of K. '''
M_attempts = 1000
all_Ms_training_and_test = [
    compute_folds_attempts(I=I,
                           J=J,
                           no_folds=no_folds,
                           attempts=M_attempts,
                           M=M) for K in values_K
]
''' We now run the Gibbs sampler on each of the M's for each fraction. '''
all_performances = {metric: [] for metric in metrics}
average_performances = {metric: []
                        for metric in metrics}  # averaged over repeats
for K, (Ms_train, Ms_test) in zip(values_K, all_Ms_training_and_test):
    print "Trying K=%s." % K

    # Run the algorithm <repeats> times and store all the performances
    for metric in metrics:
        all_performances[metric].append([])
    for fold, (M_train, M_test) in enumerate(zip(Ms_train, Ms_test)):
        print "Fold %s of K=%s." % (fold + 1, K)
Esempio n. 2
0
lambdaF, lambdaS, lambdaG = 0.1, 0.1, 0.1
alphatau, betatau = 1., 1.
alpha0, beta0 = 1., 1.
hyperparams = { 'alphatau':alphatau, 'betatau':betatau, 'alpha0':alpha0, 'beta0':beta0, 'lambdaF':lambdaF, 'lambdaS':lambdaS, 'lambdaG':lambdaG }


''' Load in data. '''
R, M = load_ccle_ec50()
I, J = M.shape


''' Generate matrices M - one list of M's for each value of K. '''
M_attempts = 1000
all_Ms_training_and_test = [
    compute_folds_attempts(I=I,J=J,no_folds=no_folds,attempts=M_attempts,M=M)
    for KL in values_KL
]


''' We now run the Gibbs sampler on each of the M's for each fraction. '''
all_performances = {metric:[] for metric in metrics} 
average_performances = {metric:[] for metric in metrics} # averaged over repeats
for KL,(Ms_train,Ms_test) in zip(values_KL,all_Ms_training_and_test):
    print "Trying K,L=%s." % KL
    
    # Run the algorithm <repeats> times and store all the performances
    for metric in metrics:
        all_performances[metric].append([])
    for fold,(M_train,M_test) in enumerate(zip(Ms_train,Ms_test)):
        print "Fold %s of K,L=%s." % (fold+1, KL)