NewGLMNET is a batch method for solving Elastic Net regularized Logistic Regression problems of the form 0.5 (1-α) ||w|| 2 + α ||w|| 1 + C ∑ N i=1 ℓ (w T x i + b, y i ). For α
| 57 | * @author Edward Raff |
| 58 | */ |
| 59 | public class NewGLMNET implements WarmClassifier, Parameterized, SingleWeightVectorModel |
| 60 | { |
| 61 | |
| 62 | private static final long serialVersionUID = 4133368677783573518L; |
| 63 | //TODO make these other fields configurable as well |
| 64 | private static final double DEFAULT_BETA = 0.5; |
| 65 | private static final double DEFAULT_V = 1e-12; |
| 66 | private static final double DEFAULT_GAMMA = 0; |
| 67 | private static final double DEFAULT_SIGMA = 0.01; |
| 68 | /** |
| 69 | * The default tolerance for training is {@value #DEFAULT_EPS}. |
| 70 | */ |
| 71 | public static final double DEFAULT_EPS = 1e-2; |
| 72 | /** |
| 73 | * The default number of outer iterations of the training algorithm is |
| 74 | * {@value #DEFAULT_MAX_OUTER_ITER} . |
| 75 | */ |
| 76 | public static final int DEFAULT_MAX_OUTER_ITER = 100; |
| 77 | |
| 78 | /** |
| 79 | * Weight vector |
| 80 | */ |
| 81 | private Vec w; |
| 82 | /** |
| 83 | * Bias term |
| 84 | */ |
| 85 | private double b; |
| 86 | private double beta = DEFAULT_BETA; |
| 87 | private double v = DEFAULT_V; |
| 88 | private double gamma = DEFAULT_GAMMA; |
| 89 | private double sigma = DEFAULT_SIGMA; |
| 90 | private double C; |
| 91 | private double alpha; |
| 92 | private int maxOuterIters = DEFAULT_MAX_OUTER_ITER; |
| 93 | private double e_out = DEFAULT_EPS; |
| 94 | private boolean useBias = true; |
| 95 | /** |
| 96 | * The maximum allowed line-search steps |
| 97 | */ |
| 98 | private int maxLineSearchSteps = 20; |
| 99 | |
| 100 | /** |
| 101 | * Creates a new L<sub>1</sub> regularized Logistic Regression solver with |
| 102 | * C = 1. |
| 103 | */ |
| 104 | public NewGLMNET() |
| 105 | { |
| 106 | this(1); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Creates a new L<sub>1</sub> regularized Logistic Regression solver |
| 111 | * @param C the regularization term |
| 112 | */ |
| 113 | public NewGLMNET(double C) |
| 114 | { |
| 115 | this(C, 1); |
| 116 | } |
nothing calls this directly
no outgoing calls
no test coverage detected