Code Monkey home page Code Monkey logo

pydecode's Introduction

PyDecode is a dynamic programming toolkit developed for research in natural langauge processing. Its aim is to be simple enough for fast prototyping, but efficient enough for research use.

_images/parsing_9_0.png



Features

  • Simple specifications. Dynamic programming algorithms specified through pseudo-code.

    # Viterbi algorithm.
    ...
    c.init(items[0, :])
    for i in range(1, n):
        for t in range(len(tags)):
            c.set(items[i, t],
                  items[i-1, :],
                  labels=labels[i, t, :])
    graph = c.finish()
    
  • Efficient implementation. Core code in C++, python interfaces through numpy.

    # Compute path.
    label_weights = numpy.random.random(graph.label_size)
    weights = pydecode.transform_label_array(graph, label_weights)
    path = pydecode.best_path(graph, weights)
    
  • High-level algorithms. Includes a set of widely-used algorithms.

    # Inside probabilities.
    inside = pydecode.inside(graph, weights, kind=pydecode.LogProb)
    
    # (Max)-marginals.
    marginals = pydecode.marginals(graph, weights)
    
    # Pruning
    mask = marginals > threshold
    pruned_graph = pydecode.filter(graph, mask)
    
  • Integration with machine learning toolkits. Train structured models.

    # Train a discriminative tagger.
    perceptron_tagger = StructuredPerceptron(tagger)
    perceptron_tagger.fit(X, Y)
    Y_test = perceptron_tagger.predict(X_test)
    
  • Visualization tools. IPython integrated tools for debugging and teaching.

    pydecode.draw(graph, paths=paths)
    

_images/hmm.png

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.