# Lasso of MATLAB generalized linear model GLM Poisson regression, regularization of elastic network, classification, prediction of test score data and visualization of cross validation

Time：2022-5-28

Building datasets with redundant predictors and using`Lasso and GLM`Identify these predictors.

### apply`lasso`Regularization to remove redundant prediction variables

Create a`X`A random matrix containing 100 observations and 10 prediction variables.`y`Only four predictive variables and a small amount of noise are used to create a normally distributed dependent variable.

``````Default
randn ;

X* weight + randn*0.1; % small additional noise``````

implement`lasso`Regularization.

``lasso``

Find the 75th`Lambda`Coefficient vector of values`B` `lassoglm`Identify and delete redundant predictive variables.

# Cross validation of generalized linear models`lasso`Regularization

Build data from Poisson model and use`lasso`Identify important predictors.

Create data with 20 predictors. Only three predictors plus a constant are used to create the Poisson dependent variable.

``````RNG% for reproducibility
randn

exp(X)*weights + 1``````

Cross validation of Poisson regression model with constructed data`lasso`Regularization.

Check the cross validation diagram to see`Lambda`Effect of regularization parameters.

``````Plot('CV');
legend`````` Green circle and dotted line positioning`Lambda`The position where the cross validation error is minimum. The blue circle and dotted line locate the point with the minimum cross validation error plus one standard deviation.

Find the non-zero model coefficients corresponding to the two identification points.

``````FitInf
find(B`````` ``````FitInf
min1fnd(B)`````` The coefficients from the minimum plus one standard error point are the ones used to create the data.

# apply`lasso`Regularized predictor

Load the student test score data set. Convert the last exam result into a logical vector, where`1`More than 80`0`The score of represents the score below 80.

``ynm = (y>=80);``

The data is divided into training set and test set.

``````RNG default% set the seed of repeatability
Xi = X(iTain,:);
yran = yBinom
yTe = yBinom``````

Perform 3-fold cross validation on the training data and perform regression on the generalized linear model`lasso`Regularization. Values in assumptions`y`Is binomial. Select corresponding to`Lambda`Model coefficient for the minimum expected deviation.

``````lasso(Trn,Tain,'binomial','CV',3);
ince = FitIiance;
FitIept`````` Use the model coefficients found in the previous step to predict the test scores of the test data. Use linked functions that specify binomial dependent variables`'logit'`. Converts the predicted value to a logical vector.

Use the confusion matrix to determine the accuracy of the prediction.

``confuhart`` This function can correctly predict 31 test scores. However, this function incorrectly predicts that one student will get a grade of B or above and four students will get a grade of B or below. Most popular insights

2.Case implementation of panel smooth transition regression (PSTR) analysisAnalysis case implementation “)

## Integration of SAP e-commerce cloud Spartacus UI and CPQ configurable products

CPQ configurable product integration provides a user interface in Spartacus for configuring and selling configurable products that have been modeled using SAP CPQ configurable product integration and related configuration engines. Note that the Spartacus library does not include SAP CPQ itself. The initial release of the Spartacus library for SAP CPQ integration for configurable products […]