首页 > 其他分享 >回归与分类

回归与分类

时间:2023-09-12 21:01:47浏览次数:31  
标签:function frac sigma 回归 分类 theta hat sum

Officially begin

Deep = Many hidden layers

Neurall Network

Find a function in function set.

Goodness of function

Pick the best function

Backpropagation - Backward Pass(反向传播)

反向的neural network

Regression

  • Stock Market Forecast
  • Self-driving Car
  • Recommendation

Step 1 : Model

A set of function

Step 2 : Goodness of Function

$$ \hat{y}^1代表x^1对应的确切值 $$

Loss function L: $$ L(f)=L(w,b) ~ Estimated ~ y ~ basedoninputfunction $$

$$ L(w,b)=\sum_{n=1}^{10}(\hat{y}^n-(b+w\cdot x_{cp}^n))^2 $$

Step 3 :Best Function

In linear regression, the loss function L is convex.

Overfitting

Regularization

$$ L(w,b)=\sum_{n=1}^{10}(\hat{y}^n-(b+w\cdot x_{cp}^n))^2+\lambda\cdot \sum(w_i)^2 $$

不需要考虑bias,调整平滑程度,smooth

  • Gradient descent
  • Overfitting and Regularization

Classification

independently and identically distributed(i.i.d) $$ L(h^{train},D_{all})-L(h^{all}, d_{all}) \leq \delta\ we\ need \ \forall h \in \H, |L(h,D_{train}) -L(h,D_{all}) | \leq \delta/2\ L(h^{train},D_{all})\leq L(h^{train},D_{all}) + \delta/2 $$ 重温数码宝贝:

模型出现bad的概率: $$ P(D_{train}\ is\ bad)\leq |H| \cdot 2exp(-2N\epsilon^2 ) \ N \ge \frac{log(2|H|/\delta)}{2\epsilon^2} $$ Tradeoff of Model Complexity

Training data for Classification

pair

Ideal Alternatives

Function(Model):

$$ f(x)\ x -> g(x)>0~Output=class1\ else\ Output=class2 $$

lossfunction:

The number of times of get incotrrect results on training data. $$ L(f) = \sum_{n}\delta(f(x^n)\neq\hat{y}^n) $$

Find the best function;
  • Example : Perceptron, SVM

Prior

$$ P(C_1|x)=\frac{P(x|C_1)P(C_1)}{P(x|C_1)P(C_1)+P(x|C_2)P(C_2)} $$

Gaussian

Maximum Likelihood

2D array or 3D array mean the array with 2 or 3 axes respectively, but the n-dimensional vector mean the vector of length n.

Learn something that can really differ you from others.

Logistics Regression

Function Set

$$ f_{w,b}=\sigma(\sum_{i}w_ix_i)+b $$

Output : Between 0 and 1 $$ f_{w,b}(x)=P_{w,b}(C_1|x) $$

$$ w^,b^=arg\ \underset{w,b}{max}L(w,b)\ 等同于 w^,b^ = arg\ \underset{w,b}{min}-lnL(w,b) $$

Cross Entropy: $$ Distribution \ p: p(x=1)=\hat{y}^n\ p(x=0)=1-\hat{y}^n\ Distribution \ q: q(x=1)=f(x^n)\ q(x=0)=1-f(x^n)\ H(p,q)=-\sum_xp(x)ln(q(x)) $$

Loss Function

$$ L(f)=\sum_nC(f(x^n),\hat{y}^n)\ C(f(x^n),\hat{y}^n)=-[\hat{y}^nlnf(x^n)+(1-\hat{y}^n)ln(1-f(x^n))] $$

Update

logistic regression 和 linear regression 形式完全相同 $$ w_i\gets w_i-\eta \sum_{n}-(\hat{y}^n-f_{w,b}(x^n))x_i^n $$

Discriminative (logistic) & Generative (Gaussian描述)

Generative做了某些假设。

  • Benefit of generative model
    • With the assumption of probability distribution, less training data is needed
    • With the assumption of probability distribution, more robust to the noise
    • Priors and class-dependent probabilities can be estimated from different sources.

Multi-class Classification

SoftMax $$ Softmax(z_i)=\frac{e^{z_i}}{\sum_{c=1}^{C} e^{z_c}}\ 1 > y_i' > 0\ \sum_iy_i'=1 $$

Limitation of Logistic Regression

只能画一条直线

  • Feature Transformation
    • Cascading logistic regression models

Optimization Issue

层数较多表现的反而没有层数较少的好

Over fitting

  • 增加训练资料

  • Data augmentation

  • constrained model

    • Less parameters, sharing parameters
    • Less features
    • Early stopping

CNN->比较没有弹性的model

分Training Set

  • N-fold Cross Validation

Optimization Fail

H : Hessian

Tayler Series Approximation $$ L(\theta) \approx L(\theta^\prime)+\frac{1}{2}(\theta-\theta^\prime)^TH(\theta-\theta^\prime) $$

  • H is positive definte = All eigen values are positive -> local minima
  • H is negative definte = All eigen values are negative -> **local **
  • Some eigen values are positive , and some are negative -> Saddle point

在高维下local minima可能会变成saddle poing

Tips for training : Batch and Momentum

Batch

1 epoch = see all the batches once -> shuffle after each epoch

Momentum

Movement not just based on gradient, but previous movement.

Different parameters needs different learning rate

$$ \theta_i^{t+1} \gets \theta_i^t-\frac{\eta}{\sigma_i^t}g_i^t\ \sigma_i^t=\sqrt{\frac{1}{t+1}\sum_{i=0}^t(g_i^t)^2} $$

Adagred

RMSProp

$$ \theta_i^{t+1} \gets \theta_i^t-\frac{\eta}{\sigma_i^t}g_i^t\ \sigma_i^t = \sqrt{\alpha(\sigma_i^{t-1})^2+(1-\alpha)(g_i^t)^2} $$

Adam : RMSProp + Momentum

Learning Rate Sceduling

$$ \theta_i^{t+1} \gets \theta_i^t-\frac{\eta^t}{\sigma_i^t}g_i^t\ $$

标签:function,frac,sigma,回归,分类,theta,hat,sum
From: https://blog.51cto.com/u_16189732/7448443

相关文章

  • 低代码/零代码公司有哪些分类?代表产品有哪些?
    低代码/零代码公司是指提供低代码/零代码开发平台和工具的企业,旨在帮助用户通过简化开发过程、减少编码工作和提高效率快速构建应用程序。这些公司根据其定位和产品特点可以分为以下几个主要分类:综合型低代码/零代码公司:OutSystems:OutSystems是一家领先的低代码开发平台提供商。......
  • 逻辑回归入门介绍
    本文所有内容整理自网络。完整内容可以点击这里获取:完整资料下载地址Logistic回归是一种监督式机器学习算法,主要用于分类任务,其目标是预测一个实例属于给定类别的概率。它是一种统计算法,用于分析一组自变量与依赖的二进制变量之间的关系。它是一种强大的决策工具,例如用于判断电子邮......
  • 线性回归基本原理和公式推导
    本文所有内容整理自网络。完整内容可以点击这里获取:完整资料下载地址前言线性回归是一种监督式机器学习算法,它计算因变量与一个或多个独立特征之间的线性关系。当独立特征的数量为1时,被称为单变量线性回归;在存在多于一个特征的情况下,被称为多变量线性回归。该算法的目标是找到最佳......
  • 一文了解机器学习中分类和回归的差异
    本文所有内容整理自网络。完整内容可以点击这里获取:完整资料下载地址前言分类和回归是数据挖掘和机器学习中常见的两个预测问题。分类算法分类算法是拟合一个模型或函数的过程,该模型或函数有助于将数据分为多个类别,即离散值。在分类中,根据输入中给定的一些参数,数据被分类到不同的标......
  • DSL查询分类和语法、查询全部
           ......
  • 大豆的术语和定义 分类 质量要求
    1范围本文件规定了大豆的术语和定义、分类、质量要求、检验方法、检验规则、标签标识以及包装、储存和运输要求。本文件适用于收购、储存、运输、加工和销售的商品大豆。2规范性引用文件下列文件中的内容通过文中的规范性引用而构成本文件必不可少的条款。其中,注日期的引用文件......
  • Matlab 遗传算法优化极限学习机(GA-ELM)回归预测
    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。......
  • Matlab 灰狼优化算法优化极限学习机(GWO-ELM)回归预测
    ✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。......
  • 回归克里格、普通克里格插值在ArcGIS中的实现
      本文介绍基于ArcMap软件,实现普通克里格、回归克里格方法的空间插值的具体操作。目录1背景知识准备2回归克里格实现2.1采样点与环境变量提取2.2子集要素划分2.3异常值提取2.4土壤有机质含量经典统计学分析2.5回归方程求取2.6残差提取2.7残差普通克里格求解2.8土壤有......
  • mysql实现商品分类功能
    目录概述1.0表的创建2.0主分类2.1数据添加与查询3.0子分类3.1数据添加3.2数据查询概述#1.0系统环境:windows10#2.0mysql版本:mysql8.0.2#3.0可视化软件:jetbrainsdatagrip20221.0表的创建#产品(商品)分类功能#分类表createtablecategory(idint2aut......