当前位置:网站首页>Analysis of regression problem, modeling and prediction
Analysis of regression problem, modeling and prediction
2022-07-25 18:19:00 【Tomorrowave】
List of articles
What is regression analysis
Give you a series of related data , There is such an internal relationship between independent variables and dependent variables , Then by processing these data , Use mathematical methods to model linear equations , Then finally through the model you build , Predict independent variables that are not provided to
So what is prediction ?
Prediction , Is to use a trained model , According to the input arguments Get the corresponding output . In the prediction task , If the model Can accurately provide forecasts , that It doesn't matter what form it is , And if the The form of is very complex and difficult to explain , We can call it black box model (Black Box).
For example , hypothesis Xi It is the blood sample characteristics of a patient , The risk of serious adverse reactions after drug use was measured , So if there is a model that can pass well Xi To predict Yi , That's naturally the best thing . here , Form of model 、 The relationship between variables is not so important in the face of correct prediction .
What is inference ?
In many cases , We are right when X How does the change of affect Y More interested in , here , We estimate the model The purpose of is not to predict , But to understand the relationship between the two
linear regression model
y = x + u y=x+u y=x+u
further
y = a 0 + ∑ i = 1 n a i x i y=a_0+\sum^{n}_{i=1}a_ix_i y=a0+i=1∑naixi
One dimensional linear model
y = a 0 + a 1 x 1 + u y=a_0+a_1x_1+u y=a0+a1x1+u
a 0 Is the intercept term , It can be understood as x = 0 When y The expectations of the , a 1 It can be understood as x Every additional unit , y Average increase a 1 A unit of a_0 Is the intercept term , It can be understood as x=0 When y The expectations of the ,a_1 It can be understood as x Every additional unit ,y Average increase a_1 A unit of a0 Is the intercept term , It can be understood as x=0 When y The expectations of the ,a1 It can be understood as x Every additional unit ,y Average increase a1 A unit of
Least square method
import statsmodels.api as sm
model = sm.OLS(endog, exog=None, missing='none', hasconst=None, **kwargs)
''' Parameters endog: array_like A one-dimensional dependent variable . exog: array_like By default , Intercept is not included , It should be added by the user . Use statsmodels.tools.add_constant add to . missing: str The available options are 'none'、'drop' and 'raise'. If 'none', Do not carry out nan Check . If 'drop', Then discard any use nan The observations . If 'raise', Throw an error . The default is 'none'. hasconst: None or bool instructions RHS Whether to include constants provided by users . If True, Then the constant is not checked ,k_constant Set to 1, And calculate all the result statistics , Just like there is a constant . If False, Then the constant is not checked , And will k_constant Set to 0. **kwargs Additional parameters used to set model properties when using the formula interface . '''
Normal distribution
from scipy.stats import norm
import numpy as np
# Generate an average of 1, The variance of 2 Is a normal distribution
distribution=norm(loc=1.0, scale=2.0)
# Show mean and variance
print(distribution.stats())
# sampling
samples=distribution.rvs(size=1000)
# The mean value of the sample and the difference between the labels
print(np.mean(samples), np.std(samples))
# Fit the data
print(norm.fit(samples))
边栏推荐
- Keil5 "loading PDSC debug description failed for STMicroelectronics stm32hxxxxxxx" solution
- 11.1-CM24 最近公共祖先
- What are the advantages of real-time cloud rendering
- Sorting also needs to know the information and linked list
- testng执行顺序的3中控制方法
- BL602 开发环境搭建
- List conversion problem
- "Deprecated gradle features were used in this build, making it incompatible with gradle 6.0" problem solving
- Ch582 ble 5.0 uses Le coded broadcast and connection
- MySQL 索引优化全攻略
猜你喜欢

CVE-2022-33891 Apache spark shell 命令注入漏洞复现

Good news! Ruiyun technology was awarded the member unit of 5g integrated application special committee of "sailing on the sea"

Kendryte K210 在freertos上的lcd屏幕的使用

Auditing相关注解

如何判断静态代码质量分析工具的性能?这五大因素必须考虑

Construction of Huffman tree

pd.melt() vs reshape2::melt()

408 Chapter 2 linear table

越来越成熟的Rust,都应用了哪些场景呢?

云VR:虚拟现实专业化的下一步
随机推荐
LeetCode 101. 对称二叉树 && 100. 相同的树 && 572. 另一棵树的子树
TESTNG中的并发测试invocationCount, threadPoolSize, timeOut的使用
更新|3DCAT实时云渲染 v2.1.2版本全新发布
工程师必看的示波器探头安全使用说明书
Repair process of bad blocks of primary standby database
基于Caffe ResNet-50网络实现图片分类(仅推理)的实验复现
408第二章线性表
C语言 cJSON库的使用
国际权威认可!OceanBase入选Forrester Translytical数据平台报告
How to read a Book
对角化、A的幂
浅析回归问题、建模、预测
SQL things
Problems faced by cloud XR and main application scenarios of cloud XR
Recommend a qinheng Bluetooth reference blog
Remember those two sentences
Auditing相关注解
Use of LCD screen of kendryte k210 on FreeRTOS
Creation of unity Bezier curve
Use of join function in MATLAB