NuPIC

Numenta Platform for Intelligent Computing

For more information on Numenta, Inc. or Grok for IT Analytics, please visit our website or follow us on Facebook or Twitter.

03 Dec 2014

HTM in Java!

Introducing the feature-complete htm.java project!

Thanks to a lot of effort by David Ray, the NuPIC hacker community, and Numenta’s own development staff, a fully usable version of NuPIC (minus swarming and OPF functionality ➟ coming soon!) is now available in Java.

This port is 100% functionally equivalent to NuPIC’s Network API.

See the complete javadocs here!

Bringing NuPIC to Java is an important milestone in NuPIC technology due to the size and significance of Java’s user base. Because Java is the world’s most used programming language, HTM now has the advantage of being exposed to an extraordinary amount of new developers and users.

htm.java is easy to setup and configure, and because the JVM is such a common runtime, that means instant availability on platforms like Windows and all Linux flavors without the use of a virtual machine (not to mention mobile devices!)

The community is fully committed to adding all the support tools and infrastructure the Python version enjoys, and those are the next milestones to be worked on. There is already a “HelloSP” example created by a community member. Here is the constructor:

/**
 * 
 * @param inputDimensions         The size of the input.  {m, n} will give a size of m x n
 * @param columnDimensions        The size of the 2 dimensional array of columns
 */
HelloSP(int[] inputDimensions, int[] columnDimensions) {
    inputSize = 1;
    columnNumber = 1;
    for (int x : inputDimensions) {
        inputSize *= x;
    }
    for (int x : columnDimensions) {
        columnNumber *= x;
    }
    activeArray = new int[columnNumber];
    
    parameters = Parameters.getSpatialDefaultParameters();
    parameters.setParameterByKey(KEY.INPUT_DIMENSIONS, inputDimensions);
    parameters.setParameterByKey(KEY.COLUMN_DIMENSIONS, columnDimensions);
    parameters.setParameterByKey(KEY.POTENTIAL_RADIUS, inputSize);
    parameters.setParameterByKey(KEY.GLOBAL_INHIBITIONS, true);
    parameters.setParameterByKey(KEY.NUM_ACTIVE_COLUMNS_PER_INH_AREA, 0.02*columnNumber);
    parameters.setParameterByKey(KEY.SYN_PERM_ACTIVE_INC, 0.01);
    parameters.setParameterByKey(KEY.SYN_PERM_TRIM_THRESHOLD, 0.005);

    sp = new SpatialPooler();
    mem = new Connections();
    parameters.apply(mem);
    sp.init(mem);
}

And here is the usage:

public static void main(String args[]) {
    HelloSP example = new HelloSP(new int[]{32, 32}, new int[]{64, 64});
    
    // Lesson 1
    System.out.println("\n \nFollowing columns represent the SDR");
    System.out.println("Different set of columns each time since we randomize the input");
    System.out.println("Lesson - different input vectors give different SDRs\n\n");
    
    //Trying random vectors
    for (int i = 0; i < 3; i++) {
        example.createInput();
        example.run();
    }
    
    //Lesson 2
    System.out.println("\n\nIdentical SDRs because we give identical inputs");
    System.out.println("Lesson - identical inputs give identical SDRs\n\n");

    for (int i = 0; i < 75; i++) System.out.print("-");
    System.out.print("Using identical input vectors");
    for (int i = 0; i < 75; i++) System.out.print("-");
    System.out.println();

    //Trying identical vectors
    for (int i = 0; i < 2; i++) {
      example.run();
    }
    
    // Lesson 3
    System.out.println("\n\nNow we are changing the input vector slightly.");
    System.out.println("We change a small percentage of 1s to 0s and 0s to 1s.");
    System.out.println("The resulting SDRs are similar, but not identical to the original SDR");
    System.out.println("Lesson - Similar input vectors give similar SDRs\n\n");

    // Adding 10% noise to the input vector
    // Notice how the output SDR hardly changes at all
    for (int i = 0; i < 75; i++) System.out.print("-");
    System.out.print("After adding 10% noise to the input vector");
    for (int i = 0; i < 75; i++) System.out.print("-");
    example.addNoise(0.1);
    example.run();

    // Adding another 20% noise to the already modified input vector
    // The output SDR should differ considerably from that of the previous output
    for (int i = 0; i < 75; i++) System.out.print("-");
    System.out.print("After adding another 20% noise to the input vector");
    for (int i = 0; i < 75; i++) System.out.print("-");
    example.addNoise(0.2);
    example.run();
}

Running this example code prints out the resulting SDRs to the console like this:

Now we are changing the input vector slightly.
We change a small percentage of 1s to 0s and 0s to 1s.
The resulting SDRs are similar, but not identical to the original SDR
Lesson - Similar input vectors give similar SDRs


---------------------------------------------------------------------------After adding 10% noise to the input vector-----------------------------------------------------------------------------------------------------------------------------------------------------------Computing the SDR----------------------------------------------------------------------
[63, 197, 286, 360, 400, 517, 518, 559, 561, 587, 590, 611, 619, 645, 704, 811, 1022, 1065, 1184, 1407, 1461, 1554, 1574, 1652, 1686, 1704, 1765, 1772, 1849, 1871, 1945, 2090, 2125, 2159, 2203, 2213, 2233, 2288, 2358, 2367, 2415, 2434, 2462, 2599, 2609, 2617, 2755, 2862, 2889, 2938, 2967, 2976, 2995, 3010, 3018, 3057, 3104, 3126, 3226, 3341, 3370, 3373, 3394, 3398, 3399, 3479, 3484, 3540, 3637, 3662, 3669, 3712, 3754, 3817, 3875, 3915, 3941, 3977, 3989, 4034, 4082]
---------------------------------------------------------------------------After adding another 20% noise to the input vector-----------------------------------------------------------------------------------------------------------------------------------------------------------Computing the SDR----------------------------------------------------------------------
[63, 197, 286, 310, 360, 400, 418, 517, 518, 559, 561, 587, 611, 619, 704, 811, 1022, 1065, 1184, 1248, 1461, 1485, 1552, 1554, 1574, 1611, 1652, 1669, 1686, 1704, 1772, 1849, 2090, 2125, 2159, 2203, 2213, 2233, 2367, 2415, 2434, 2462, 2545, 2599, 2609, 2617, 2755, 2846, 2862, 2889, 2938, 2967, 2976, 2995, 3008, 3010, 3018, 3057, 3104, 3106, 3126, 3226, 3264, 3341, 3370, 3394, 3399, 3479, 3484, 3540, 3637, 3664, 3669, 3712, 3875, 3915, 3959, 3977, 3989, 4034, 4082]

This is an outstanding milestone for Numenta, NuPIC and the NuPIC community because of all the advantages the Java language brings with it. It shows that the NuPIC community contains a full and vibrant user base that is very committed to the success of NuPIC and HTM technologies. The development of the Java version by the NuPIC community also validates the choice of making NuPIC open source, showing that its community desires a fully compliant version of NuPIC that is easy to manage, install and widely applicable.

Want to get involved?

Are you a Java programmer interested in neocortically-inspired machine intelligence? Check out the htm.java road map and find out where we need help. Create some sample applications and get your feet wet with HTM on the JVM.


On a personal note, I’d like to give a big thank you to David Ray. He came to us earlier this year with a plan for this Java port and the full intention of giving the codebase over to Numenta for management. Over the past several months, he has worked tirelessly reading the NuPIC codebase and painstakingly creating Java versions of all our algorithms. Congratulations to David for reaching this milestone and creating a complete port of NuPIC.

Matt Taylor
Open Source Community Flag-Bearer
Numenta, Inc.

Comments on Reddit


Top

24 Nov 2014

Introducing NuPIC Studio

Hello NuPICers!

I am introducing a nice tool for the NuPIC community. NuPIC Studio is a powerful all-in-one tool that allows users create an HTM network from scratch, train it, collect statistics, and share it among the members of the community.

NuStudio Screenshot

It is not just a visualization tool but an HTM builder, debugger and laboratory for experiments. It is ideal for newbies with little intimacy with NuPIC code as well as experts that wish for better productivity. Among its features and advantages are:

NuStudio Screenshot

NuStudio Screenshot

The project’s site is: https://github.com/nupic-community/nupic.studio

Enjoy!

David Ragazzi
NuPIC Committer
MSc in Software Engineering (University of Liverpool)

Comments on Reddit


Top

30 Oct 2014

2014 Fall Hackathon Outcome

NuPIC Fall 2014 Hackathon Logo

Thanks to Jeff Fohl for the excellent logo design!

On October 18-19 of 2014, we held our fourth NuPIC Hackathon in San Jose at Pinger, Inc. It was a 36-hour event, starting at 10AM on Saturday, and ending with hack demos at 4PM Sunday afternoon. We started with a Kickoff presentation to go over hackathon protocol, then jumped right into hacking. There were some interesting themes this time. A lot more people tried using cortical.io’s word fingerprinting service for natural language processing hacks. We also had a lot of interest in EEG analysis with NuPIC, which seems to be a hot topic within the community. And we even had another robotics demo!

I think I say this after every NuPIC hackathon we host, but this hackathon was the best one yet! We had well over 50 participants, 16 demos, and a ton of fun and community bonding. It was really nice to see some new faces at this hackathon. I love meeting the people of our community!

Once again, we had attendees from all over the world: Amsterdam, China, Austria, Ireland, not to mention from all over the United States. I was really impressed how with each hackathon our community gets a better understanding of NuPIC and how it can be used to tackle many different kinds of problems. Even though we had a high percentage of new hackers this time, I could really see the light bulbs turning on as I talked to people about their hackathon ideas.

I’ve separated this blog post into sections:

Photos

NuPIC Fall 2014 Hackathon

Everyone seems excited as the hackathon demos get started.

NuPIC Fall 2014 Hackathon

Another big thanks to Pinger, who let us use their offices to host the event once again.

NuPIC Fall 2014 Hackathon

Jeff Hawkins explains HTM concepts on a whiteboard.

NuPIC Fall 2014 Hackathon

Felix Andrews talks about HTM implemented in Clojure.

NuPIC Fall 2014 Hackathon

Chetan and Yuwei's robot from the Whole New World demo.

NuPIC Fall 2014 Hackathon

Marion Le Borgne and Artem Avdacev watching hackathon demos.

NuPIC Fall 2014 Hackathon

Scott Purdy sharing his knowledge with Daniel McDonald and Mark Whelan.

NuPIC Fall 2014 Hackathon

Yuwei explains the representations displayed from the Whole New World demo.

NuPIC Fall 2014 Hackathon

Jeff Hawkins and a guest on the way to the hackathon demos.

Testimonials

More people than ever, and a more diverse community than ever. We had pro hackers, students, software professionals, a neurologist, and even some new to programming in general.

Sessions

We only gave a few presentations from Numenta and friends for hackathon participants to attend in order to give more time for attendees to work on their projects. You can watch all the recordings we took at the hackathon in this playlist.

Kickoff

Hackathon Kickoff

Matt Taylor & Jeff Hawkins

Where hackers are welcomed to the hackathon, protocol is reviewed, and ideas are brainstormed.

EEGs and NuPIC

EEGs and NuPIC

Dr. Richard Pantera

We had a neurologist attending the hackathon, who was kind enough to sit in front of a camera for us and let us pick his brain about EEGs.

On the Way to Language Intelligence

On the Way to Language Intelligence

Francisco Webber, cortical.io

Francisco talks about language, intelligence, and cortical.io's new REST API version 2.0 and all its capabilities.

Applications of Hierarchical Temporal Memory (HTM)

Applications of Hierarchical Temporal Memory (HTM)

Chetan Surpur, Numenta Engineer

This talk is from the Numenta Workshop that preceeded the hackathon, but Chetan gave the same talk at the hackathon. Since the recording at the workshop was a better quality than the hackathon presentation, I've included the first one.

Q&A with Jeff Hawkins

Q&A with Jeff Hawkins

Jeff Hawkins

Jeff Hawkins takes questions about HTM theory from hackathon attendees and explains the answers in front of a whiteboard.

Demos

Games, physics, robotics, geology, natural language, geospatial analysis… demos at this hackathon spanned a large breadth of topics. We were really impressed with the types of things hackers attempted to perform with NuPIC. When we have hackathons, it’s a chance for people interested in NuPIC and HTM to push the boundaries of HTM technology and really see what it might be capable of. I always come away inspired and excited about the future of NuPIC and HTM, and this hackathon was no exception at all.

Not all hacks are success stories, but each one is a learning experience. We’ll never know what can be achieved with cortically-inspired machine intelligence unless we try to solve hard problems.

Pendulum

Pendulum

Alejandro Schuler, Andrew Morrison, Shashwat Kandadai

An attempt to balance an inverted pendulum using predicted data.

MineHack

MineHack

Matt Taylor

I created a Minecraft mod that exports player X,Y,Z coordinates into NuPIC using the CoordinateEncoder to get anomaly indications for a live player.

Shake Hack

Shake Hack

Austin Marshall

According to recent news, the Bay Area is overdue another "Big One". I'll be evaluating encoding schemes for data that comprises the last 10+ years of magnitude 2.5 or greater earthquake activity for the 1000 km radius centered on the Pinger headquarters in San Jose, CA. I'm hoping to identify earthquake swarms leading up to larger events in the same region.

A Whole New World

A Whole New World

Chetan Surpur, Yuwei Cui

A demonstration of sensorimotor inference in simple robotics.

Semantic Fingerprint Sentence Generation

Semantic Fingerprint Sentence Generation

Daniel McDonald, Mark Whelan

In this hack, we will attempt to generate semantic fingerprints from WordNet semantic relationships and train the HTM to recognize sequences of meaning from training texts. The trained HTM will be used to generate English sentences by using the predicted sequence of SDRs from the HTM to select words from the training set to fill in blanks in the sentences generated according to a limited English grammar.

HTM in Clojure

HTM in Clojure

Felix Andrews

Demo of HTM implemented in Clojure, with a web-based visualization.

Smart Harbor

Smart Harbor

Daniel Ducro, Egbert Wietses

  • Video
  • Source code (coming soon?)

Tracking geolocations of cargo ships in the port of Rotterdam.

Temporal Memory in Racket

Temporal Memory in Racket

Rian Shams

A Racket-based implementation of the current temporal memory algorithm. Amazingly, this was Rian's first real program. It's very impressive that he chose to implement HTM in a Lisp!

The Jinglinator 4000

The Jinglinator 4000

Sergey Alexashenko

I am training NuPIC on a dataset of 500 jingles and generating new jingles based on input vectors of a few notes.

Corti-Yelp

Corti-Yelp

Jim Bridgewater, Artem Avdacev

Using cortical.io to analyze Yelp's academic dataset. This might not have been the most successful hack at the hackathon, but it was one of the most entertaining.

NuPIC EEG

NuPIC EEG

Nicolas Thiebaud

  • Video (coming soon)
  • Source code (coming soon)

Nicolas used his hack to work on a Kaggle competition, and the rules of the competition prevent us from displaying his video or source code until the competition is over.

AutoDJ

AutoDJ

George London

  • Video
  • Source code (coming soon?)

I'm extracting my track-by-track music listening history from Last.fm and then seeing if NUPIC can predict what artist I'm going to listen to next given a sequence of my previous listens.

Kaggle Bike Share Demand Prediction

Kaggle Bike Share Demand Prediction

Chandan Maruthi

  • Video
  • Source code (coming soon?)

Chandan tried using NuPIC to solve a Kaggle Bike Sharing competition, where one week of demand data is missing from each month.

We'll Always Have Paris

We'll Always Have Paris

Pablo Gonzalvez, Soren Madsen, Erik Graf of cortical.io.

Feed a network of htms with articles about different topics. Get the network to extract and learn interesting facts from the input. Then query the network's knowledge.

Heartbeat

Heartbeat

Ben Morrow

Apple Watch app for telling if there is an anomaly detected in your heartbeat. You can view the rhythm strip and share the information with your doctor.

EEG Data Classification

EEG Data Classification

Marion Le Borgne

EEG data is classified by NuPIC based upon the thoughts of the subject. EEG data was collected by an OpenBCI board.

As the NuPIC community grows, I continue to be awed and inspired by its passion and perseverance. A sincere thank you to all who have participated on our mailing lists, our code repositories, and our hackathons. You folks are the reason we’ve gone open source, and the reason we continue to thrive. I see a bright future for us, and I truly believe we will lead the path forward to truly intelligent machines built on neocortical principles.

It’s not an easy road, but you are the pioneers helping us pave it for the masses that will follow. I had a wonderful time interacting with all of you, and I look forward to even more ground-breaking work at the next hackathon in Spring 2015.

Matt Taylor
Open Source Community Flag-Bearer
Numenta, Inc.

Comments on Reddit

By the way! You can see all the videos and photos taken at every hackathon on our YouTube channel and Flickr page.


Top