• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

scalanlp/nak: The Nak Machine Learning Library

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

scalanlp/nak

开源软件地址(OpenSource Url):

https://github.com/scalanlp/nak

开源编程语言(OpenSource Language):

Scala 72.4%

开源软件介绍(OpenSource Introduction):

Nak Build Status

Nak is a Scala/Java library for machine learning and related tasks, with a focus on having an easy to use API for some standard algorithms. It is formed from Breeze, Liblinear Java, and Scalabha. It is currently undergoing a pretty massive evolution, so be prepared for quite big changes in the API for this and probably several future versions.

We'd love to have some more contributors: if you are interested in helping out, please see the #helpwanted issues or suggest your own ideas.

What's inside

Nak currently provides implementations for k-means clustering and supervised learning with logistic regression and support vector machines. Other models and algorithms that were formerly in [breeze.learn] are now in Nak.

See the Nak wiki for (some preliminary and unfortunately sparse) documentation.

The latest stable release of Nak is 1.2.1. Changes from the previous release include:

  • breeze-learn pulled into Nak
  • K-means from breeze-learn and Nak merged.
  • Added locality sensitive hashing

See the CHANGELOG for changes in previous versions.

Using Nak

In SBT:

libraryDependencies += "org.scalanlp" % "nak" % "1.2.1"

In Maven:

<dependency>
   <groupId>org.scalanlp</groupId>
   <artifactId>nak</artifactId>
   <version>1.2.1</version>
</dependency>

Example

Here's an example of how easy it is to train and evaluate a text classifier using Nak. See TwentyNewsGroups.scala for more details.

def main(args: Array[String]) {
  val newsgroupsDir = new File(args(0))
  implicit val isoCodec = scala.io.Codec("ISO-8859-1")
  val stopwords = Set("the","a","an","of","in","for","by","on")

  val trainDir = new File(newsgroupsDir, "20news-bydate-train")
  val trainingExamples = fromLabeledDirs(trainDir).toList
  val config = LiblinearConfig(cost=5.0)
  val featurizer = new BowFeaturizer(stopwords)
  val classifier = trainClassifier(config, featurizer, trainingExamples)

  val evalDir = new File(newsgroupsDir, "20news-bydate-test")
  val maxLabelNews = maxLabel(classifier.labels) _
  val comparisons = for (ex <- fromLabeledDirs(evalDir).toList) yield
    (ex.label, maxLabelNews(classifier.evalRaw(ex.features)), ex.features)
  val (goldLabels, predictions, inputs) = comparisons.unzip3
  println(ConfusionMatrix(goldLabels, predictions, inputs))
}

Questions or suggestions?

Post a message to the scalanlp-discuss mailing list or create an issue.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap