Code Monkey home page Code Monkey logo

znn's Introduction

Znn

Znn is an Elixir implementation of a nearest-neighbors text classifier that uses the Normalized Compression Distance. This approach is detailed in

Jiang et al., “Low-Resource” Text Classification: A Parameter-Free Classification Method with Compressors

Basic usage

Provide a training sample of labeled text data in the form

> training_set = [
    %{label: "clickbait", text: "21 Outrageously Creative Ways To Make Meatballs"},
    %{label: "non_clickbait", text: "H5N1 Avian Flu virus has mutated, study says"},
    ...
  ]

To predict the label of a new piece of text, call the predict function:

> text = "10 Amazing Ways To Grow Bigger Pumpkins"
> Znn.predict(text, training_set)
"clickbait"

Examples

See the included Livebooks in /livebooks for applications of Znn to public data sets.

Todo

  • Precompute the compression sizes and store them with the label and text. One-the-fly compression is a significant fraction of the prediction run time.
  • Allow other compression algorithms to be used, including no compression (identity function).
  • Adaptively compute parallel chunk size through warm-up runs.
  • Add multi-topic classification: handle a list of labels and include an appropriate voting scheme.

znn's People

Contributors

epfahl avatar

Stargazers

Jimmy Ruska avatar  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.