Giter Club home page Giter Club logo

wela's Introduction

wela

A Scala wrapper around Weka Machine Learning java library.

This is currently a very preliminary development. It is just a wrapper around the main classification features that I personally need to help perform predictions from scala code.

The current code already tries to simplify the use of Weka by adding more type safety and making the code more straightforward to code. As it's a light wrapper around Weka features, even if it tries to make things more immutable and "pure", there are loads of scary bits in it.

Usage

The scala syntax already simplifies the use of Weka in your core quite a lot. This is an example based on the Weka Programmatic Use example:

  1. Create a problema define the prediction label and dataset attributes:
  val pbl = Problem("test", NominalAttribute('color, Seq('red, 'blue, 'green))) withAttributes(NumericAttribute('size), NumericAttribute('weight))
  1. Load some data for the problem:
  val train = pbl withInstances (
    Instance(
      'size -> 10.0,
      'weight -> 10,
      'color -> 'blue),
    Instance(
      'size -> 11.0,
      'weight -> 10,
      'color -> 'red),
    Instance(
       'size -> 11.0,
       'weight -> 15,
       'color -> 'red),
    Instance(
       'size -> 11.0,
       'weight -> 20,
       'color -> 'red),
    Instance(
       'size -> 10.0,
        'weight -> 50,
        'color -> 'green),
     Instance(
        'size -> 10.0,
        'weight -> 55,
        'color -> 'green))
  1. Train a Classifier
  val model = Classifier(new NaiveBayes()) train (train)
  1. Try to predict the label of a new instance (model is an Option)
  val pred = model map { cl =>
    cl.classifyInstance(Instance('size -> 10,
      'weight -> 50))
  }
  println(pred)

For more basic examples, see wela.examples.MyApp.

contribute

The project follows the git flow organization for branching. If you want to participate, check out how it works.

License

Following WEKA's GPL licence, this project is also under the GNU General Public Licence V3.

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.