---
# System prepended metadata

title: groupby_score 範例說明

---

# groupby_score 範例說明

## 資料格式範例

| Season | y_true | y_pred |
| -------- | -------- | -------- |
| 201314     |<font color="red">1</font>    | <font color="red">4</font>      |
| 201314     |<font color="red">2</font>     | <font color="red">3</font>      |
| 201314     |<font color="red">3</font>    | <font color="red">2</font>      |
| 201314     | <font color="red">4</font>    | <font color="red">1</font>     |
| 201415     |<font color="blue">5</font>     | <font color="blue">6</font>     |
| 201415     | <font color="blue">6</font>    | <font color="blue">5</font>     |

## groupby 計算

依照 不同 Season 分別使用 score1_func(y_true,y_pred)、score2_func(y_true,y_pred) 進行評分


| Season | score1 | score2 |
| -------- | -------- | -------- |
| 201314     | 2    | 0     |
| 201415     | 3    | 1     |


計算:
201314 的 score1 =  score1_func(y_true=<font color="red">[1,2,3,4]</font>,y_pred=<font color="red">[4,3,2,1]</font>) = 2
201314 的 score2 = score2_func(y_true=<font color="red">[1,2,3,4]</font>,y_pred=<font color="red">[4,3,2,1]</font>) = 0
201415 的 score1 =  score1_func(y_true=<font color="blue">[5,6]</font>,y_pred=<font color="blue">[6,5]</font>) = 3
201415 的 score2 = score2_func(y_true=<font color="blue">[5,6]</font>,y_pred=<font color="blue">[6,5]</font>) = 1

## 計算總分
Total Score =  2 + 0 +3 +1 = 6
