Exemple #1
0
alpha0, beta0 = 1., 1.
hyperparams = {
    'alphatau': alphatau,
    'betatau': betatau,
    'alpha0': alpha0,
    'beta0': beta0,
    'lambdaU': lambdaU,
    'lambdaV': lambdaV
}
''' Load in data. '''
R, M = load_ctrp_ec50()
I, J = M.shape
''' Generate matrices M - one list of M's for each fraction. '''
M_attempts = 1000
all_Ms = [[
    try_generate_M(I=I, J=J, fraction=fraction, attempts=M_attempts, M=M)[0]
    for r in range(repeats)
] for fraction in fractions_unknown]
all_Ms_test = [[calc_inverse_M(M_train, M_combined=M) for M_train in Ms]
               for Ms in all_Ms]
''' Make sure each matrix has no empty rows or columns. '''


def check_empty_rows_columns(matrix, fraction):
    sums_columns = matrix.sum(axis=0)
    sums_rows = matrix.sum(axis=1)
    for i, c in enumerate(sums_rows):
        assert c != 0, "Fully unobserved row in matrix, row %s. Fraction %s." % (
            i, fraction)
    for j, c in enumerate(sums_columns):
        assert c != 0, "Fully unobserved column in matrix, column %s. Fraction %s." % (
Exemple #2
0
ARD = False

lambdaU, lambdaV = 0.1, 0.1
alphatau, betatau = 1., 1.
alpha0, beta0 = 1., 1.
hyperparams = { 'alphatau':alphatau, 'betatau':betatau, 'alpha0':alpha0, 'beta0':beta0, 'lambdaU':lambdaU, 'lambdaV':lambdaV }


''' Load in data. '''
R = numpy.loadtxt(input_folder+"R.txt")


''' Generate matrices M - one list of M's for each fraction. '''
M_attempts = 100
all_Ms = [ 
    [try_generate_M(I,J,fraction,M_attempts)[0] for r in range(0,repeats)]
    for fraction in fractions_unknown
]
all_Ms_test = [ [calc_inverse_M(M) for M in Ms] for Ms in all_Ms ]


''' Make sure each M has no empty rows or columns. '''
def check_empty_rows_columns(M,fraction):
    sums_columns = M.sum(axis=0)
    sums_rows = M.sum(axis=1)
    for i,c in enumerate(sums_rows):
        assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (i,fraction)
    for j,c in enumerate(sums_columns):
        assert c != 0, "Fully unobserved column in M, column %s. Fraction %s." % (j,fraction)
        
for Ms,fraction in zip(all_Ms,fractions_unknown):
Exemple #3
0
''' Model settings. '''
iterations = 1000

init_UV = 'random'
K = 1


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


''' Generate matrices M - one list of M's for each fraction. '''
M_attempts = 1000
all_Ms = [ 
    [try_generate_M(I=I,J=J,fraction=fraction,attempts=M_attempts,M=M)[0] for r in range(repeats)]
    for fraction in fractions_unknown
]
all_Ms_test = [ [calc_inverse_M(M_train, M_combined=M) for M_train in Ms] for Ms in all_Ms ]


''' Make sure each M has no empty rows or columns. '''
def check_empty_rows_columns(matrix,fraction):
    sums_columns = matrix.sum(axis=0)
    sums_rows = matrix.sum(axis=1)
    for i,c in enumerate(sums_rows):
        assert c != 0, "Fully unobserved row in matrix, row %s. Fraction %s." % (i,fraction)
    for j,c in enumerate(sums_columns):
        assert c != 0, "Fully unobserved column in matrix, column %s. Fraction %s." % (j,fraction)
        
for Ms,fraction in zip(all_Ms,fractions_unknown):
Exemple #4
0
    'alphatau': alphatau,
    'betatau': betatau,
    'alpha0': alpha0,
    'beta0': beta0,
    'lambdaF': lambdaF,
    'lambdaS': lambdaS,
    'lambdaG': lambdaG
}

metrics = ['MSE', 'R^2', 'Rp']
''' Load in data, without noise. '''
R_true = numpy.loadtxt(input_folder + "R_true.txt")
''' For each noise ratio, generate mask matrices for each attempt. '''
M_attempts = 100
all_Ms = [[
    try_generate_M(I, J, fraction_unknown, M_attempts)
    for r in range(0, repeats)
] for noise in noise_ratios]
all_Ms_test = [[calc_inverse_M(M) for M in Ms] for Ms in all_Ms]
''' Make sure each M has no empty rows or columns. '''


def check_empty_rows_columns(M, fraction):
    sums_columns = M.sum(axis=0)
    sums_rows = M.sum(axis=1)
    for i, c in enumerate(sums_rows):
        assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (
            i, fraction)
    for j, c in enumerate(sums_columns):
        assert c != 0, "Fully unobserved column in M, column %s. Fraction %s." % (
            j, fraction)
Exemple #5
0
lambdaV = numpy.ones((J,K))/10.
alphatau, betatau = 1., 1.
alpha0, beta0 = 1., 1.
hyperparams = { 'alphatau':alphatau, 'betatau':betatau, 'alpha0':alpha0, 'beta0':beta0, 'lambdaU':lambdaU, 'lambdaV':lambdaV }

metrics = ['MSE', 'R^2', 'Rp']


''' Load in data, without noise. '''
R_true = numpy.loadtxt(input_folder+"R_true.txt")


''' For each noise ratio, generate mask matrices for each attempt. '''
M_attempts = 100
all_Ms = [ 
    [try_generate_M(I,J,fraction_unknown,M_attempts) for r in range(0,repeats)]
    for noise in noise_ratios
]
all_Ms_test = [ [calc_inverse_M(M) for M in Ms] for Ms in all_Ms ]


''' Make sure each M has no empty rows or columns. '''
def check_empty_rows_columns(M,fraction):
    sums_columns = M.sum(axis=0)
    sums_rows = M.sum(axis=1)
    for i,c in enumerate(sums_rows):
        assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (i,fraction)
    for j,c in enumerate(sums_columns):
        assert c != 0, "Fully unobserved column in M, column %s. Fraction %s." % (j,fraction)
        
for Ms in all_Ms: