当前位置:网站首页>机器学习训练与参数优化的一般过程 (讨论)
机器学习训练与参数优化的一般过程 (讨论)
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 种参数组合中获得最优参数向量, 只需要数秒钟就可以算出.
边栏推荐
- Redis守护进程无法停止解决方案
- 【Flask】获取请求信息、重定向、错误处理
- 【网络攻防实训习题】
- RDD partition rules of spark
- Ali test Open face test
- Force buckle 1020 Number of enclaves
- Basic operations of databases and tables ----- unique constraints
- Computer graduation design PHP part-time recruitment management system for College Students
- Paddle框架:PaddleNLP概述【飞桨自然语言处理开发库】
- Blue Bridge Cup embedded_ STM32_ New project file_ Explain in detail
猜你喜欢

SQL statement

2 power view

1. Introduction to basic functions of power query

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

PHP campus movie website system for computer graduation design

02.Go语言开发环境配置

Force buckle 9 palindromes

A basic lintcode MySQL database problem

Executing two identical SQL statements in the same sqlsession will result in different total numbers

【Flask】官方教程(Tutorial)-part2:蓝图-视图、模板、静态文件
随机推荐
Basic operations of database and table ----- delete data table
[depth first search notes] Abstract DFS
NLP fourth paradigm: overview of prompt [pre train, prompt, predict] [Liu Pengfei]
Use Scrollview and tabhost to realize vertical scrollbars and tabs
Thinking about the best practice of dynamics 365 development collaboration
抓包整理外篇——————状态栏[ 四]
论文笔记: 图神经网络 GAT
A basic lintcode MySQL database problem
Open source | Ctrip ticket BDD UI testing framework flybirds
leetcode-2.回文判断
Reasonable and sensible
Leetcode3. Implement strstr()
01.Go语言介绍
Folio. Ink is a free, fast and easy-to-use image sharing tool
[width first search] Ji Suan Ke: Suan tou Jun goes home (BFS with conditions)
[Jiudu OJ 09] two points to find student information
Concept of storage engine
Redis守护进程无法停止解决方案
Visualstudio2019 compilation configuration lastools-v2.0.0 under win10 system
[solution] add multiple directories in different parts of the same word document