- Python Machine Learning By Example
- Yuxi (Hayden) Liu
- 192字
- 2021-07-02 12:41:35
One hot encoding
The one-of-K or one hot encoding scheme uses dummy variables to encode categorical features. Originally, it was applied to digital circuits. The dummy variables have binary values such as bits, so they take the values zero or one (equivalent to true or false). For instance, if we want to encode continents, we'll have dummy variables, such as is_asia, which will be true if the continent is Asia and false otherwise. In general, we need as many dummy variables as there are unique labels minus one. We can determine one of the labels automatically from the dummy variables, because the dummy variables are exclusive. If the dummy variables all have a false value, then the correct label is the label for which we don't have a dummy variable. The following table illustrates the encoding for continents:

The encoding produces a matrix (grid of numbers) with lots of zeroes (false values) and occasional ones (true values). This type of matrix is called a sparse matrix. The sparse matrix representation is handled well by the the scipy package and shouldn't be an issue. We'll discuss the scipy package later in this chapter.
- Dreamweaver CS3網頁設計50例
- 傳感器技術應用
- Hands-On Linux for Architects
- 人工智能與人工生命
- Windows 7寶典
- 菜鳥起飛系統安裝與重裝
- Mastering ServiceNow Scripting
- Linux嵌入式系統開發
- Hands-On Data Warehousing with Azure Data Factory
- ESP8266 Robotics Projects
- Learning Cassandra for Administrators
- 手把手教你學Photoshop CS3
- 人工智能云平臺:原理、設計與應用
- 歐姆龍PLC應用系統設計實例精解
- 系統建模與控制導論