Package vsql_core :: Package utils :: Module victor_utils
[hide private]
[frames] | no frames]

Module victor_utils

source code

This module contains generic utilities that can be used by any model.

Functions [hide private]
double
dot(u, v)
Computes and returns the dot product of given two vectors
source code
 
grad(w, b, x, y) source code
vector
scale(w, b)
Scales the given vector with the given scale factor and return it
source code
vector
scale_and_add(x, y, s)
Scales given vector y and add it to the x and return it
source code
double
dot_ds(dx, sy)
Computes and returns dot product of two vectors (at least one of them is sparse)
source code
double
sigma(v)
Returns sigma valu
source code
 
scale_i(x, c)
Scales the given vector
source code
 
scale_and_add_i(x, y, c)
Scales y and adds it to x x += y * c
source code
 
scale_and_add_ds(dx, sz, c)
Scales sz (which is sparse) and adds it to x dx += sz * c
source code
double
dot_dss(w, ks, vs)
Calculates and returns dot products of w and vs
source code
 
scale_and_add_dss(w, index, vectors, c)
Scales vectors and adds it to w
source code
 
l2_project(x, B)
l2 project function
source code
 
l1_shrink(x, u)
l1 shrink function
source code
 
l1_shrink_mask(x, u, indexes)
l1 shrink function
source code
 
incremental_average(w_hat, w, steps)
Incremental average function
source code
Function Details [hide private]

dot(u, v)

source code 

Computes and returns the dot product of given two vectors

Parameters:
  • u (vector) - vector1
  • v (vector) - vector2
Returns: double
dot product value of the vectors

scale(w, b)

source code 

Scales the given vector with the given scale factor and return it

Parameters:
  • w (vector) - vector to be scaled
  • b (double) - scale factor
Returns: vector
scaled vector

scale_and_add(x, y, s)

source code 

Scales given vector y and add it to the x and return it

Parameters:
  • x (vector) - vector to be added with the scaled one
  • y (vector) - vector to be scaled
  • s (double) - scale factor
Returns: vector
x + y * s

dot_ds(dx, sy)

source code 

Computes and returns dot product of two vectors (at least one of them is sparse)

Parameters:
  • dx (vector) - first component of the dot product
  • sy (vector) - second component of the dot product
Returns: double
dot product of dx and sy

sigma(v)

source code 

Returns sigma valu

Parameters:
  • v (double) - v
Returns: double
sigma value of v

scale_i(x, c)

source code 

Scales the given vector

Parameters:
  • x (vector) - vector to be scaled
  • c (double) - scale factor

scale_and_add_i(x, y, c)

source code 

Scales y and adds it to x x += y * c

Parameters:
  • x (vector) - vector to be modified
  • y (vector) - vector to be scaled and added to x
  • c (double) - scale factor

scale_and_add_ds(dx, sz, c)

source code 

Scales sz (which is sparse) and adds it to x dx += sz * c

Parameters:
  • dx (vector) - vector to be modified
  • sz (vector) - vector to be scaled and added to dx
  • c (double) - scale factor

dot_dss(w, ks, vs)

source code 

Calculates and returns dot products of w and vs

Parameters:
  • w (vector) - first component of the dot product
  • ks (vector) - indexes of the sparse vector
  • vs (vector) - values of the sparse vector
Returns: double
dot product of two vectors

scale_and_add_dss(w, index, vectors, c)

source code 

Scales vectors and adds it to w

Parameters:
  • w (vector) - vector to be modified
  • index (vector) - indexes of the sparse vector
  • vectors (vector) - values of the sparse vector
  • c (double) - scale factor

l2_project(x, B)

source code 

l2 project function

Parameters:
  • x (vector) - x
  • B (double) - B

l1_shrink(x, u)

source code 

l1 shrink function

Parameters:
  • x (vector) - x
  • u (double) - u

l1_shrink_mask(x, u, indexes)

source code 

l1 shrink function

Parameters:
  • x (vector) - x
  • u (double) - B
  • indexes (vector) - indexes of the sparse vector

incremental_average(w_hat, w, steps)

source code 

Incremental average function

Parameters:
  • w_hat (vector) - w hat
  • w (vector) - model vector
  • steps (number) - steps