Loss
NonArchimedeanMachineLearning.MPE_loss_init — Method
MPE_loss_init(model::AbstractModel{S}, data::Vector{Tuple{ValuationPolydisc{S,T,N},U}}, p::Int) where {S,T,N,U}Initialize a Mean p-Power Error (MPE) loss function with polydisc-valued inputs.
Generalizes MSE by using the $\ell^p$ norm instead of $\ell^2$. Computes: $\mathcal{L}(\theta) = \frac{1}{n} \sum_{i=1}^n |f(x_i; \theta) - y_i|^p$
Arguments
model::AbstractModel{S}: The model structure specifying the function and parameter layoutdata::Vector{Tuple{ValuationPolydisc{S,T,N},U}}: Training data as(input_polydisc, output_value)pairsp::Int: The power for the loss (must be finite; for $p = \infty$ use sup loss - TODO)
Returns
Loss: Loss structure with closures for batch evaluation and gradient computation
NonArchimedeanMachineLearning.MPE_loss_init — Method
MPE_loss_init(model::AbstractModel{S}, data::Vector{Tuple{S,U}}, p::Int) where {S,U}Initialize a Mean p-Power Error (MPE) loss function with field-valued inputs.
Generalizes MSE using the $\ell^p$ norm with field-valued (not polydisc-valued) inputs. Specializes the model at each input and then uses typed evaluators.
Computes: $\mathcal{L}(\theta) = \frac{1}{n} \sum_{i=1}^n |f(x_i; \theta) - y_i|^p$
Arguments
model::AbstractModel{S}: The model structure specifying the function and parameter layoutdata::Vector{Tuple{S,U}}: Training data as(field_element_input, output_value)pairsp::Int: The power for the loss (must be finite; for $p = \infty$ use sup loss - TODO)
Returns
Loss: Loss structure with closures for batch evaluation and gradient computation
NonArchimedeanMachineLearning.MPE_loss_init — Method
MPE_loss_init(model::AbstractModel{S}, data::Vector{Tuple{Vector{S},U}}, p::Int) where {S, U}Initialize a Mean p-Power Error (MPE) loss function with vector-valued inputs.
Generalizes MPE for data where inputs are vectors of field elements (representing multivariate data points). Specializes the model at each input and then uses typed evaluators.
Computes: $\mathcal{L}(\theta) = \frac{1}{n} \sum_{i=1}^n |f(\mathbf{x}_i; \theta) - y_i|^p$
Arguments
model::AbstractModel{S}: The model structure specifying the function and parameter layoutdata::Vector{Tuple{Vector{S},U}}: Training data as(vector_of_field_elements, output_value)pairsp::Int: The power for the loss (must be finite; for $p = \infty$ use sup loss - TODO)
Returns
Loss: Loss structure with closures for batch evaluation and gradient computation
NonArchimedeanMachineLearning.MSE_loss_init — Method
MSE_loss_init(model::AbstractModel{S}, data::Vector{Tuple{ValuationPolydisc{S,T,N},U}}) where {S,T,N,U}Initialize a Mean Squared Error (MSE) loss function with polydisc-valued inputs.
Creates a Loss structure with batch evaluation and gradient functions for MSE loss: $\mathcal{L}(\theta) = \frac{1}{n} \sum_{i=1}^n (f(x_i; \theta) - y_i)^2$
Arguments
model::AbstractModel{S}: The model structure specifying the function and parameter layoutdata::Vector{Tuple{ValuationPolydisc{S,T,N},U}}: Training data as(input_polydisc, output_value)pairs
Returns
Loss: Loss structure with closures for batch evaluation and gradient computation
NonArchimedeanMachineLearning.MSE_loss_init — Method
MSE_loss_init(model::AbstractModel{S}, data::Vector{Tuple{S,U}}) where {S,U}Initialize a Mean Squared Error (MSE) loss function with field-valued inputs.
Creates a Loss structure for data where inputs are elements of the base field (not polydiscs). This variant specializes the model at each input and then uses batch evaluation.
Computes: $\mathcal{L}(\theta) = \frac{1}{n} \sum_{i=1}^n (f(x_i; \theta) - y_i)^2$
Arguments
model::AbstractModel{S}: The model structure specifying the function and parameter layoutdata::Vector{Tuple{S,U}}: Training data as(field_element_input, output_value)pairs
Returns
Loss: Loss structure with closures for batch evaluation and gradient computation
NonArchimedeanMachineLearning.MSE_loss_init_new — Method
MSE_loss_init_new(model::AbstractModel{S}, data::Vector{Tuple{S,U}}) where {S,U}Experimental MSE loss using a single composed function (slower, for profiling comparison).