翻篇收录说明
翻篇网页快照

Working with categorical data | Machine Learning | Google for Developers

https://developers.google.com/machine-learning/crash-course/categorical-data

最近抓取:2026-12-01 09:28:39(北京时间)

最近内容变化:2026-12-01 09:28:39(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

This course module teaches the fundamental concepts and best practices of working with categorical data, including encoding methods such as one-hot encoding and hashing, creating feature crosses, and common pitfalls to look out for.

正文摘录

Home Products Machine Learning ML Concepts Crash Course Send feedback Working with categorical data Page Summary outlined_flag This module focuses on differentiating between categorical and numerical data within machine learning. You will learn how to represent categorical data using one-hot vectors and address common issues associated with it. The module covers encoding techniques for converting categorical data into numerical vectors suitable for model training. Feature crosses, a method for combining categorical features to capture interactions, are also discussed. It is assumed you have prior knowledge of introductory machine learning and working with numerical data. Categorical data has a specific set of possible values. For example: The different species of animals in a national park The names of streets in a particular city Whether or not an email is spam The colors that house exteriors are painted Binned numbers, which are described in the Working with Numerical Data module Numbers can also be categorical data True numerical data can be meaningfully multiplied. For example, consider a model that predicts the value of a house based on its area. Note that a useful model for evaluating house prices typically relies on hundreds of features. That said, all else being equal, a house of 200 square meters should be roughly twice as valuable as an identical house of 100 square meters. Oftentimes, you should represent features that contain integer values as categorical data instead of numerical data. For example, consider a postal code feature in which the values are integers. If you represent this feature numerically rather than categorically, you're asking the model to find a numeric relationship between different postal codes. That is, you're telling the model to treat postal code 20004 as twice (or half) as large a signal as postal code 10002. Representing postal codes as categorical data lets the model weight each individual postal code separately. Encoding Encoding means converting categorical or other data to numerical vectors that a model can train on. This conversion is necessary because models can only train on floating-point values; models can't train on strings such as "dog" or "maple". This module explains different encoding methods for categorical data. Help Center Previous Conclusion (2 min) Next Vocabulary and one-hot encoding (10 min) Send feedback Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated 2025-08-25 UTC.