MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / tenativeUpdate

Method tenativeUpdate

JSAT/src/jsat/classifiers/linear/BBR.java:515–546  ·  view source on GitHub ↗

Gets the tentative update δ vj @param columnMajor the column major vector array. May be null if using the implicit bias term @param j the column to work on @param w_j the value of the coefficient, used only under Gaussian prior @param y the array of label values @param r the array o

(final Vec[] columnMajor, final int j, final double w_j, final double[] y, final double[] r, final double lambda, final double s, final double[] delta)

Source from the content-addressed store, hash-verified

513 * @return the tentative update value
514 */
515 private double tenativeUpdate(final Vec[] columnMajor, final int j, final double w_j, final double[] y, final double[] r, final double lambda, final double s, final double[] delta)
516 {
517 double numer = 0, denom = 0;
518 if (columnMajor != null)
519 {
520 Vec col_j = columnMajor[j];
521 if (col_j.nnz() == 0)
522 return 0;
523 for (IndexValue iv : col_j)
524 {
525 final double x_ij = iv.getValue();
526 final int i = iv.getIndex();
527 numer += x_ij * y[i] / (1 + exp(r[i]));
528 denom += x_ij * x_ij * F(r[i], delta[j] * abs(x_ij));
529 if (prior == Prior.LAPLACE)
530 numer -= lambda * s;
531 else
532 {
533 numer -= w_j / lambda;
534 denom += 1 / lambda;
535 }
536 }
537 }
538 else//bias term, all x_ij = 1
539 for (int i = 0; i < y.length; i++)
540 {
541 numer += y[i] / (1 + exp(r[i])) - lambda * s;
542 denom += F(r[i], delta[j]);
543 }
544
545 return numer / denom;
546 }
547
548 @Override
549 public List<Parameter> getParameters()

Callers 1

trainCMethod · 0.95

Calls 5

nnzMethod · 0.95
FMethod · 0.95
expMethod · 0.80
getValueMethod · 0.45
getIndexMethod · 0.45

Tested by

no test coverage detected