Categorical Feature

For LibSVM.

The Vector Classification Support Practical Guide suggests using an m-number to represent an attribute of an m-category. For example, {red, green, blue} can be represented as (0,0,1), (0,1,0), (1,0,0).

But in README, he says that the value in the index: value paragraph can only take a real number.

Does anyone know how to represent, say (0,0,1), in a data file?

+3
source share
2 answers

libsvm, SVM ( , ). 4 a, b, c, d libsvm 6 svms , b, c, d, b d, c d. , 6 . , (1,0,0,..) (0,1,0..).

libsvm. , , , , . 5 , 3 (3.3, 1.5, 0.5, 7.3, 3.5) 4,

4 1: 3,3 2: 1,5 3: 0,5 4: 7,3 5: 3,5

, , , , , . (.0,0,0,0,.7) 2, ( )

2 1:.5 5:.7

( ) , .

+2

3 (, , , ), libsvm 3 . , , + ve 100 , = .

+1 1:100 2: 0 3: 1 4: 0

0

Source: https://habr.com/ru/post/1762768/


All Articles