当前位置:网站首页>分类模型——逻辑回归、Fisher线性判别(SPSS)
分类模型——逻辑回归、Fisher线性判别(SPSS)
2022-07-23 13:12:00 【Wolves_YY】
本文借鉴了数学建模清风老师的课件与思路,可以点击查看链接查看清风老师视频讲解:清风数学建模:https://www.bilibili.com/video/BV1DW411s7wi
一、二分类问题
1.0案例
1.0.1案例背景

1.0.2案例数据

1.1逻辑回归
借助SPPSS实现逻辑回归步骤如下:
先将数据导入进SPSS,如下图:

然后给因变量种类创建虚拟变量(01变量),如下图:

创建之后会出现新的3列,框起来的为他们的不同,如下图:

现在删除不要的两列。因为我们要将苹果和橘子分为0和1,而这三列里,第二列所有的苹果为1,所有的橘子和待预测样本为0,所以这里删除第一列和第三列,并将待预测样本的0删除。删除后的效果如下:

接着执行下图操作:

当指标里有分类指标(如性别)时,将该变量放入分类协变量里面:

现在可得到结果:

根据逻辑回归系数表可以写出模型的计算公式:


当模型结果较差时:

加入了平方项之后的结果如下:

可以看到,此时的预测正确率为100%,可能产生了过拟合(训练集上预测的效果好,预测集效果差)如下图:

解决过拟合的方法:

1.2Fisher线性判别
前面操作和逻辑回归一致,首先为分类指标创建虚拟变量(01)。
接着借助SPSS实现Fisher线性判别分类,其中,定义范围为分类指标的种类,本案例中,有两个种类,故为0-1,如下图:

分类结果如下,可将典则判别函数系数放入论文,如下图:

二、多分类问题
2.0 案例数据

2.1逻辑回归

在Excel里为分类指标创建虚拟变量1-4,创建之后如下图:

然后进行下列操作:


可得以下结果:


2.2Fisher线性判别
在Excel里为分类指标创建虚拟变量1-4,创建之后如下图:

Fisher线性判别实现多分类问题和二分类差不多,只是定义的范围修改下(这里分类的种类有4类,故范围为1-4),如下两个图:


分类的结果,分类结果表里,上面的为分类的数量,下面的为分类的概率,如下图:

下图为得到的结果, 框的第一个为得到的分类结果,框的第二个为4个种类的概率,如预测的第一个样本中,预测为第3类的概率为0.87121,故将该样本预测为第三类。

边栏推荐
- Visualization of gross domestic product (GDP) data
- 精确的目标检测中定位置信度的获取
- CNCF基金会总经理Priyanka Sharma:一文读懂CNCF运作机制
- 低佣金账户怎么开?安全吗?
- FreeRTOS个人笔记-延时函数
- LeetCode之等式方程的可满足性
- 锁相环工作原理,比如我们8MHZ晶振如何让MCU工作在48MHZ或者72MHZ呢
- Bag of tricks for image classification "with convolutional neural networks"
- pytest接口自动化测试框架 | pytest常用运行参数
- UiPath Studio Enterprise 22.4 Crack
猜你喜欢

(resolved) idea compilation gradle project prompt error no symbol found

Using "soup.h1.text" crawler to extract the title will be one more\

Scale Match for Tiny Person Detection

深度学习卷积神经网络论文研读-AlexNet

FIO performance testing tool

Go interface: go deep into internal principles

Numpy 数据分析基础知识第一阶段(NumPy基础)

Convolutional neural network model -- googlenet network structure and code implementation

卷积神经网络模型之——GoogLeNet网络结构与代码实现

The working principle of PLL. For example, how can our 8MHz crystal oscillator make MCU work at 48mhz or 72mhz
随机推荐
Tan Zhangxi, director of risc-v Foundation: risc-v has gradually expanded from the edge to the center
V self built n_ Deployment and use
UiPath Studio Enterprise 22.4 Crack
Surface family purchase reference
SSD: Single Shot MultiBox Detector
YOLOv4: Optimal Speed and Accuracy of Object Detection
Using "soup.h1.text" crawler to extract the title will be one more\
Basic auth plug-in based on apisik authorizes Minio file upload function
学习笔记7--交通环境行为预测
Cuibaoqiu, vice president of Xiaomi group: open source is the best platform and model for human technological progress
UiPath Studio Enterprise 22.4 Crack
The first stage of basic knowledge of numpy data analysis (numpy Foundation)
大屏可视化的适配方案
Une solution complète au problème du sac à dos dans la programmation dynamique
Visual analysis of real-time epidemic data
Oralce中实现将指定列的指定内容替换为想要的内容
博客表情大全
The new business form of smart civil aviation has emerged, and Tupo digital twin has entered the civil aviation flight network of the Bureau
The working principle of PLL. For example, how can our 8MHz crystal oscillator make MCU work at 48mhz or 72mhz
软件体系结构