Skip to content

Commit

Permalink
Merge pull request #1681 from karlnapf/develop
Browse files Browse the repository at this point in the history
speed ups for tests
  • Loading branch information
karlnapf committed Sep 26, 2013
2 parents eff23a5 + 7f21c9b commit f607173
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/undocumented/python_modular/mathematics_logdet.py
Expand Up @@ -6,7 +6,7 @@
# Loading an example sparse matrix of dimension 479x479, real, unsymmetric
mtx=mmread('../data/../logdet/west0479.mtx.gz')

parameter_list=[[mtx,10000,6000,1]]
parameter_list=[[mtx,100,60,1]]

def mathematics_logdet (matrix=mtx,max_iter_eig=1000,max_iter_lin=1000,num_samples=1):

Expand Down
Expand Up @@ -56,8 +56,9 @@ def modelselection_grid_search_krr_modular (fm_train=traindat,fm_test=testdat,la
cross_validation=CrossValidation(predictor, features_train, labels,
splitting_strategy, evaluation_criterium)

# (optional) repeat x-val 10 times
cross_validation.set_num_runs(10)
# (optional) repeat x-val (set larger to get better estimates, at least two
# for confidence intervals)
cross_validation.set_num_runs(2)

# (optional) request 95% confidence intervals for results (not actually needed
# for this toy example)
Expand Down Expand Up @@ -122,7 +123,7 @@ def create_param_tree():

param_gaussian_kernel=ModelSelectionParameters("kernel", gaussian_kernel)
gaussian_kernel_width=ModelSelectionParameters("width");
gaussian_kernel_width.build_values(5.0, 8.0, R_EXP, 1.0, 2.0)
gaussian_kernel_width.build_values(5.0, 6.0, R_EXP, 1.0, 2.0)
param_gaussian_kernel.append_child(gaussian_kernel_width)
root.append_child(param_gaussian_kernel)

Expand Down
Expand Up @@ -36,11 +36,11 @@ def modelselection_grid_search_liblinear_modular (traindat=traindat, label_train
param_tree_root=ModelSelectionParameters()
c1=ModelSelectionParameters("C1");
param_tree_root.append_child(c1)
c1.build_values(-2.0, 2.0, R_EXP);
c1.build_values(-1.0, 0.0, R_EXP);

c2=ModelSelectionParameters("C2");
param_tree_root.append_child(c2);
c2.build_values(-2.0, 2.0, R_EXP);
c2.build_values(-1.0, 0.0, R_EXP);

# training data
features=RealFeatures(traindat)
Expand Down
Expand Up @@ -64,8 +64,9 @@ def modelselection_grid_search_libsvr_modular (fm_train=traindat,fm_test=testdat
cross_validation=CrossValidation(predictor, features_train, labels,
splitting_strategy, evaluation_criterium)

# (optional) repeat x-val 10 times
cross_validation.set_num_runs(10)
# (optional) repeat x-val (set larger to get better estimates, at least two
# for confidence intervals)
cross_validation.set_num_runs(2)

# (optional) request 95% confidence intervals for results (not actually
# needed for this toy example)
Expand All @@ -79,11 +80,11 @@ def modelselection_grid_search_libsvr_modular (fm_train=traindat,fm_test=testdat
param_tree_root=ModelSelectionParameters()
c1=ModelSelectionParameters("C1");
param_tree_root.append_child(c1)
c1.build_values(-2.0, 2.0, R_EXP);
c1.build_values(-1.0, 0.0, R_EXP);

c2=ModelSelectionParameters("C2");
param_tree_root.append_child(c2);
c2.build_values(-2.0, 2.0, R_EXP);
c2.build_values(-1.0, 0.0, R_EXP);

# model selection instance
model_selection=GridSearchModelSelection(cross_validation, param_tree_root)
Expand Down

0 comments on commit f607173

Please sign in to comment.