本文整理汇总了Python中BMF_Priors.code.cross_validation.nested_matrix_cross_validation.MatrixNestedCrossValidation.run方法的典型用法代码示例。如果您正苦于以下问题:Python MatrixNestedCrossValidation.run方法的具体用法?Python MatrixNestedCrossValidation.run怎么用?Python MatrixNestedCrossValidation.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMF_Priors.code.cross_validation.nested_matrix_cross_validation.MatrixNestedCrossValidation
的用法示例。
在下文中一共展示了MatrixNestedCrossValidation.run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from BMF_Priors.code.cross_validation.nested_matrix_cross_validation import MatrixNestedCrossValidation [as 别名]
# 或者: from BMF_Priors.code.cross_validation.nested_matrix_cross_validation.MatrixNestedCrossValidation import run [as 别名]
''' Settings nested cross-validation. '''
K_range = [1,2,3,4,5,6,7]
no_folds = 5
no_threads = 5
parallel = False
folder_results = './results/gaussian_gaussian_ard/'
output_file = folder_results+'results.txt'
files_nested_performances = [folder_results+'fold_%s.txt'%(fold+1) for fold in range(no_folds)]
''' Construct the parameter search. '''
parameter_search = [{'K':K, 'hyperparameters':hyperparameters} for K in K_range]
''' Run the cross-validation framework. '''
nested_crossval = MatrixNestedCrossValidation(
method=method,
R=R,
M=M,
K=no_folds,
P=no_threads,
parameter_search=parameter_search,
train_config=train_config,
predict_config=predict_config,
file_performance=output_file,
files_nested_performances=files_nested_performances,
)
nested_crossval.run(parallel=parallel)
示例2: range
# 需要导入模块: from BMF_Priors.code.cross_validation.nested_matrix_cross_validation import MatrixNestedCrossValidation [as 别名]
# 或者: from BMF_Priors.code.cross_validation.nested_matrix_cross_validation.MatrixNestedCrossValidation import run [as 别名]
''' Settings nested cross-validation. '''
K_range = [3,4,5,6,7]
no_folds = 5
no_threads = 5
stratify_rows = False
parallel = False
folder_results = './results/gaussian_exponential_ard/'
output_file = folder_results+'results.txt'
files_nested_performances = [folder_results+'fold_%s.txt'%(fold+1) for fold in range(no_folds)]
''' Construct the parameter search. '''
parameter_search = [{'K':K, 'hyperparameters':hyperparameters} for K in K_range]
''' Run the cross-validation framework. '''
nested_crossval = MatrixNestedCrossValidation(
method=method,
R=R,
M=M,
K=no_folds,
P=no_threads,
parameter_search=parameter_search,
train_config=train_config,
predict_config=predict_config,
file_performance=output_file,
files_nested_performances=files_nested_performances,
)
nested_crossval.run(parallel=parallel, stratify_rows=stratify_rows)