sega_learn.neural_networks.numba_utils

 
Modules
       
numpy

 
Functions
       
apply_dropout_jit(X, dropout_rate)
Apply dropout to activation values.
calculate_bce_with_logits_loss(logits, targets)
Calculate binary cross-entropy loss with logits.
calculate_cross_entropy_loss(logits, targets)
Calculate cross-entropy loss for multi-class classification.
calculate_huber_loss(y_pred, y_true, delta=1.0)
Helper function to calculate the Huber loss. Handles 1D and 2D inputs.
calculate_loss_from_outputs_binary(outputs, y, weights, reg_lambda)
Calculate binary classification loss with L2 regularization.
calculate_loss_from_outputs_multi(outputs, y, weights, reg_lambda)
Calculate multi-class classification loss with L2 regularization.
calculate_mae_loss(y_pred, y_true)
Helper function to calculate the mean absolute error loss. Handles 1D and 2D inputs.
calculate_mse_loss(y_pred, y_true)
Helper function to calculate the mean squared error loss. Handles 1D and 2D inputs.
compute_l2_reg(weights)
Compute L2 regularization for weights.
evaluate_batch(y_hat, y_true, is_binary)
Evaluate accuracy for a batch of predictions.
evaluate_jit(y_hat, y_true, is_binary)
Evaluate model performance and return accuracy and predictions.
evaluate_regression_jit(y_pred, y_true, loss_function)
Evaluate model performance for regression tasks using Numba.
 
Args:
    y_pred (ndarray): Model predictions.
    y_true (ndarray): True target values.
    loss_function (object): The JIT loss function instance (e.g., JITMeanSquaredErrorLoss).
 
Returns:
    tuple: Metric value (e.g., MSE) and the predictions.
leaky_relu(z, alpha=0.01)
Apply Leaky ReLU activation function.
leaky_relu_derivative(z, alpha=0.01)
Compute the derivative of the Leaky ReLU activation function.
one_hot_encode(y, num_classes)
One-hot encode a vector of class labels.
process_batches_binary(X_shuffled, y_shuffled, batch_size, layers, dropout_rate, dropout_layer_indices, reg_lambda, dWs_acc, dbs_acc)
Process batches for binary classification.
process_batches_multi(X_shuffled, y_shuffled, batch_size, layers, dropout_rate, dropout_layer_indices, reg_lambda, dWs_acc, dbs_acc)
Process batches for multi-class classification.
process_batches_regression_jit(X_shuffled, y_shuffled, batch_size, layers, dropout_rate, dropout_layer_indices, reg_lambda, dWs_acc, dbs_acc, loss_calculator_func)
Process batches for regression tasks using Numba.
relu(z)
Apply ReLU activation function.
relu_derivative(z)
Compute the derivative of the ReLU activation function.
sigmoid(z)
Apply sigmoid activation function.
sigmoid_derivative(z)
Compute the derivative of the sigmoid activation function.
softmax(z)
Apply softmax activation function.
sum_axis0(arr)
Sum elements along axis 0.
sum_reduce(arr)
Sum elements along the last axis and reduce the array.
tanh(z)
Apply tanh activation function.
tanh_derivative(z)
Compute the derivative of the tanh activation function.

 
Data
        CACHE = False