Mathematical Modeling --- Classification Model: Logistic Regression and LDA

Types of classification problems

  1. Two categories:
    logistic regression
    Fisher linear discriminant analysis — LDA
  2. Multi -class linear discriminant analysis and multi-class logistic regression operation
    in multi-class Spss

Two categories

Set qualitative variables -> numeric variables-Spss uses dummy variables

Insert picture description here
Create dummy variables:

  • The number of dummy variables introduced is generally the number of categories-1 For
    example: qualitative variable (male/female), there are two categories, so set a dummy variable (0 male, 1 female)
  • Insert picture description hereFor example, there are two types of fruits: three variables will be added (two are variables corresponding to the sample label for two types of fruits, and one label corresponds to the test set and the training set)
    For binary classification, it may be necessary to modify the newly added label to get the dummy variable

Logistic regression

Insert picture description here

  1. Dependent variable: category (value)
  2. Covariate: independent variable

Stepwise regression-generally backward stepwise regression

  1. If stepwise regression is not used, select the enter button

  2. Stepwise regression analysis
    Insert picture description here

Classification button in the interface-select qualitative variables and select control group

Insert picture description here

Save button in the interface

Insert picture description here

  • Probability In
    two classifications, y = = 1 y==1and==1 probability of occurrence
  • Group members
    The result of classification, predict which group the sample belongs to

Option buttons in the interface

Insert picture description here
Stepwise regression analysis

  • Enter
    when using forward stepwise regression, the probability of entering
  • Remove
    using backward stepwise regression, the probability removed

Result analysis

Insert picture description here

  • y ^ \ hat {y} and^Under the second classification, y = = 1 y==1 for this sampleand==Probability of 1

Poor prediction

Insert picture description here
But be aware that it may overfit

Fisher Linear Discriminant Analysis — LDA

Insert picture description here
Insert picture description here

  • Grouping variables: group according to the value of which variable
    To define the scope

Statistics button

Insert picture description here

Sort button

Insert picture description here

  • Summary table: the accuracy of classification can be obtained

Save button

Insert picture description here

  • Prediction group members: whether the result of the two-class prediction is 0 or 1
  • Group membership probability: the probability of belonging to 1 and the probability of belonging to 0

Multi-category

Fisher Linear Discriminant Analysis — LDA

Suppose there are four categories
Only need to modify the definition scope
Insert picture description here

Logistic regression

Insert picture description here

Save button

Insert picture description here

  • Estimated response probability: the probability for each category

Option button

Insert picture description hereStepwise regression analysis

  • Can be adjusted after using stepwise regression

Condition button

Insert picture description here

Result analysis

Insert picture description here

  • Canonical discriminant function coefficients
    if classification is n, the plane is divided to have the number of n-1, there are n-1 functions

Detect overfitting

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43779658/article/details/108125007