SHOGUN  6.0.0
Functions
shogun::linalg::special_purpose Namespace Reference

Functions

template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
void logistic (Matrix A, Matrix result)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
void multiply_by_logistic_derivative (Matrix A, Matrix C)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
void rectified_linear (Matrix A, Matrix result)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
void multiply_by_rectified_linear_derivative (Matrix A, Matrix C)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
void softmax (Matrix A)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
Matrix::Scalar cross_entropy (Matrix P, Matrix Q)
 
template<Backend backend = linalg_traits<Linsolver>::backend, class Matrix >
Matrix::Scalar squared_error (Matrix P, Matrix Q)
 

Detailed Description

Contains special purpose, algorithm specific functions. Uses the same backend as the Core module

Function Documentation

◆ cross_entropy()

Matrix::Scalar shogun::linalg::special_purpose::cross_entropy ( Matrix  P,
Matrix  Q 
)

Returns the cross entropy between P and Q. The cross entropy is defined as \( H(P,Q) = - \sum_{ij} P[i,j]log(Q[i,j]) \)

Definition at line 90 of file modules/SpecialPurpose.h.

◆ logistic()

void shogun::linalg::special_purpose::logistic ( Matrix  A,
Matrix  result 
)

Applies the elementwise logistic function f(x) = 1/(1+exp(-x)) to a matrix

Definition at line 51 of file modules/SpecialPurpose.h.

◆ multiply_by_logistic_derivative()

void shogun::linalg::special_purpose::multiply_by_logistic_derivative ( Matrix  A,
Matrix  C 
)

Performs the operation C(i,j) = C(i,j) * A(i,j) * (1.0-A(i,j) for all i and j

Definition at line 58 of file modules/SpecialPurpose.h.

◆ multiply_by_rectified_linear_derivative()

void shogun::linalg::special_purpose::multiply_by_rectified_linear_derivative ( Matrix  A,
Matrix  C 
)

Performs the operation C(i,j) = C(i,j) * (A(i,j)!=0) for all i and j

Definition at line 72 of file modules/SpecialPurpose.h.

◆ rectified_linear()

void shogun::linalg::special_purpose::rectified_linear ( Matrix  A,
Matrix  result 
)

Applies the elementwise rectified linear function f(x) = max(0,x) to a matrix

Definition at line 65 of file modules/SpecialPurpose.h.

◆ softmax()

void shogun::linalg::special_purpose::softmax ( Matrix  A)

Applies the softmax function inplace to a matrix. The softmax function is defined as \( f(A[i,j]) = \frac{exp(A[i,j])}{\sum_i exp(A[i,j])} \)

Definition at line 81 of file modules/SpecialPurpose.h.

◆ squared_error()

Matrix::Scalar shogun::linalg::special_purpose::squared_error ( Matrix  P,
Matrix  Q 
)

Returns the squared error between P and Q. The squared error is defined as \( E(P,Q) = \frac{1}{2} \sum_{ij} (P[i,j]-Q[i,j])^2 \)

Definition at line 99 of file modules/SpecialPurpose.h.


SHOGUN Machine Learning Toolbox - Documentation