###### tags: `MLCC`
# Feature Crosses
### [colab 執行範例](https://colab.research.google.com/github/google/eng-edu/blob/main/ml/cc/exercises/representation_with_a_feature_cross.ipynb?utm_source=mlcc&utm_campaign=colab-external&utm_medium=referral&utm_content=representation_tf2-colab&hl=zh-tw#scrollTo=D-IXYVfvM4gD)
## Encoding Nonlinearity
:::info
當數據的分群無法用線性表示時,nonlinear 就可以派上用場。
- :::spoiler (圖一) 可用 linear 表示

:::
- :::spoiler (圖二) 不可用 linear 表示

:::
:::
- 建立 feature cross 叫做 X3

- 線性規化公式變成 <- 這算是非線性規化公式嗎??

- feature crosses 種類
- [A X B] 2個特徵的值相乘
- [A x B x C x D x E] 5個特徵的值相乘
- ....
- [A x A] 2個依樣的特徵相乘
- 透過 **stochastic gradient descent 隨機梯度下降**,讓大量的數據能夠有效率的訓練 model
## Crossing One-Hot Vectors
- 組合有種AND運算的感覺 (我不太懂)
- example
```python=
height = [
[150, 160),
[160, 170),
[170, 180)
]
gender = ["male", "female"]
height_x_gneder = [
[150, 160) AND "male", [160, 170) AND "male", [170, 180) AND "male",
[150, 160) AND "female", [160, 170) AND "female", [170, 180) AND "female"
]
```