Cognitive Computing

James L. Weaver
Developer Advocate
 


jweaver@pivotal.io
JavaFXpert.com

@JavaFXpert

Sandhya Kapoor
Senior Software Engineer

 


kapoor@us.ibm.com
ibm.co/2dHGB28

@SandhyaKapoor9

About Presenter James Weaver

Java Champion, JavaOne Rockstar, plays well with others, etc :-)

Author of several Java/JavaFX/RaspPi books

@JavaFXpert

Developer Advocate & International Speaker for Pivotal

About Presenter Sandhya Kapoor

Developer, Women in Tech Activist

Senior Systems Engineer & Cognitive Computing Advocate for IBM

@SandhyaKapoor

Holds seven computer science related patents

Added Java 2 Security to WebSphere

International Speaker

Workshop Prerequisites (1 of 2)

Prior to the workshop, attendees must have installed the following:

@JavaFXpert

Deeplearning4j deeplearning4j.org examples

- Follow the Quick Start Guide http://deeplearning4j.org/quickstart through and including the DL4J Examples in a Few Easy Steps section.

- Criterion for successful install is that running CSVExample yields output that ends with a block of scores similar to the following:

Workshop Prerequisites (2 of 2)

Prior to the workshop, attendees must have installed the following:

@JavaFXpert

BURLAP burlap.cs.brown.edu examples

Use a similar procedure to install the BURLAP examples from the GitHub repository https://github.com/jmacglashan/burlap_examples/ as you did installing the Deeplearning4j examples from its GitHub repository.  This procedure is:

> git clone https://github.com/jmacglashan/burlap_examples.git

> cd burlap_examples

> mvn clean install

Open the burlap_examples project in your IDE.

Criterion for successful installation is that running HelloGridWorld yields the display as shown on the right:

Workshop Part One

The labs follow this slide, but click here to see the content of Part One of this workshop. 

Neural Network Lab:

@JavaFXpert

In CSVExample (located in the dl4j-examples project), modify the following hyperparameters and notice the effects on scores in the console ouput:

  • Learning rate
  • Iterations
  • Number of nodes in hidden layers
  • Number of hidden layers

 

Modifying Hyperparameters

Neural Network Lab:

@JavaFXpert

In CSVExample (located in the dl4j-examples project), add the following lines of code to classify/predict an Iris flower that doesn't exist in the Iris dataset:

Making predictions

INDArray example = Nd4j.zeros(1, 4);
example.putScalar(new int[] { 0, 0 }, 5.1);
example.putScalar(new int[] { 0, 1 }, 3.5);
example.putScalar(new int[] { 0, 2 }, 1.4);
example.putScalar(new int[] { 0, 3 }, 0.2);
DataSet ds = new DataSet(example, null);
normalizer.transform(ds);
int[] prediction = model.predict(example);
System.out.println("prediction for 5.1,3.5,1.4,0.2: " + prediction[0]);

 

Reinforcement Learning Lab:

@JavaFXpert

In BasicBehavior (located in the burlap_examples project), make the only uncommented lines in the main() method be the following:

Modifying the rewards

example.qLearningExample(outputPath);
example.visualize(outputPath);

In the BasicBehavior() constructor method, add the bolded lines between the existing lines shown below, and observe the effects on the values in the states of the grid world.

goalCondition = new TFGoalCondition(tf);
RewardFunction rf = new GoalBasedRF(tf, 5.0);
gwdg.setRf(rf);
domain = gwdg.generateDomain();

Reinforcement Learning Lab:

@JavaFXpert

In BasicBehavior (located in the burlap_examples project), verify that the only uncommented lines in the main() method are the following:

Modifying the Discount Factor

example.qLearningExample(outputPath);
example.visualize(outputPath);

In the qLearningExample() method, modify the gamma (discount factor) argument to the QLearning constructor and observe the effects on the values in the states of the grid world.

Cognitive Computing

James L. Weaver
Developer Advocate
 


jweaver@pivotal.io
JavaFXpert.com

@JavaFXpert

Sandhya Kapoor
Senior Software Engineer

 


kapoor@us.ibm.com
ibm.co/2dHGB28

@SandhyaKapoor9

Cognitive Computing Exposed Workshop

By javafxpert

Cognitive Computing Exposed Workshop

Shedding light on cognitive computing

  • 3,219