0
$\begingroup$

In the bag of words model, generally is it better to have more codewords or less? For example, if I have 1000 x 20 raw features, then what would be good value for codebooks? I am thinking of smaller size codebook ( such as 20) so that it forces the representation to be sparse.

$\endgroup$
1
$\begingroup$

It is a trade-off between recall and precision. If you have only one codeword in your codebook then everything will map to it and you will have high recall. If you have 20,000 codewords in your codebook then you will have high precision and low recall. You can use a validation set to try different codebook sizes and see which one works best for your application.

If you have a smaller size codebook I don't think that will help you get a sparse feature. It will just mean that more features map onto the same small set of codewords, increasing the recall.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.