Class DeterministicClusters
A variable is judged deterministic when the fraction of its variance left unexplained by a regression on the other continuous variables falls below a threshold: residual variance / marginal variance < threshold, a scale-free criterion. Which member of a deterministic cluster is written on the left-hand side is a representation choice, not a discovery -- every member is an exact function of the rest -- so callers presenting equations should invite the user to identify the DERIVED (definitional) variable where one exists.
Fitting many equations on a wide dataset goes through DeterministicClusters.Fitter, which computes the correlation matrix ONCE and
gets every leave-one-out regression at once from a single ridge-regularized precision matrix (the identity b_j =
-Ω_ij / Ω_ii, residual fraction 1 / (Ω_ii r_ii)), then screens each support down to the few
variables with non-negligible coefficients and refines exactly on that small set. One O(p^3) inversion serves all
variables; the per-variable work is a handful of small solves. The previous implementation recomputed the covariance
per call and pruned supports by greedy backward elimination (O(p^5) worst case per variable), which was unusable on
wide data with many deterministic relations.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne fitted constraint: determined = sum(coefficients * support) + intercept.static final classA reusable equation fitter for one dataset: the correlation matrix and its ridge-regularized inverse are computed once, and each equation costs a few small solves. -
Method Summary
Modifier and TypeMethodDescriptionconstraintFor(DataSet data, String varName, double threshold) Fits the equation writing the given variable as a function of the other continuous variables of the dataset.static List<DeterministicClusters.Constraint> Finds deterministic constraints among the continuous variables of the dataset: while some continuous variable has residual fraction below the threshold given the other active continuous variables, its (screened) support is pruned to a minimal set still meeting the threshold, the constraint is recorded, and the variable is removed from the active set -- so multiple and overlapping constraints are each reported once.
-
Method Details
-
find
Finds deterministic constraints among the continuous variables of the dataset: while some continuous variable has residual fraction below the threshold given the other active continuous variables, its (screened) support is pruned to a minimal set still meeting the threshold, the constraint is recorded, and the variable is removed from the active set -- so multiple and overlapping constraints are each reported once. Discrete variables are ignored.- Parameters:
data- The dataset.threshold- The residual-fraction threshold; 1e-8 detects exact relations up to rounding.- Returns:
- The detected constraints, one per independent deterministic relation; empty if none.
-
constraintFor
public static DeterministicClusters.Constraint constraintFor(DataSet data, String varName, double threshold) Fits the equation writing the given variable as a function of the other continuous variables of the dataset. The caller should check fractionResidual against its own threshold to label the equation exact or approximate. For fitting MANY equations on one dataset, construct aDeterministicClusters.Fitteronce instead: this convenience method rebuilds the shared matrices on every call.- Parameters:
data- The dataset.varName- The name of the variable to write on the left-hand side.threshold- The exactness threshold used in the pruning rule.- Returns:
- The fitted constraint, or null if the variable is not a continuous variable of the dataset or fewer than two continuous variables exist.
-