L_range = [1, 2, 3]
no_threads = 2
no_folds = 10
output_file = "./results.txt"
files_nested_performances = [
    "./fold_%s.txt" % fold for fold in range(1, no_folds + 1)
]

# Construct the parameter search
parameter_search = [{
    'K': K,
    'L': L
} for (K, L) in itertools.product(K_range, L_range)]

# Load in the CCLE IC50 dataset
R, M = load_ccle(ic50=True)

# Run the cross-validation framework
#random.seed(42)
#numpy.random.seed(9000)
nested_crossval = MatrixNestedCrossValidation(
    method=NMTF,
    X=R,
    M=M,
    K=no_folds,
    P=no_threads,
    parameter_search=parameter_search,
    train_config=train_config,
    file_performance=output_file,
    files_nested_performances=files_nested_performances)
nested_crossval.run()
Exemple #2
0
init_UV = 'random'

K_range = [1, 2, 3]
no_folds = 10
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_vb_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)