Giter Club home page Giter Club logo

bayesian's People

Contributors

charl avatar codelingobot avatar glacials avatar jbrukh avatar mish15 avatar navossoc avatar octplane avatar rawoke083 avatar urjitbhatia avatar yml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bayesian's Issues

Return bayesian.Class Instead of Index?

LogScores, ProbScores, and SafeProbScores all have a return parameter that is the index of the most likely class. I think if you're ever willing to break the current api it would be a ton more useful to return the actual bayesian.Class.

It would make simple usage as below much easier.

As it stands I have to know the index of which I passed it into my classifier. That's knowledge I'd rather not have to know. It's kind of a difficult way to do it.

const (
    Good bayesian.Class = "Good"
    Bad  bayesian.Class = "Bad"
    Ugly bayesian.Class = "Ugly"
)

classifier := bayesian.NewClassifier(Good, Bad, Ugly)

_, c, _, _ := classifier.SafeProbScores(wht)

if c == Ugly {
    fmt.Println("oh no")
}

Panic if underflow is detected in `SafeProbScores`

SafeProbScores ... If an underflow is detected, this method panics

Source

I am getting a bit confused by the comment in the method above according to the doc this method is suppose to panic but the code instead returns an error.

Am I missing something ?

Add classes after classifier creation

Apologies in advance as my knowledge of Go is still somewhat limited, so this may be a naive question.

I want to expose the naive bayes classifying as a HTTP Web service, with both train and classify endpoints. I have no trouble with that, but I want the train endpoint to be able to accept new labels (labels that aren't currently in the classifier). Right now the labels are simply specified as consts and passed into the constructor. Can you think of the best way to add the ability to add labels at run-time?

Prior probability includes word frequencies?

This is rather a question than an actual issue, but anyway.

First, did I get it right that the prior probability P(C_j) of a class is the number of document within that class, divided by the total number of documents?

And if so, why does the getPriors() function set the prior prob. of a class C to the number of words in documents of that class (classData.Total) divided by the total number of words? I'd expect that for the prior prob, words don't play any role, yet.

Probably I have a problem in understanding, so please try to enlight me.

Release 1.0 is really old - make a new release

1.0 is still importing things like "gob" instead of "encoding/gob" etc. Can you make a new release? I can also help co-maintain the project is that helps.

Tools like dep will pick up release versions for most people and they will get code that won't work for newer versions of go.

Thanks!

request for a tag of an older commit

git tag -a 1.1 35eb93528ee -m "tag a specific older version that was built against"
git push --tags

In addition, it would be nice if current versions were tagged as well...

Seen() is always 0?

package main

import (
	"log"

	"github.com/jbrukh/bayesian"
)

const (
	Arabic  bayesian.Class = "Arabic"
	Malay   bayesian.Class = "Malay"
	Yiddish bayesian.Class = "Yiddish"
)

func main() {

	nbClassifier := bayesian.NewClassifier(Arabic, Malay, Yiddish)
	arabicStuff := []string{"algeria", "bahrain", "comoros"}
	malaysianStuff := []string{"malaysians", "bahasa"}
	yiddishStuff := []string{"jewish", "jews", "israel"}
	nbClassifier.Learn(arabicStuff, Arabic)
	nbClassifier.Learn(malaysianStuff, Malay)
	nbClassifier.Learn(yiddishStuff, Yiddish)

	log.Println(nbClassifier.Learned()) // 3
	log.Printf(`SEEN: %d`, nbClassifier.Seen()) // 0
}

what is good or bad?

what is good or bad?

Sorry, I didn't understand. After getting the result, how to know whether the result belongs to good or bad?

scores, likely, _ := classifier.LogScores(
                        []string{"tall", "girl"},
                     )

probs, likely, _ := classifier.ProbScores(
                        []string{"tall", "girl"},
                     )

likely == 1 is bad?
@jbrukh

Allow classifier to initialise with only one class

Current code panics in case the classifier is initialised with just 1 class.
However I have an edge case where there might only be a single class.
So I was thinking maybe classifier could be allowed to initialise with just 1 class.
I made changes in the code and tested for my use case. It worked. However, the unit tests fail in this case.
Is there any specific reason to keep this limitation?
What would be a good way to solve this, if any?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.