Text classification (wikidocs)
Text classification
- Binary classification vs. Multi-class classification
- ์์ : ์คํธ ๋ฉ์ผ ๋ถ๋ฅ, ์ํ ๋ฆฌ๋ทฐ ๋ถ๋ฅ (๊ฐ์ฑ ๋ถ์), ์๋ ๋ถ์
Word embedding
- ๋จ์ด๋ฅผ Dense vector๋ก ๋ฐ๊ฟ์ค
- keras์ Embedding(): '๋จ์ด ๊ฐ๊ฐ์ ์ ์๊ฐ ๋งคํ๋์ด ์๋ ์ ๋ ฅ'์ ์๋ฒ ๋ฉ ์์ ์ ์ํ
- 8~9 ์ฑํฐ ์ฐธ๊ณ
Word indexing
- ๋จ์ด๋ฅผ ๋น๋ ์ ์์๋๋ก ์ ๋ ฌํ๊ณ ์์ฐจ์ ์ผ๋ก ์ธ๋ฑ์ค๋ฅผ ๋ถ์ฌ
- ๋น๋ ์๊ฐ ์ ์ ๋จ์ด๋ฅผ ์ ๊ฑฐํ ์ ์์
- ๋ก์ดํฐ ๋ด์ค ๋ถ๋ฅ์ IMDB ๋ฆฌ๋ทฐ ๊ฐ์ฑ ๋ถ๋ฅ๋ ์ด ๋ฐฉ๋ฒ์ ์ฌ์ฉ (์ด๋ฏธ ์ด ์์ ์ด ๋์ด ์๋ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉ)
- 2 ์ฑํฐ ์ฐธ๊ณ
RNN
model.add(SimpleRNN(hidden_size, input_size=(timesteps, input_dim)))
- hidden_size: ์ถ๋ ฅ์ ํฌ๊ธฐ (output_dim)
- timesteps: ์์ ์ ์ = ๊ฐ ๋ฌธ์์์์ ๋จ์ด ์
- input_dim: ์ ๋ ฅ์ ํฌ๊ธฐ = ๊ฐ ๋จ์ด์ ๋ฒกํฐ ์ฐจ์ ์
- Text classification์ Many-to-One ๋ฌธ์
- Binary classification: Sigmoid / binary_crossentropy
- Multi-class classification: Softmax / categorical_crossentropy
References