Code Monkey home page Code Monkey logo

naive-bayes-classifier-scala's Introduction

naive-bayes-classifier-scala

Naive bayes classifier library. Implemented by Scala.

This is porting from ptnplanet/Java-Naive-Bayes-Classifier

Build Status Maven Central Scaladoc

Getting Started

libraryDependencies ++= Seq(
  "com.tsukaby" %% "naive-bayes-classifier-scala" % "0.1.0"
)

This library has been published in the Maven central.

How to use

// Create instance
val bayes = new BayesClassifier[String, String]()

// Learning
bayes.learn("technology", "github" :: "git" :: "tech" :: "technology" :: Nil)
bayes.learn("weather", "sun" :: "rain" :: "cloud" :: "weather" :: "snow" :: Nil)
bayes.learn("government", "ballot" :: "winner" :: "party" :: "money" :: "candidate" :: Nil)

val unknownText1 = "I use git".split(" ")
val unknownText2 = "Today's weather is snow".split(" ")
val unknownText3 = "I will vote for that party".split(" ")

// Classify
println(bayes.classify(unknownText1).map(_.category).getOrElse("")) // technology
println(bayes.classify(unknownText2).map(_.category).getOrElse("")) // weather
println(bayes.classify(unknownText3).map(_.category).getOrElse("")) // government

Contribution

I'm seeking your PR!!! I'm easy.

For example.

  • Bug fix
  • Refactoring the code.
  • Add new features and others.
  • Fix my odd English texts.

License

Copyright 2015 - 2015 tsukaby.com
MIT License

naive-bayes-classifier-scala's People

Contributors

sh0hei avatar tsukaby avatar

Watchers

 avatar

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.