restarts = 1

quality_metric = 'AIC'
output_file = "./results.txt"

alpha, beta = 1., 1.
lambdaU = 1./10.
lambdaV = 1./10.
priors = { 'alpha':alpha, 'beta':beta, 'lambdaU':lambdaU, 'lambdaV':lambdaV }

# Load in the CCLE EC50 dataset
R,M = load_ccle(ic50=False)

# Run the cross-validation framework
#random.seed(42)
#numpy.random.seed(9000)
nested_crossval = LineSearchCrossValidation(
    classifier=bnmf_gibbs_optimised,
    R=R,
    M=M,
    values_K=K_range,
    folds=no_folds,
    priors=priors,
    init_UV=init_UV,
    iterations=iterations,
    restarts=restarts,
    quality_metric=quality_metric,
    file_performance=output_file
)
nested_crossval.run(burn_in=burn_in,thinning=thinning)
minimum_TN = 0.1

# Load in the Sanger dataset
(_,X_min,M,_,_,_,_) = load_gdsc(standardised=standardised)

# Run the cross-validation framework
#random.seed(42)
#numpy.random.seed(9000)
nested_crossval = LineSearchCrossValidation(
    classifier=nmf_icm,
    R=X_min,
    M=M,
    values_K=K_range,
    folds=no_folds,
    priors=priors,
    init_UV=init_UV,
    iterations=iterations,
    restarts=restarts,
    quality_metric=quality_metric,
    file_performance=output_file
)
nested_crossval.run(minimum_TN=minimum_TN)

"""
all_MSE = [3.5039148405029135, 9.0622730084824674, 3.7009069757338917, 3.3451246835265178, 3.1147595748400358, 3.9037354439533258, 13.991970030783968, 3.1814210224127897, 3.2677197491020404, 12.460551868851933]
all_R2 = [0.7072309782081623, 0.2162669348625822, 0.6853079551313846, 0.7144108917311998, 0.7341480430315861, 0.6671037956836574, -0.17013019643779437, 0.7288988508164431, 0.7201731755424339, -0.07478035943340289]

Average MSE: 5.953237719818989 +- 16.165927731904752
Average R^2: 0.49286300691362522 +- 0.11663176700952635
"""
Example #3
0
lambdaV = 1./10.
priors = { 'alpha':alpha, 'beta':beta, 'lambdaU':lambdaU, 'lambdaV':lambdaV }

# Load in the Sanger dataset
(_,X_min,M,_,_,_,_) = load_Sanger(standardised=standardised)

# Run the cross-validation framework
random.seed(42)
numpy.random.seed(9000)
nested_crossval = LineSearchCrossValidation(
    classifier=bnmf_vb_optimised,
    R=X_min,
    M=M,
    values_K=K_range,
    folds=no_folds,
    priors=priors,
    init_UV=init_UV,
    iterations=iterations,
    restarts=restarts,
    quality_metric=quality_metric,
    file_performance=output_file
)
nested_crossval.run()

"""
All model fits for fold 1, metric AIC: [255811.96901730512, 252136.60278205923, 250856.47342754889, 250226.77983334119, 248494.30974350378].
Best K for fold 1: 10.
Performance: {'R^2': 0.8062985415424776, 'MSE': 2.2509307850276188, 'Rp': 0.89865828998196062}.

All model fits for fold 2, metric AIC: [254648.23575785581, 252738.04961239398, 251251.00158825511, 249894.09518978855, 249008.72134400008].
Best K for fold 2: 10.
Example #4
0
lambdaU = 1. / 10.
lambdaV = 1. / 10.
priors = {'alpha': alpha, 'beta': beta, 'lambdaU': lambdaU, 'lambdaV': lambdaV}

# Load in the Sanger dataset
(_, X_min, M, _, _, _, _) = load_Sanger(standardised=standardised)

# Run the cross-validation framework
random.seed(42)
numpy.random.seed(9000)
nested_crossval = LineSearchCrossValidation(classifier=bnmf_vb_optimised,
                                            R=X_min,
                                            M=M,
                                            values_K=K_range,
                                            folds=no_folds,
                                            priors=priors,
                                            init_UV=init_UV,
                                            iterations=iterations,
                                            restarts=restarts,
                                            quality_metric=quality_metric,
                                            file_performance=output_file)
nested_crossval.run()
"""
All model fits for fold 1, metric AIC: [255811.96901730512, 252136.60278205923, 250856.47342754889, 250226.77983334119, 248494.30974350378].
Best K for fold 1: 10.
Performance: {'R^2': 0.8062985415424776, 'MSE': 2.2509307850276188, 'Rp': 0.89865828998196062}.

All model fits for fold 2, metric AIC: [254648.23575785581, 252738.04961239398, 251251.00158825511, 249894.09518978855, 249008.72134400008].
Best K for fold 2: 10.
Performance: {'R^2': 0.8034479975799519, 'MSE': 2.2875509346902207, 'Rp': 0.8971303533111219}.