https://github.com/jbrukh/bayesian
Thanks,
Jake.
func (this *classData) getWordProb(...
func (this *Classifier) Score(...
func (d *classData) getWordProb(...
func (cls *Classifier) Score(...
Style suggestion: please don't use "this" to name struct references. This makes code less readable (and unidiomatic).
you might use that, but it's certainly not idiomatic go.
i like the fact that if one is using a normal identifier, refactoring
between function and method is trivial.
func X(me *Foo)
doesn't look so good.
i wish it was possible to use gofmt to rename single letter variables.
func (data *classData) getWordProb(...
func (classifier *Classifier) Score(...
- Rick (not Rck ;-)
you might use that, but it's certainly not idiomatic go.
i like the fact that if one is using a normal identifier, refactoring
between function and method is trivial.func X(me *Foo)
doesn't look so good.
Thanks,
Jake
terms of functionality, do you recommend going to float64, then?
the Go libraries are the best expression of idiomatic Go that i know.
you won't find a single instance of "me" or "this" as a receiver
identifier there. that's a pretty good hint IMHO. of course, it *is*
a fairly minor point, but consistency of style is useful.
in Go, the receiver is just a normal variable like any other - why
should it be named differently because it's an implicit
argument?
>> i like the fact that if one is using a normal identifier, refactoring
>> between function and method is trivial.
>>
>> func X(me *Foo)
>>
>> doesn't look so good.
>
> This seems irrelevant.
it's relevant when refactoring
func (f *Foo) X()
to
func X(f *Foo)
or
func (f *Foo) DoWithBar(b *Bar)
to
func (b *Bar) DoWithFoo(f *Foo)
_, present := data.freqs[word]
if !present {
data.freqs[word] = 1
} else {
data.freqs[word]++
}
as this:
data.freqs[word]++
In terms of functionality, do you recommend going to float64, then?
On Nov 24, 6:50 am, Dmitry Chestnykh <dch...@gmail.com> wrote:
> On Wednesday, November 23, 2011 5:41:07 PM UTC+1, Jake wrote:
>
> > In terms of functionality, do you recommend going to float64, then?
>
> This would help a bit until you underflow float64 :-)
>
> Here are some resources:
>
> 1.https://en.wikipedia.org/wiki/Bayesian_spam_filtering#Other_expressio...
> 2.http://nlp.stanford.edu/IR-book/html/htmledition/naive-bayes-text-cla...
> 3.http://stackoverflow.com/questions/2691021/problem-with-precision-flo...
>
> -Dmitry