aboutsummaryrefslogtreecommitdiff
path: root/gensvm
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2017-12-28 07:40:07 -0500
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2017-12-28 07:40:07 -0500
commit778146de536498111f2c9e50ce400c354ee6e77f (patch)
tree9f4a044091f600c35bf0a66528368087cc98a4ac /gensvm
parentadd citation entry to readme (diff)
downloadpygensvm-778146de536498111f2c9e50ce400c354ee6e77f.tar.gz
pygensvm-778146de536498111f2c9e50ce400c354ee6e77f.zip
add function to load grid used in paper
Diffstat (limited to 'gensvm')
-rw-r--r--gensvm/gridsearch.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/gensvm/gridsearch.py b/gensvm/gridsearch.py
index 6161e0b..a241d8a 100644
--- a/gensvm/gridsearch.py
+++ b/gensvm/gridsearch.py
@@ -573,3 +573,40 @@ class GenSVMGridSearchCV(BaseEstimator, MetaEstimatorMixin):
"""
_skl_check_is_fitted(self, 'predict', self.refit)
return self.best_estimator_.predict(X)
+
+
+def load_default_grid():
+ """Load the default parameter grid for GenSVM
+
+ This is the parameter grid used in the GenSVM paper to run the grid search
+ experiments. It uses a large grid for the ``lmd`` regularization parameter
+ and converges with a stopping criterion of ``1e-8``. This is a relatively
+ small stopping criterion and in practice good classification results can be
+ obtained by using a larger stopping criterion.
+
+ The function returns the following grid::
+
+ pg = {
+ 'lmd': [pow(2, x) for x in range(-18, 19, 2)],
+ 'kappa': [-0.9, 0.5, 5.0],
+ 'p': [1.0, 1.5, 2.0],
+ 'weights': ['unit', 'group'],
+ 'epsilon': [1e-8],
+ 'kernel': ['linear']
+ }
+
+ Returns
+ -------
+ pg : dict
+ Mapping from parameters to lists of values for those parameters. To be
+ used as input for the :class:`.GenSVMGridSearchCV` class.
+ """
+ pg = {
+ 'lmd': [pow(2, x) for x in range(-18, 19, 2)],
+ 'kappa': [-0.9, 0.5, 5.0],
+ 'p': [1.0, 1.5, 2.0],
+ 'weights': ['unit', 'group'],
+ 'epsilon': [1e-8],
+ 'kernel': ['linear']
+ }
+ return pg