Losses#

helixnet.loss.BinaryCrossEntropy(y_pred, y_true)#

Binary cross-entropy useful for classification

helixnet.loss.CatCrossEntropy(y_pred, y_true)#

Performs categorical cross-entropy. Useful for classification

helixnet.loss.CosineSimilarityLoss(y_pred, y_true)#

When the direction of the embedding vectors is more important than their magnitude. It’s very common in NLP for comparing sentence embeddings

helixnet.loss.FocalLoss(y_pred_sigmoid, y_true, alpha=0.25, gamma=2.0)#

Crucial for imbalanced datasets in binary or multi-class classification (e.g., object detection where “background” is the most common class).

helixnet.loss.HingeLoss(y_pred, y_true)#

Primarily for “max-margin” classification, famously used in Support Vector Machines (SVMs). It’s great when you want to train a model that doesn’t just classify correctly but does so with a high degree of confidence.

Predictions should be in the [-1, 1] range.

helixnet.loss.HuberLoss(y_pred, y_true, delta=1.0)#

A great general-purpose regression loss that is less sensitive to outliers than MSE. It’s a fantastic default choice for many regression problems.

helixnet.loss.Kullback_Leibler(y_pred, y_true)#
helixnet.loss.LogCoshLoss(y_pred, y_true)#

A Very smooth loss function for regression that is less sensitive to outliers than MSE.

helixnet.loss.MeanAbsError(y_pred, y_true)#

Mean Absolute error loss. Useful for regression

helixnet.loss.MeanSquaredError(y_pred, y_true)#

Mean Squared error loss. Useful for regression

helixnet.loss.softmax_crossentropy(y_pred, y_true)#

Performs categorical cross-entropy but for models that use softmax as their last activation function. However it must accept the raw logits (without applying softmax for the last layers). Useful for classification