当前位置:网站首页>机器学习训练与参数优化的一般过程 (讨论)
机器学习训练与参数优化的一般过程 (讨论)
2022-07-06 02:00:00 【闵帆】
摘要: 在实际机器学习应用中, 不但要进行模型的训练, 还要进行输入参数的控制. 本文描述了一般性的过程, 仅供参考.
1. 训练机器学习模型
对于一个输入为 m m m 个特征, 输出为一个决策指标, 可以建立机器学习模型
f : R m → R (1) f: \mathbb{R}^m \to \mathbb{R} \tag{1} f:Rm→R(1)
其中 R \mathbb{R} R 为实数集合. 如果不同的特征有自己的取值范围, 则该机器学习模型可以表示为
f : ∏ i = 1 m V i → R (2) f: \prod_{i=1}^m \mathbf{V}_i \to \mathbb{R} \tag{2} f:i=1∏mVi→R(2)
其中 V i \mathbf{V}_i Vi 是第 i i i 个特征的取值范围.
简单起见, 下文仅讨论 (1) 式所对应的模型.
给定含有 n n n 个实例的特征矩阵 X = [ x 1 , … , x n ] T ∈ R n × m \mathbf{X} = [\mathbf{x}_1, \dots, \mathbf{x}_n]^{\mathrm{T}} \in \mathbb{R}^{n \times m} X=[x1,…,xn]T∈Rn×m 和相应的标签向量 Y ∈ R n \mathbf{Y} \in \mathbb{R}^n Y∈Rn, 机器学习的优化目标一般可以表示为
min f L ( f ( X ) , Y ) + R ( f ) (3) \min_f \mathcal{L}(f(\mathbf{X}), \mathbf{Y}) + R(f) \tag{3} fminL(f(X),Y)+R(f)(3)
其中 f ( X ) = [ f ( x 1 ) , … , f ( x n ) ] f(\mathbf{X}) = [f(\mathbf{x}_1), \dots, f(\mathbf{x}_n)] f(X)=[f(x1),…,f(xn)] 为预测的标签的向量, R ( f ) R(f) R(f) 为 f f f 中参数的正则项. 如果优化目标是一个凸函数, 则可以使用梯度下降法很快找到最优解. 对于正则项:
- 如果 f f f 为一个线性模型, 该正则可以是 1范数、2范数、核范数等等. 其作用是防止过拟合.
- 如果 f f f 为一个神经网络模型, 则可以通过 dropout 等技术防止过拟合.
2. 参数优化方法
对于一些实际问题, 输入特征有些是客观的, 有些是是可控的. 不失一般性, 令前 m 1 m_1 m1 个特征为客观的, 后 m 2 m_2 m2 个特征是可控的 (因此我们也将其称为参数), m 1 + m 2 = m m_1 + m_2 = m m1+m2=m. 假设已经通过大量的数据训练出一个可靠的机器学习模型 f f f, 且我们期望最大化决策指标. 给定客观特征向量 x b ∈ R m 1 \mathbf{x}_b \in \mathbb{R}^{m_1} xb∈Rm1, 参数优化的目标函数为
arg max x u ∈ R m 2 f ( x b ∥ x u ) (4) \argmax_{\mathbf{x_u} \in \mathbb{R}^{m_2}} f(\mathbf{x}_b \| \mathbf{x}_u)\tag{4} xu∈Rm2argmaxf(xb∥xu)(4)
其中 ∥ \| ∥ 表示将向量拼接操作.
- 如果 f f f 关于各可控特征为一个凸函数, 则可以使用梯度下降等方法获得最优参数.
- 如果 f f f 关于各可控特征不为一个凸函数, 则可通过一些仿生算法来优化参数.
- 如果各可控特征为枚举型则定义域的基数不大, 则可通过穷举法直接获得最优参数. 例: 可控特征有 5 个, 每个有 10 种可能的取值, 则需要从 1 0 5 10^5 105 种参数组合中获得最优参数向量, 只需要数秒钟就可以算出.
边栏推荐
- dried food! Accelerating sparse neural network through hardware and software co design
- 【Flask】获取请求信息、重定向、错误处理
- Leetcode3, implémenter strstr ()
- Basic operations of database and table ----- set the fields of the table to be automatically added
- [network attack and defense training exercises]
- Thinking about the best practice of dynamics 365 development collaboration
- Cadre du Paddle: aperçu du paddlelnp [bibliothèque de développement pour le traitement du langage naturel des rames volantes]
- RDD partition rules of spark
- Redis daemon cannot stop the solution
- NiO related knowledge (II)
猜你喜欢

2 power view

Virtual machine network, networking settings, interconnection with host computer, network configuration

Derivation of Biot Savart law in College Physics

Leetcode sum of two numbers

使用npm发布自己开发的工具包笔记

【Flask】官方教程(Tutorial)-part2:蓝图-视图、模板、静态文件

Jisuanke - t2063_ Missile interception
![[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)](/img/ec/7fcdcbd9c92924e765d420f7c71836.jpg)
[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)
![[solution] add multiple directories in different parts of the same word document](/img/22/32e43493ed3b0b42e35ceb9ab5b597.jpg)
[solution] add multiple directories in different parts of the same word document

Computer graduation design PHP college student human resources job recruitment network
随机推荐
同一个 SqlSession 中执行两条一模一样的SQL语句查询得到的 total 数量不一样
Bidding promotion process
【Flask】响应、session与Message Flashing
leetcode-2.回文判断
How to set an alias inside a bash shell script so that is it visible from the outside?
Use image components to slide through photo albums and mobile phone photo album pages
LeetCode 322. Change exchange (dynamic planning)
Know MySQL database
[ssrf-01] principle and utilization examples of server-side Request Forgery vulnerability
Text editing VIM operation, file upload
NLP第四范式:Prompt概述【Pre-train,Prompt(提示),Predict】【刘鹏飞】
Extracting key information from TrueType font files
Overview of spark RDD
Using SA token to solve websocket handshake authentication
【Flask】官方教程(Tutorial)-part1:项目布局、应用程序设置、定义和访问数据库
500 lines of code to understand the principle of mecached cache client driver
Ali test open-ended questions
一题多解,ASP.NET Core应用启动初始化的N种方案[上篇]
Unreal browser plug-in
Computer graduation design PHP college classroom application management system