Extract coefficients from fitted ellipsoid learner
coef.LearnerSubspaceEllipsoid.RdExtracts fitted subspace parameters from a trained LearnerSubspaceEllipsoid
object. Returns the transformation matrix \(A\) and translation vector \(b\)
that define the fitted ellipsoid.
Usage
# S3 method for class 'LearnerSubspaceEllipsoid'
coef(object, ...)Value
A data.table with columns:
hyperparameters: List column containing hyperparameter namesA: List column of positive definite matrices defining ellipsoid shape and orientationb: List column of translation vectorscat_hp: Categorical level (only if task has categorical hyperparameters)
Details
The ellipsoid is defined by \(\|Ax + b\|_2 \leq 1\) where:
\(A \in \mathbb{R}^{p \times p}\) is a positive definite matrix
\(b \in \mathbb{R}^p\) is the translation vector
\(x\) are points inside the ellipsoid in original coordinates
The center of the ellipsoid is: \(c = -A^{-1}b\)
The semi-axes lengths and orientations are determined by the eigendecomposition of \(A^{-1}\): if \(A^{-1} = V\Lambda V^T\), then the semi-axes have lengths \(\sqrt{\lambda_i}\) in directions given by columns of \(V\).
When the task includes categorical hyperparameters, separate coefficient sets
are returned for each categorical level, identified by the cat_hp column.
Error Handling
Throws an error if the learner has not been trained. Call train() before
extracting coefficients.
See also
LearnerSubspaceEllipsoid for the learner class.
coef.LearnerSubspaceBox for the axis-aligned variant.
coef.LearnerSubspacePolygon for the oriented hyperrectangle variant.
Examples
if (FALSE) { # \dontrun{
# Train learner
task <- TaskSubspace$new(data, target_measure = "auc",
hps = c("learning_rate", "max_depth"))
learner <- LearnerSubspaceEllipsoid$new(task)
learner$train(q_val = 0.9, lambda = 0.1)
# Extract coefficients
coefs <- coef(learner)
print(coefs$A[[1]]) # Shape matrix
print(coefs$b[[1]]) # Translation vector
# Compute ellipsoid center
A <- coefs$A[[1]]
b <- coefs$b[[1]]
center <- -solve(A) %*% b
# Compute semi-axes
A_inv <- solve(A)
eigen_decomp <- eigen(A_inv)
semi_axes <- sqrt(eigen_decomp$values)
directions <- eigen_decomp$vectors
} # }