Coder Social home page Coder Social logo

pyautospec's Introduction

pyAutoSpec

pyAutoSpec is a simple library for demonstrating the spectral learning algorithm detailed in the 2014 paper Spectral learning of weighted automata by Borja Balle, Xavier Carreras, Franco M. Luque and Ariadna Quattoni.

You can find an introduction on my blog.

Disclaimer

This is a toy implementation of spectral learning:

  • it is not optimized
  • it is not thoroughly tested
  • it is as simple as possible

DO NOT USE IN PRODUCTION

If you need spectral learning in your application use scikit-splearn instead.

Installation

To build the library just run

pip install -e .

Or use the provided docker file:

docker build -t pyautospec .
docker run -p 8888:8888 -it pyautospec

and access the Jupyter notebook.

Quick Start

Suppose you have a function f that takes a string and returns a number, you want to learn a weighted finite automaton that computes f, you do this

from pyautospec import SpectralLearning

alphabet = [ord(c) for c in range(ord('a'), ord('z')+1)]

learner = SpectralLearning(alphabet, 3)

automaton = learner.learn(f)

see the Automata Learning example.

The same thing can be done for a function f that takes a number in an interval and returns a number, in this case you can do this

from math import sin, pi
from pyautospec import FunctionWfa

# learn the sin function in the [0,2ฯ€] interval
sin_aut = FunctionWfa().fit(sin, x0=0.0, x1=2*pi, learn_resolution=2)

see the Trigonometric Functions example.

pyautospec's People

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.