Package model_descriptions :: Module linear_gradients
[hide private]
[frames] | no frames]

Module linear_gradients

source code

This module contains functions for linear gradients

Functions [hide private]
tuple
ell2_ball_constraint_avg(w, w_hat, steps, x, y, mu, B, stepsize)
Calculates and returns ell2 ball constraint avg
source code
double
hinge_loss(w, x, y)
Calculates and returns hinge loss
source code
double
sparse_hinge_loss(w, indexes, vecs, y)
Calculates hinge lss for sparse vectors and returns hinge loss value
source code
double
mse_loss(w, x, y)
Calculates and returns mse loss
source code
double
logit_loss_ss(w, index, vecs, y)
Calculates logit loss for sparse vectors and returns the value
source code
 
test()
Tests ell2 ball constraint and hinge loss functions
source code
 
lazy_shrink(w, current_time, timestamps, indexes, u)
Lazy shrink function
source code
 
incremental_average_sparse(w_hat, w, steps, indexes)
Incremental average sparse function
source code
 
l1_prox_lazy(w, what, timestamps, current_time, steps, stepsize, mu, B, indexes, vecs, y)
l1 prox lazy function
source code
 
svm_l1_prox_lazy(w, what, timestamps, current_time, steps, stepsize, mu, B, indexes, vecs, y)
svm l1 prox lazy function
source code
 
svm_l2_prox_lazy(w, what, wscale, steps, stepsize, mu, B, indexes, vecs, y)
svm l2 prox lazy function
source code
Function Details [hide private]

ell2_ball_constraint_avg(w, w_hat, steps, x, y, mu, B, stepsize)

source code 

Calculates and returns ell2 ball constraint avg

Parameters:
  • w (vector) - model vector
  • w_hat (vector) - w_hat vector
  • steps (number) - number of steps
  • x (vector) - feature vector of the example
  • y (number) - label of the example
  • mu (double) - mu
  • B (double) - B
  • stepsize (double) - step size
Returns: tuple
returns w, w_hat, # of steps, mu and B

hinge_loss(w, x, y)

source code 

Calculates and returns hinge loss

Parameters:
  • w (vector) - model vector
  • x (vector) - feature vector of the example
  • y (number) - label of the example
Returns: double
returns the hinge loss

sparse_hinge_loss(w, indexes, vecs, y)

source code 

Calculates hinge lss for sparse vectors and returns hinge loss value

Parameters:
  • w (vector) - model vector
  • indexes (vector) - indexes of the feature vector of the example
  • vecs (vector) - vector values of the feature vector of the example
  • y (number) - label of the example
Returns: double
returns the hinge loss

mse_loss(w, x, y)

source code 

Calculates and returns mse loss

Parameters:
  • w (vector) - model vector
  • x (vector) - feature vector of the example
  • y (number) - label of the example
Returns: double
returns the mse loss

logit_loss_ss(w, index, vecs, y)

source code 

Calculates logit loss for sparse vectors and returns the value

Parameters:
  • w (vector) - model vector
  • index (vector) - indexes of the feature vector of the example
  • vecs (vector) - vector values of the feature vector of the example
  • y (number) - label of the example
Returns: double
returns the logit loss

lazy_shrink(w, current_time, timestamps, indexes, u)

source code 

Lazy shrink function

Parameters:
  • w (vector) - model vector
  • current_time (double) - current time
  • timestamps (vector) - time stamps vector
  • indexes (vector) - indexes of the example
  • u (double) - u

incremental_average_sparse(w_hat, w, steps, indexes)

source code 

Incremental average sparse function

Parameters:
  • w_hat (vector) - w hat vector
  • w (vector) - model vector
  • steps (double) - steps of the incremental stage
  • indexes (vector) - indexes

l1_prox_lazy(w, what, timestamps, current_time, steps, stepsize, mu, B, indexes, vecs, y)

source code 

l1 prox lazy function

Parameters:
  • w (vector) - model vector
  • what (vector) - w hat
  • timestamps (vector) - time stamps vector
  • current_time (double) - current time
  • steps (double) - steps of the incremental stage
  • stepsize (number) - step size
  • mu (double) - mu
  • B (double) - B
  • indexes (vector) - indexes vector of the example's feature vector
  • vecs (vector) - vector values of the example's feature vector
  • y (number) - label of the example

svm_l1_prox_lazy(w, what, timestamps, current_time, steps, stepsize, mu, B, indexes, vecs, y)

source code 

svm l1 prox lazy function

Parameters:
  • w (vector) - model vector
  • what (vector) - w hat
  • timestamps (vector) - time stamps vector
  • current_time (double) - current time
  • steps (double) - steps of the incremental stage
  • stepsize (number) - step size
  • mu (double) - mu
  • B (double) - B
  • indexes (vector) - indexes vector of the example's feature vector
  • vecs (vector) - vector values of the example's feature vector
  • y (number) - label of the example

svm_l2_prox_lazy(w, what, wscale, steps, stepsize, mu, B, indexes, vecs, y)

source code 

svm l2 prox lazy function

Parameters:
  • w (vector) - model vector
  • what (vector) - w hat
  • wscale (double) - used to scale model vector(w)
  • steps (double) - steps of the incremental stage
  • stepsize (number) - step size
  • mu (double) - mu
  • B (double) - B
  • indexes (vector) - indexes vector of the example's feature vector
  • vecs (vector) - vector values of the example's feature vector
  • y (number) - label of the example