Cosine Embedding Loss function is used for measuring whether two inputs are similar or dissimilar, using the cosine distance, and is typically used for learning nonlinear embeddings or semi-supervised learning.
More...
template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::CosineEmbeddingLoss< InputDataType, OutputDataType >
Cosine Embedding Loss function is used for measuring whether two inputs are similar or dissimilar, using the cosine distance, and is typically used for learning nonlinear embeddings or semi-supervised learning.
- Template Parameters
-
| InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
| OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 39 of file cosine_embedding_loss.hpp.
◆ CosineEmbeddingLoss()
| CosineEmbeddingLoss |
( |
const double |
margin = 0.0, |
|
|
const bool |
similarity = true, |
|
|
const bool |
takeMean = false |
|
) |
| |
Create the CosineEmbeddingLoss object.
- Parameters
-
| margin | Increases cosine distance in case of dissimilarity. Refer definition of cosine-embedding-loss above. |
| similarity | Determines whether to use similarity or dissimilarity for comparision. |
| takeMean | Boolean variable to specify whether to take mean or not. Specifies reduction method i.e. sum or mean corresponding to 0 and 1 respectively. Default value = 0. |
◆ Backward()
| void Backward |
( |
const InputType & |
input, |
|
|
const TargetType & |
target, |
|
|
OutputType & |
output |
|
) |
| |
Ordinary feed backward pass of a neural network.
- Parameters
-
| input | The propagated input activation. |
| target | The target vector. |
| output | The calculated error. |
◆ Delta() [1/2]
| OutputDataType& Delta |
( |
| ) |
const |
|
inline |
◆ Delta() [2/2]
| OutputDataType& Delta |
( |
| ) |
|
|
inline |
◆ Forward()
| InputType::elem_type Forward |
( |
const InputType & |
input, |
|
|
const TargetType & |
target |
|
) |
| |
Ordinary feed forward pass of a neural network.
- Parameters
-
| input | Input data used for evaluating the specified function. |
| target | The target vector. |
◆ InputParameter() [1/2]
| InputDataType& InputParameter |
( |
| ) |
const |
|
inline |
◆ InputParameter() [2/2]
| InputDataType& InputParameter |
( |
| ) |
|
|
inline |
◆ Margin() [1/2]
◆ Margin() [2/2]
◆ OutputParameter() [1/2]
| OutputDataType& OutputParameter |
( |
| ) |
const |
|
inline |
◆ OutputParameter() [2/2]
| OutputDataType& OutputParameter |
( |
| ) |
|
|
inline |
◆ serialize()
| void serialize |
( |
Archive & |
ar, |
|
|
const unsigned |
int |
|
) |
| |
◆ Similarity() [1/2]
| bool Similarity |
( |
| ) |
const |
|
inline |
◆ Similarity() [2/2]
◆ TakeMean() [1/2]
◆ TakeMean() [2/2]
The documentation for this class was generated from the following file: