This Example on “Fit Linear Regression Using Specified Model Formula” gives a good overview on the required steps. Additional information on the formula for model specification can be found in the following documentation.Please run the below command in the MALTAB R2018a command window to get the release specific documentation: web(fullfile(docroot, 'stats/fitlm.html'))
Decision Trees with interaction test
- Very good method for detecting bivariate combinations of predictors.
For instance, the following will find powerful predictors in input data X and class labels y:
>> bag = fitcensemble(X, y, 'Method', 'Bag', 'Learner', templateTree('PredictorSelection', 'interaction-curvature'))
>> oobPermutedPredictorImportance(bag)
If you are interested in regression, replace fitcensemble with fitrensemble. You can also learn a model using all variables, take out a specific combination of variables and see how much removing these variables affects the model accuracy. An exhaustive list of variable combinations can be generated using the combnk function.
FSCNCA and FSRNCA with manually augmented features
- Method to manually handle formulas which can specify checking for interactions
Augment the features with a new feature that represents the interaction between other features (e.g. A/B) and pass this augmented set to fscnca to see the importance weight for that new feature.You can use the function x2fx for creating this new augmented matrix, as explainedPlease run the below command in the MALTAB R2018a command window to get the release specific documentation:
web(fullfile(docroot, 'stats/x2fx.html'))
Note that feature selection only accepts a numeric predictor matrix, it does not accept categorical . If we want to use categorical variables, we can specify them for x2fx and x2fx returns the correct matrix with dummy variables for categorical predictors.Please follow the below link to search for the required information regarding the current release:https://www.mathworks.com/help/