# 独热

**独热编码**是一种将分类变量表示为向量的方法，向量的分量个数与类别数相同，其中与某个实例的类别相对应的分量设为1，其余所有分量设为0。<sup>[1](https://d2l.ai/chapter_linear-classification/softmax-regression.html)</sup> 形式化地说，长度为K的向量c是整数k的独热编码，当且仅当对所有j ≠ k都有c_j = 0，且c_k = 1。<sup>[2](https://www.cs.cmu.edu/~hchai2/courses/10601-m22/lectures/Multiclass_Handout.pdf)</sup> 该方案也被称为“one-of-K”编码或“哑”编码，在统计学文献中，它以虚拟变量表示法中的1-of-N编码之名出现。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup><sup> • </sup><sup>[4](https://stats.oarc.ucla.edu/stat/sas/library/nesug98/p046.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 一个含N个分量的向量（N = 类别数），其中恰好一个元素设为1.0；一个有八个类别的car_color特征会产生八元向量。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> |
| 列数 | 对于一个有L个水平的特征，独热编码产生L个二元指示列；哑编码以一个水平为参考，产生L-1个。<sup>[6](https://link.springer.com/article/10.1007/s00180-022-01207-6)</sup> |
| 虚拟变量陷阱 | 将全部k个指示变量连同截距一起纳入，会使X′X奇异，从而使OLS估计量(X′X)<sup>-1</sup>X′Y无定义。<sup>[7](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/04%3A_Matrices_and_Linear_Regression/4.04%3A_Multicollinearity_and_Categorical_Independent_Variables)</sup> |
| 稀疏存储 | 稀疏表示只存储1.0所在的位置，占用的内存远少于完整向量。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> |
| 树模型 | 独热编码对树学习器来说并非最优：每次分裂只能隔离出一个类别，因此树会长得不平衡且很深；LightGBM则能在约O(k log k)时间内找到k个类别的最优二子集划分。<sup>[8](https://lightgbm.readthedocs.io/en/latest/Features.html)</sup><sup> • </sup><sup>[9](https://eecs.csuohio.edu/~sschung/CIS660/Limitations_OneHotEncoding.pdf)</sup> |
| 高基数 | 当类别数很高时，独热编码通常是糟糕的选择；嵌入通常要好得多。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> |
| 数字设计 | 在AMD Vivado中，对于状态数不超过32的状态机，独热是默认的状态机编码方式，每个状态对应一个触发器。<sup>[10](https://docs.amd.com/r/en-US/ug901-vivado-synthesis/One-Hot-State-Encoding)</sup> |

## 定义与机制

编码分两步进行。首先，枚举分类特征的不同取值，并赋予0到N-1的位置。其次，将每个实例的取值替换为该值所在位置为1、其余位置为0的二元向量。一个有八种可能类别的car_color特征会产生八元向量，模型为每个元素学习一个单独的权重。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> 由于只有一个位置非零，完整向量可以紧凑地存储为1.0的索引；模型仍然在独热向量本身上训练，但存储的表示要小得多。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup>

采用该方案的原因在于，分类问题通常并不自带类别之间的自然顺序，因此统计学家以这种方式而非整数来表示分类数据。<sup>[1](https://d2l.ai/chapter_linear-classification/softmax-regression.html)</sup>

## 统计基础：虚拟变量与虚拟变量陷阱

在回归中，分类水平用哑编码（也称指示编码）表示，软件通常会将截距作为设计矩阵的第一列纳入。<sup>[11](https://online.stat.psu.edu/stat502/book/export/html/866)</sup> 对于一个有k个水平的分类变量，若将全部k个二元（0/1）指示变量都纳入设计矩阵X，会导致完全多重共线性，使X′X奇异，OLS估计量(X′X)<sup>-1</sup>X′Y无定义；这就是虚拟变量陷阱。<sup>[7](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/04%3A_Matrices_and_Linear_Regression/4.04%3A_Multicollinearity_and_Categorical_Independent_Variables)</sup>

标准的补救办法可由代数推得。对于采用独热编码的无正则化线性模型，必须去掉截距以避免完全共线性；若使用岭惩罚，则纳入截距和所有水平是可以接受的。在带截距的模型中组合多个未删减水平的独热编码分类变量，会得到奇异的设计矩阵：一个3 × 4 = 12列的设计需要去掉三列，即从三个不同的分类编码中各去掉一列，才能恢复非奇异性。<sup>[12](https://stats.stackexchange.com/a/224055/85955)</sup> scikit-learn的OneHotEncoder支持drop参数，取值为None（默认）、'first'、'if_binary'，或一个类数组对象以指定每个特征要删除哪个类别，适用于完全共线特征会引发问题（如无正则化线性回归）的情形。文档提醒说，删除一个类别会破坏表示的对称性，并可能在下游模型（例如惩罚线性分类或回归）中引入偏差。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>

## 机器学习中的独热：标签、softmax与交叉熵

[神经网络](https://www.edgepedia.org/zh/neural-network)分类器使用独热向量作为类标签，因为各类别缺乏自然顺序，而整数标签会虚假地强加一种顺序。<sup>[1](https://d2l.ai/chapter_linear-classification/softmax-regression.html)</sup> 这种表示还直接与网络的输出层相连。softmax网络输出ŷ = softmax(o)，其中ŷ_i = exp(o_i)/Σ_j exp(o_j)，被解释为在给定输入x时估计的条件类别概率。<sup>[1](https://d2l.ai/chapter_linear-classification/softmax-regression.html)</sup> 配合独热标签向量，交叉熵损失l(y, ŷ) = -Σ_j y_j log ŷ_j 简化为单项，因为y是独热的，除一个坐标外求和项全部消失；该损失的下界为0。<sup>[1](https://d2l.ai/chapter_linear-classification/softmax-regression.html)</sup>

独热作为一种输入编码同样具有表现力：当第一层权重子矩阵复现了某种通用编码器（如序数编码器或目标编码器）的贡献时，用独热编码器训练出的神经网络可以产生与用该编码器训练出的网络完全相同的输出。<sup>[13](https://arxiv.org/html/2401.09682)</sup>

## 数字说话：维度与内存

一个有L个水平的特征在独热编码下变成L个二元指示列，而在带参考水平的哑编码下为L-1个。<sup>[6](https://link.springer.com/article/10.1007/s00180-022-01207-6)</sup> 独热编码将每个分类特征替换为一个大小为N的稀疏向量，其中N是该特征的基数；带参考水平的编码则使用N-1列。这些向量除一个1之外全为零。<sup>[14](https://arxiv.org/html/2312.16930)</sup>

代价随基数增长。对于观测稀少且高基数分类特征众多的任务，独热这类指示编码器会导致维度灾难；数据集很大时也许有足够样本克服这一点，但处理宽数据集会显著增加训练时长和内存需求。<sup>[14](https://arxiv.org/html/2312.16930)</sup> 稀疏存储通过只记录1.0的位置来缓解内存占用。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup>

## 与其他编码的比较

**标签编码与序数编码。** 整数编码或标签编码为各水平分配连续标识符，这会在水平之间引入一种数据中很可能并不存在的序数关系；对于具有高基数特征的线性模型或深度学习模型，这尤其有害。<sup>[14](https://arxiv.org/html/2312.16930)</sup> 一项NeurIPS 2023基准将独热描述为既浪费空间又对二元分类无效，并列出序数编码和二元编码作为替代方案。<sup>[15](https://proceedings.neurips.cc/paper_files/paper/2023/file/ac01e21bb14609416760f790dd8966ae-Supplemental-Datasets_and_Benchmarks.pdf)</sup> 这与其它基准的发现相冲突，分歧尚未解决：一项涵盖五种算法（lasso、随机森林、梯度提升、k近邻、支持向量机）的大规模基准发现，独热通常比哑编码性能略好，并且是RF、GB或SVM等非线性正则化模型处理高基数分类特征时更好的标准做法。<sup>[6](https://link.springer.com/article/10.1007/s00180-022-01207-6)</sup>

**目标编码。** 最常用的利用目标信息的技术是基于经验贝叶斯的目标编码器，它使用给定水平下目标的条件期望或条件概率作为编码。<sup>[13](https://arxiv.org/html/2401.09682)</sup> 在大规模基准中，正则化目标编码总体上始终最佳。<sup>[6](https://link.springer.com/article/10.1007/s00180-022-01207-6)</sup> 代尔夫特理工大学的一项比较发现，对线性模型而言独热表现最佳，但在特征基数高时，目标编码器和catboost编码器是更好的选择，因为与节省的运行时间相比，精度下降很小。<sup>[16](https://repository.tudelft.nl/file/File_9e5e5225-4c53-4362-862e-1b7072e82b6a?preview=1)</sup>

**哈希。** 特征哈希将类别映射为一个小整数，即将容纳该类别的桶的编号。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> 在一种基准表述中，该整数被转换为指示表示，在第(hash(l) mod hash.size) + 1列放1、其余为0，哈希尺寸越小则折叠的水平越多；超过阈值的稀有水平可以在指示编码之前折叠。<sup>[6](https://link.springer.com/article/10.1007/s00180-022-01207-6)</sup>

**嵌入。** 嵌入将一个有K个水平的变量关联到一个矩阵E ∈ R<sup>K×d</sup>，用稠密行向量E_k ∈ R<sup>d</sup>表示水平k，其中d通常远小于K；维度的实用经验法则是d = min(50, ⌈K/2⌉)或d ≈ K<sup>0.25</sup>向上取整。<sup>[17](https://mikenguyen13.github.io/ai_in_action/062-feature-engineering-categorical.html)</sup> 谷歌的指导是，当类别数很高时，独热通常是糟糕的选择，嵌入通常要好得多，它能降维以加快训练并降低推理延迟。<sup>[5](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)</sup> 一条从业者选择经验：基数低时，独热或哑编码是安全的默认选项；基数高时，防泄漏的目标编码是最强的通用选项，在流式处理或内存受限时首选哈希，嵌入适合数据充足的神经网络，要求每个水平有足够数据，并为未见的类别提供词表外回退。<sup>[17](https://mikenguyen13.github.io/ai_in_action/062-feature-engineering-categorical.html)</sup>

## 实际使用与工具

scikit-learn的OneHotEncoder接受整数或字符串的类数组输入，并使用独热（one-of-K、哑）方案编码特征，为每个类别产生一个二元列。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup> 实践中重要的选项：

- **drop**：None（默认）、'first'、'if_binary'或类数组对象，用于无正则化线性模型中的共线性控制。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>
- **handle_unknown**：'error'、'ignore'、'warn'或'infrequent_if_exist'，后者在存在此类类别时，根据min_frequency和max_categories将未知类别映射到不常见类别。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>
- **sparse_output**：为True（默认）时，编码器返回CSR格式的SciPy稀疏矩阵；该参数在1.2版本中由'sparse'更名而来。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>
- **min_frequency与max_categories**：对不常见类别进行分组；删除不常见类别的功能在1.1版本中加入，OneHotEncoder本身则在0.20版本加入。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>

对于编码目标y，scikit-learn指引用户使用LabelBinarizer而非OneHotEncoder。<sup>[3](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)</sup>

**pandas与scikit-learn。** 如果测试数据包含训练数据中没有的类别，pd.get_dummies会产生一个与训练不一致的额外列，这很可能会破坏下游代码；OneHotEncoder则可以配合handle_unknown="error"抛出错误，或配合handle_unknown="ignore"继续运行并将未见类别的列置为0。<sup>[18](https://stackoverflow.com/questions/36631163/what-are-the-pros-and-cons-between-get-dummies-pandas-and-onehotencoder-sciki)</sup> scikit-learn编码器创建一个可持久化并应用于新数据集的函数，结果一致，因而更适合机器学习流水线，而get_dummies对简单分析更方便；最稳健的方法是通过categories参数或分类dtype显式指定类别。<sup>[18](https://stackoverflow.com/questions/36631163/what-are-the-pros-and-cons-between-get-dummies-pandas-and-onehotencoder-sciki)</sup>

**失效模式。** 如果测试时出现新类别，预训练模型没有对应的列，会导致错误；handle_unknown一类的工具可解决此问题。<sup>[9](https://eecs.csuohio.edu/~sschung/CIS660/Limitations_OneHotEncoding.pdf)</sup> 高基数特征会导致上文所述的维度和内存问题。<sup>[14](https://arxiv.org/html/2312.16930)</sup>

## 基于树的模型有何不同

独热编码对决策树、随机森林和梯度提升机等基于树的方法可能有害：对于独热编码的高基数特征，一次分裂只能分离出一个类别，这使树更深，并且通常产生对信息增益贡献甚微的稀疏列。<sup>[9](https://eecs.csuohio.edu/~sschung/CIS660/Limitations_OneHotEncoding.pdf)</sup> LightGBM的文档也表达了同样的观点：在独热特征上生长的树通常歪斜，要达到高精度需要它们变得极深。LightGBM改为将k个类别划分为两个子集来分裂；共有2<sup>(k-1)</sup> - 1种可能的划分，但回归树的一种高效解法能在约O(k log k)时间内找到最优划分。<sup>[8](https://lightgbm.readthedocs.io/en/latest/Features.html)</sup> XGBoost采用同样的基于划分的方法，这一方法由LightGBM引入梯度提升，其基础是费雪1958年关于寻找类别最优划分的证明；在独热编码下，分裂定义为value == category，而基于划分的分裂使用value in categories。<sup>[19](https://xgboost.readthedocs.io/en/stable/tutorials/categorical.html)</sup>

在scikit-learn自己的比较中，使用独热编码数据的模型拟合最慢，因为独热编码为每个类别值创建一个额外特征，大大增加了训练期间的分裂候选数量；独热数据还可能产生更差的预测，尤其是在深度有限时，因为恢复等效分裂需要更多的分裂点，也就是更大的深度。<sup>[20](https://scikit-learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_categorical.html)</sup> 对于高基数分类特征，XGBoost建议将该特征当作数值处理，方法是忽略整数的分类解释，或将类别嵌入低维空间。<sup>[19](https://xgboost.readthedocs.io/en/stable/tutorials/categorical.html)</sup>

情况并非一致。在代尔夫特理工大学的受控比较中，独热是决策树表现最佳的编码，序数编码只差0到1个百分点，而运行时间显著更低；对于SVM，独热准确率最高，但运行时间约为3倍，若考虑运行时间则catboost编码最佳。<sup>[16](https://repository.tudelft.nl/file/File_9e5e5225-4c53-4362-862e-1b7072e82b6a?preview=1)</sup> 这与偏好基于划分分裂的库指导相悖，分歧尚未解决。<sup>[8](https://lightgbm.readthedocs.io/en/latest/Features.html)</sup>

## 近期进展

梯度提升库中原生的分类支持减少了对人工独热编码的需求。大多数现代基于树的库都内置了功能，可以更有效地处理分类变量而无需人工独热编码。<sup>[9](https://eecs.csuohio.edu/~sschung/CIS660/Limitations_OneHotEncoding.pdf)</sup> scikit-learn的HistGradientBoostingRegressor原生处理分类特征而无需显式编码，通过categorical_features="from_dtype"启用，该功能在1.4版本中引入；在每次分裂时，它使用一种按类别对目标变量影响排序的启发式方法将类别划分为不相交的集合。<sup>[20](https://scikit-learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_categorical.html)</sup> XGBoost 3.3.0于2026年6月17日发布，默认启用分类特征支持，同时保留enable_categorical供需要禁用的用户使用，并为CPU hist树方法的向量叶增加了独热分类分裂支持。<sup>[21](https://xgboost.readthedocs.io/en/latest/changes/v3.3.0.html)</sup> 更早时候，CatBoost论文指出LightGBM将尾部类别归为一个簇以处理高基数分类特征，并且目标统计特征需要仔细计算以避免目标泄漏。<sup>[22](https://proceedings.neurips.cc/paper_files/paper/2018/file/14491b756b3a51daac41c24863285549-Paper.pdf)</sup>

## 机器学习之外：独热状态机

在数字设计中，独热编码为每个有限状态机状态分配一个不同的代码位，并用每个状态一个触发器来实现状态寄存器；任一时刻只有一个触发器处于活动（即“热”）状态。<sup>[10](https://docs.amd.com/r/en-US/ug901-vivado-synthesis/One-Hot-State-Encoding)</sup><sup> • </sup><sup>[23](http://www1.pldworld.com/@xilinx/html/technote/TOOL/MANUAL/15i_doc/fndtn/fsu/fsu7_4.htm)</sup> 由于每个状态有自己的寄存器，状态机已经是译码的：独热编码减小了组合逻辑的宽度，因此状态机在寄存器之间所需的逻辑级数更少，从而降低复杂度并提高速度。高度编码的设计往往需要许多高扇入逻辑函数，而独热避免了这一点。<sup>[23](http://www1.pldworld.com/@xilinx/html/technote/TOOL/MANUAL/15i_doc/fndtn/fsu/fsu7_4.htm)</sup>

厂商默认值反映了这一点。在AMD Vivado综合中，独热是状态数不超过32的状态机的默认编码方案，通常是优化速度的良好选择。<sup>[10](https://docs.amd.com/r/en-US/ug901-vivado-synthesis/One-Hot-State-Encoding)</sup> Quartus Prime综合对FPGA器件使用独热编码，对CPLD使用最小位编码，通过标准独热编码创建独热寄存器编码，然后将第一位取反。<sup>[24](https://docs.altera.com/r/docs/683082/25.1/quartus-prime-pro-edition/user-guide/state-machine-processing)</sup> Xilinx手册的规模指导：独热通常是大型FPGA状态机的首选方法，状态数少于8的状态机用二进制编码可能更高效，状态数超过32的大型状态机应划分为若干个小状态机。<sup>[25](http://www1.pldworld.com/@xilinx/html/technote/TOOL/MANUAL/21i_doc/data/common/sim/sim4_4.htm)</sup>

## References

1. [Softmax Regression, Dive into Deep Learning 1.0.3](https://d2l.ai/chapter_linear-classification/softmax-regression.html)
2. [Multiclass Handout, CMU 10-601 (Spring 2022)](https://www.cs.cmu.edu/~hchai2/courses/10601-m22/lectures/Multiclass_Handout.pdf)
3. [OneHotEncoder, scikit-learn documentation](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html)
4. [A Smart Guide to Dummy Variables: Four Applications and a Macro, NESUG 98, UCLA](https://stats.oarc.ucla.edu/stat/sas/library/nesug98/p046.pdf)
5. [One-hot encoding, Google Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course/categorical-data/one-hot-encoding)
6. [Regularized target encoding outperforms traditional methods in supervised machine learning with high cardinality features, Computational Statistics (Springer)](https://link.springer.com/article/10.1007/s00180-022-01207-6)
7. [4.4: Multicollinearity and Categorical Independent Variables, Statistics LibreTexts](https://stats.libretexts.org/Courses/Knox_College/Linear_Models_and_Rurita_Kralovstvi/04%3A_Matrices_and_Linear_Regression/4.04%3A_Multicollinearity_and_Categorical_Independent_Variables)
8. [Features, LightGBM documentation](https://lightgbm.readthedocs.io/en/latest/Features.html)
9. [Limitations of One-Hot Encoding, Cleveland State University CIS 660 course notes](https://eecs.csuohio.edu/~sschung/CIS660/Limitations_OneHotEncoding.pdf)
10. [One-Hot State Encoding, UG901 Vivado Synthesis, AMD](https://docs.amd.com/r/en-US/ug901-vivado-synthesis/One-Hot-State-Encoding)
11. [4.4 - Dummy Variable Regression, Penn State STAT 502](https://online.stat.psu.edu/stat502/book/export/html/866)
12. [One-hot vs dummy encoding in Scikit-learn, Cross Validated](https://stats.stackexchange.com/a/224055/85955)
13. [Comparative Study on the Performance of Categorical Variable Encoders in Classification and Regression Tasks (arXiv, 2024)](https://arxiv.org/html/2401.09682)
14. [Encoding categorical data: Is there yet anything 'hotter' than one-hot encoding? (arXiv)](https://arxiv.org/html/2312.16930)
15. [A benchmark of categorical encoders for binary classification, NeurIPS 2023 Datasets and Benchmarks](https://proceedings.neurips.cc/paper_files/paper/2023/file/ac01e21bb14609416760f790dd8966ae-Supplemental-Datasets_and_Benchmarks.pdf)
16. [Encoding Methods for Categorical Data: A Comparative Analysis for Linear Models, Decision Trees, and Support Vector Machines, TU Delft](https://repository.tudelft.nl/file/File_9e5e5225-4c53-4362-862e-1b7072e82b6a?preview=1)
17. [Feature Engineering for Categorical Data, AI in Action](https://mikenguyen13.github.io/ai_in_action/062-feature-engineering-categorical.html)
18. [What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)?, Stack Overflow](https://stackoverflow.com/questions/36631163/what-are-the-pros-and-cons-between-get-dummies-pandas-and-onehotencoder-sciki)
19. [Categorical Data, XGBoost documentation](https://xgboost.readthedocs.io/en/stable/tutorials/categorical.html)
20. [Categorical Feature Support in Gradient Boosting, scikit-learn documentation](https://scikit-learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_categorical.html)
21. [XGBoost 3.3.0 Release Notes (June 17, 2026)](https://xgboost.readthedocs.io/en/latest/changes/v3.3.0.html)
22. [CatBoost: unbiased boosting with categorical features, NeurIPS 2018](https://proceedings.neurips.cc/paper_files/paper/2018/file/14491b756b3a51daac41c24863285549-Paper.pdf)
23. [Encoding Techniques, Xilinx Foundation manual](http://www1.pldworld.com/@xilinx/html/technote/TOOL/MANUAL/15i_doc/fndtn/fsu/fsu7_4.htm)
24. [2.6.4.1. State Machine Processing, Quartus Prime Pro User Guide, Altera](https://docs.altera.com/r/docs/683082/25.1/quartus-prime-pro-edition/user-guide/state-machine-processing)
25. [Encoding State Machines, Xilinx manual](http://www1.pldworld.com/@xilinx/html/technote/TOOL/MANUAL/21i_doc/data/common/sim/sim4_4.htm)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Machine learning overview

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/one-hot

English original: https://www.edgepedia.org/one-hot
