当前位置:网站首页>机器学习训练与参数优化的一般过程 (讨论)
机器学习训练与参数优化的一般过程 (讨论)
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 种参数组合中获得最优参数向量, 只需要数秒钟就可以算出.
边栏推荐
- NiO related knowledge (II)
- Basic operations of databases and tables ----- default constraints
- Social networking website for college students based on computer graduation design PHP
- RDD creation method of spark
- Selenium element positioning (2)
- 01. Go language introduction
- Redis daemon cannot stop the solution
- Dynamics 365 开发协作最佳实践思考
- Jisuanke - t2063_ Missile interception
- Numpy array index slice
猜你喜欢

Redis string type

Leetcode3, implémenter strstr ()

Overview of spark RDD

Visualstudio2019 compilation configuration lastools-v2.0.0 under win10 system

500 lines of code to understand the principle of mecached cache client driver

安装php-zbarcode扩展时报错,不知道有没有哪位大神帮我解决一下呀 php 环境用的7.3

Basic operations of database and table ----- set the fields of the table to be automatically added

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

2022 PMP project management examination agile knowledge points (8)

2022年PMP项目管理考试敏捷知识点(8)
随机推荐
MySQL learning notes - subquery exercise
Sword finger offer 12 Path in matrix
Blue Bridge Cup embedded_ STM32 learning_ Key_ Explain in detail
[flask] response, session and message flashing
Accelerating spark data access with alluxio in kubernetes
Redis守护进程无法停止解决方案
[flask] official tutorial -part1: project layout, application settings, definition and database access
module ‘tensorflow. contrib. data‘ has no attribute ‘dataset
[solution] add multiple directories in different parts of the same word document
Force buckle 1020 Number of enclaves
剑指 Offer 12. 矩阵中的路径
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
RDD conversion operator of spark
0211 embedded C language learning
Use the list component to realize the drop-down list and address list
【Flask】官方教程(Tutorial)-part2:蓝图-视图、模板、静态文件
RDD partition rules of spark
NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
RDD creation method of spark
TrueType字体文件提取关键信息