Package edu.cmu.tetrad.search.test
Class IndTestGin.OlsRidge
java.lang.Object
edu.cmu.tetrad.search.test.IndTestGin.OlsRidge
- All Implemented Interfaces:
- IndTestGin.Regressor
- Enclosing class:
- IndTestGin
Represents a ridge-regularized ordinary least squares (OLS) regressor. This implementation combines standard
 least-squares regression with a ridge penalty to enhance numerical stability and address multicollinearity when
 solving the regression problem.
 
 This class implements the Regressor interface, providing methods to compute residuals and return a
 descriptive name for the regressor.
- 
Constructor SummaryConstructorsConstructorDescriptionOlsRidge(double ridge) Constructs an instance of OlsRidge with the specified ridge parameter.
- 
Method SummaryModifier and TypeMethodDescriptionname()Returns the name of the regression model, including the ridge parameter value.double[]residuals(double[] target, double[][] predictors) Computes the residuals of a regression model by fitting the target values to the predictors using a least-squares approach with ridge stabilization.
- 
Constructor Details- 
OlsRidgepublic OlsRidge(double ridge) Constructs an instance of OlsRidge with the specified ridge parameter.- Parameters:
- ridge- The ridge regression parameter, which is used to control the regularization strength in ridge regression. A higher value indicates stronger regularization to prevent overfitting.
 
 
- 
- 
Method Details- 
nameReturns the name of the regression model, including the ridge parameter value.- Specified by:
- namein interface- IndTestGin.Regressor
- Returns:
- A string representing the name of the model in the format "OLS(ridge={value})", where {value} is the ridge parameter used in the model.
 
- 
residualspublic double[] residuals(double[] target, double[][] predictors) Computes the residuals of a regression model by fitting the target values to the predictors using a least-squares approach with ridge stabilization. The predictors are standardized, and an intercept is included in the model. If no predictors are provided, the residuals are calculated based on the mean of the target values.- Specified by:
- residualsin interface- IndTestGin.Regressor
- Parameters:
- target- The array of target values (dependent variable) for the model.
- predictors- The 2D array of predictors (independent variables) used in the regression. Each row corresponds to a data point, and each column corresponds to a predictor variable.
- Returns:
- An array of residuals, calculated as the difference between the target values and the predicted values, centered around zero.
 
 
-