3 ms·
If you look at the code, it's more like "write an ARFF file parser in 40 lines" and "do a NB classifier with add-one smoothing in 10 lines". If you use a bette
by sqrt17 15y ago
If you look at the code, it's more like "write an ARFF file parser in 40 lines" and "do a NB classifier with add-one smoothing in 10 lines".
If you use a better-adapted input format and code things more concisely, you'd probably end up with two functions of 3-4 lines each; conversely, if you wanted to do things properly, you'd separate out ARFF file parsing and the Naive Bayes functionality.
All in all, the blog post wouldn't make me want to recommend their group for prospective (undergrad or graduate) students.
- tel 15y agoSeriously. I think you could golf NB into 2 lines pretty sensibly once you've got the data in. It's really just compute two histograms, multiply, and maximize.