Giter Club home page Giter Club logo

cortipy's Introduction

cortipy Build Status Coverage Status

Numenta's Cortical.io REST API client in Python.

This is not the official Cortical.io Python REST client for their API. You can find the official client at https://github.com/cortical-io/python-client-sdk.

Installation

You must have a valid REST API key from Cortical.io.

To install, run:

python setup.py install

If you plan on making changes to cortipy, install in development mode:

python setup.py develop --user

Then, set up the following environment variables with your REST API credentials:

export CORTICAL_API_KEY=api_key

Usage

Classification Example

import cortipy
import os

# Init API client
apiKey = os.environ.get('CORTICAL_API_KEY')
client = cortipy.CorticalClient(apiKey)

# Create the category with some positive (and negative) examples, and a name.
pos = [
	"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.",
  	"To iterate is human, to recurse divine.",
    "First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack."
    ]
neg = [
	"To err is human, to forgive divine."
	]
categoryName = "programming quotes"
programmingCategory = client.createClassification(categoryName, pos, neg)

# Evaluate how close a new term is to the category.
termBitmap = client.getBitmap("Python")['fingerprint']['positions']
distances = client.compare(termBitmap, programmingCategory['positions'])
print distances['euclideanDistance']

# Try a block of text.
textBitmap = client.getTextBitmap("The Zen of Python >>>import this")['fingerprint']['positions']
distances = client.compare(textBitmap, programmingCategory['positions'])
print distances['euclideanDistance']

cortipy's People

Contributors

rhyolight avatar boltzmannbrain avatar akhilaananthram avatar oxtopus 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.