Category Archives: Derived DB

Phil 1.22.16

6:45 – 2:15 VTX

  • Timesheet day? Nope. Next week.
  • Ok, now that I think I understand Laplace Transforms and why they matter, I think I can get back to Calibrating Noise to Sensitivity in Private Data Analysis. Ok, kinda hit the wall on the math on this one. These aren’t formulas that I would be using at this point in the research. It’s nice to know that they’re here, and can probably help me determine the amount of noise that would be needed in calculating the biometric projection (which inherently removes information/adds noise).
  • Starting on Security-Control  Methods  for  Statistical  Databases: A  Comparative  Study
  • Article on useful AI chatbots. Sent SemanticMachines an email asking about their chatbot technology.
  • Got the name disambiguation working pretty well. Here’s the text:
    • – RateMDs Name Signup | Login Claim Doctor Profile | Claim Doctor Profile See what’s new! Account User Dashboard [[ doctor.name ]] Claim Doctor Profile Reports Admin Sales Admin: Doctor Logout Toggle navigation Menu Find A Doctor Find A Facility Health Library Health Blog Health Forum Doctors › Columbia › Family Doctor / G.P. › Unfollow Follow Share this Doctor: twitter facebook Dr. Robert S. Goodwin Family Doctor / G.P. 29 reviews #9 of 70 Family Doctors / G.P.s in Columbia, Maryland Male Dr Goodwin & Associates Unavailable View Map & ……………plus a lot more ………………..Hospitalizes Infant In Spain Wellness How Did Google Cardboard Save This baby’s life? Health 7 Amazing Stretches To Do On a Plane Follow Us You may also like Dr. Charles L. Crist Family Doctor / G.P. 24 reviews Top Family Doctors / G.P.s in Columbia, MD Dr. Mark V. Sivieri 21 reviews #1 of 70 Dr. Susan B. Brown Schoenfeld 8 reviews #2 of 70 Dr. Nj Udochi 4 reviews #3 of 70 Dr. Sarah L. Connor 4 reviews #4 of 70 Dr. Kisa S. Crosse 7 reviews #5 of 70 Sign up for our newsletter and get the latest health news and tips. Name Email Address Subscribe About RateMDs About Press Contact FAQ Advertise Privacy & Terms Claim Doctor Profile Top Specialties Family G.P. Gynecologist/OBGYN Dentist Orthopedics/Sports Cosmetic Surgeon Dermatologist View all specialties > Top Local Doctors New York Chicago Houston Los Angeles Boston Toronto Philadelphia Follow Us Facebook Twitter Google+ ©2004-2016 RateMDs Inc. – The original and largest doctor rating site.
    • Here’s the list of extracted people:
      PERSON: Robert S. Goodwin
      PERSON: Robert S. Goodwin
      PERSON: L. Crist
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: G
      PERSON: Robert S. Goodwin
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: Goodwin
      PERSON: Ajay Kumar
      PERSON: Charles L. Crist
      PERSON: Mark V. Sivieri
      PERSON: B. Brown Schoenfeld
      PERSON: L. Connor
      PERSON: S. Crosse
    • And here some tests against that set (low scores are better. Information Distance):
      Best match for Robert S. Goodwin is PERSON: Robert S. Goodwin (score = 0.0)
      Best match for Goodwin Robert S. is PERSON: Robert S. Goodwin (score = 0.0)
      Best match for Dr. Goodwin is PERSON: Robert S. Goodwin (score = 1.8)
      Best match for Bob Goodwin is PERSON: Robert S. Goodwin (score = 2.0)
      Best match for Rob Goodman is PERSON: Robert S. Goodwin (score = 2.6)
  • So I can cluster together similar (and misspelled) words, and SNLP hands me information about DATE, DURATION, PERSON, ORGANIZATION, LOCATION
  • Don’t know why I didn’t see this before – this is the page for the NER with associated papers. That’s kind as close to a guide as I think you’ll find in this system
Advertisements

Phil 1.7.16

7:00 – 4:00 VTX

  • Adding more codes in Atlas.
  • Found a good stemming algorithm/implementation, including java
  • Discovered the Lemur ProjectThe Lemur Project develops search engines, browser toolbars, text analysis tools, and data resources that support research and development of information retrieval and text mining software. The project is best known for its Indri search engine, Lemur Toolbar, and ClueWeb09 dataset. Our software and datasets are used widely in scientific and research applications, as well as in some commercial applications.
  • Also, discovered that TREC also has sets of queries that they use. Here’s an example
  • Ok. Pro JPA, Chapter 2.
    • Got the example code from here
    • How to drop and create the DB from the schema: http://antoniogoncalves.org/2014/12/11/generating-database-schemas-with-jpa-2-1/
    • STILL having problems finding the provider! – Exception in thread “main” javax.persistence.PersistenceException: No Persistence provider for EntityManager
    • Finally found this on stackoverflow
      • Go to Project Structure.
      • Select your module.
      • Find the folder in the tree on the right and select it.
      • Click the Sources button above that tree (with the blue folder) to make that folder a sources folder.
    • And that worked. Here’s the ‘after’ screenshot: AddToIntelliJPath

Phil 1.6.16

10:30 – 6:00 VTX

  • Took Mom in for a colonoscopy. Her insides are looking good for 89 years old…
  • Was able to generate a matrix of codes from AtlasTi, which means that I should be able to do centrality calculations of the Excel exports.
  • Also placed the main Atlas work files in SVN. It’s a little tricky since the project library in on Google drive. My fix has been to leave the ‘MyLibrary’ location in its default location and just update the library information when asked. I think it’s just populating a file in the emptier(?) library file. I think it’s important for the Google Drive file locations to be identical though.
  • Flailing stupidly at getting a JPA hello world to run. Constantly getting: Exception in thread “main” javax.persistence.PersistenceException: No Persistence provider for EntityManager named instrument
  • Trying to flail a little smarter. Got Pro JPA 2, 2nd ed.
  • Added checking to the criteria string so that if there is no match on the criteria field in question, it’ll throw an exception.

Phil 1.5.16

7:00 – 4:30 VTX

  • Working my way through / getting familiar with AtlasTi. I’ll have two papers in by this afternoon, so I should be able to try some quantitative taxonomy extraction.
  • Since I got the drillDownAlias() method running yesterday, I’m going to try setting up the various queries for the networks, dictionaries and users. That seems to be working nicely.
  • Added test queries for BaseUser, BaseDictionary and BaseNetwork. While doing this, I realized that I had not set up mapping from the dictionary to the entries and fixed that.
  • Need to see how we’re going to do CRUD actions on these structures.
  • Wrote the deduplicate methods for Aaron.

Phil 12.31.15

Phil 7:00 – 4:00 VTX

  • Decided to get a copy (hopefully with student discount) of Atlas. It does taxonomic analysis and outputs a matrix to Excel that I should be able to use to produce PageRank???
  • Timesheets! Done
  • Seeing if I can add a bit of reflection to addXXX(YYY) that will invoke add/setYYY(XXX). Since the target is a map, it shouldn’t care, but I do need to worry about recursion…
  • Added addSourceToTarget() and testSourceInTarget() to GuidBase. So Now addM2M looks like
    public void addM2M(GuidBase obj) throws Exception {
        System.out.println("person.addM2M");
        addSourceToTarget(this, obj);
        addSourceToTarget(obj, this);
    }

    and the example of Showroom.addCar() looks like

    public void addCar(Car car){
        if(cars == null){
            cars = new HashSet<>();
        }
        cars.add(car);
    
        try {
            if(!testSourceInTarget(this, car)){
                addSourceToTarget(this, car);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    Which now means that the two way mapping is automatic. And in case you’re wondering, testSourceInTarget looks first for a method that returns the source type, and then looks for a method that returns a Set<source type>. If it find the source in either one of those, it returns true.

  • Got queries running. Simple queries are easy, but the more complex ones can be pretty ugly. Here’s an example that pulls a Showroom Object based on a nested Person Object (instanced as ‘customer’):
    // do a query based on a nested item's value. Kinda yucky...
    Criteria criteria = session.createCriteria(Showroom.class, "sh");
    criteria.createAlias("sh.customers", "c");
    List result = criteria.add(Restrictions.like("c.name", "%Aaron%")).list();
    for(Object o : result){
        System.out.println(o.toString());
    }

Phil 12.29.15

7:00 – 5:30 VTX

  • Finished Social Media and Trust during the Gezi Protests in Turkey.
  • More Hibernate
    • After stepping through the ‘Showroom’ example on pg 54 (Using a Join Table), of Just Hibernate I think I see my problem. In my case, the corpus has already been created and exists as an entry in the corpora table. I need to add a relationship when a word is run against a new corpus. Which come to think about it, should have the word count in it. Maybe?
    • Ok, I don’t like the way that ManyToMany is implemented. Hibernate should be smart enough to figure out how to make a default mapping table. Sigh.
    • And you have to call each object with the other object or it doesn’t load properly.
    • After being annoyed for a while, I decided to try reflection as a making fewer calls. The following still needs the get/set member element calls, but I like the direction it’s going. Will work on it some more tomorrow (need to add the call on the this class):
      public void addM2M(Object obj){
          System.out.println("person.addM2M");
          Class thisClass = this.getClass();
          String thisName = thisClass.getName();
          Class thatClass = obj.getClass();
          Method[] thatMethods = thatClass.getMethods();
          Method thatMethod = null;
          for(int i = 0; i < thatMethods.length; ++i){
              Method m = thatMethods[i];
              Type[] types = m.getGenericParameterTypes();
              if (types.length == 1) { // looking for one arg setters
                  for (int j = 0; j < types.length; ++j) {
                      Type t = types[j];
                      if ((t.getTypeName() == thisName)) {
                          thatMethod = m;
                          break;
                      }
                  }
              }
              if(thatMethod != null){
                  break;
              }
          }
          if(thatMethod != null){
              try {
                  thatMethod.setAccessible(true);
                  thatMethod.invoke(obj, this);
              } catch (IllegalAccessException e) {
                  e.printStackTrace();
              } catch (InvocationTargetException e) {
                  System.out.println("addM2M failed: "+e.getCause().getMessage());
                  e.printStackTrace();
              }
          }
      }

Phil 12.28.15

7:00 – 5:00 VTX

  • Oliver, J. Eric, and Thomas J. Wood. “Conspiracy theories and the paranoid style (s) of mass opinion.” American Journal of Political Science 58.4 (2014): 952-966., and the Google Scholar page of papers that cite this. Looking for insight as to the items that make (a type of?) person believe false information.
  • This follows up on an On the Media show called To Your Health, that had two interesting stories: An interview with John Bohannon, who published the intentionally bad study on chocolate, and an interview with Taryn Harper Wright, a blogger who chases down cases of Munchausen by Internet, and says that excessive drama is a strong indicator of this kind of hoax.
  • Reading Social Media and Trust during the Gezi Protests in Turkey.
    • Qualitative study that proposes Social Trust and System Trust
      • Social Trust
      • System Trust
  • Hibernating Moderately
    • Working on the dictionary
    • Working on the Corpus
      • Name
      • Date created
      • Source URL
      • Raw Content
      • Cleaned Content
      • Importer
      • Word count
      • guid
    • I think I’ll need a table that has the word id that points to a corpus and gives the count of that word in that corpus. The table gets updated whenever a dictionary is run against a corpus. Since words are not shared between dictionaries (Java != Java), getting the corpus to dictionary relationship is straightforward if needed.
    • Created a GuidBase that handles the name, id, and guid code that’s shared across most of the items.
    • Discovered Jsoup, which has some nice (fast?) html parsing.
    • Finished most of Corpus. Need to add a join to users. Done
    • Added BaseDictionary.
    • Added BaseDictionaryEntry.
    • Working on getting a join table working that maps words to corpora and am getting a “WARN: SQL Error: 1062, SQLState: 23000”. I was thinking that I could create a new HashMap, but I think I may have to point to the list in a different way. Here’s the example from JustHibernate:
              session.beginTransaction();
              Showroom showroom = new Showroom();
              showroom.setLocation("East Croydon, Greater London");
              showroom.setManager("Barry Larry");
              Set cars = new HashSet();
              
              cars.add(new Car("Toyota", "Racing Green"));
              cars.add(new Car("Nissan", "White"));
              cars.add(new Car("BMW", "Black"));
              cars.add(new Car("Mercedes", "Silver"));
      
              showroom.setCars(cars);
              
              session.save(showroom);
              
              session.getTransaction().commit();
    • Where the Showroom class has the Cars Set annotation as follows:
       @OneToMany
          @JoinTable
          (name="SHOWROOM_CAR_SET_ANN_JOINTABLE",
           joinColumns = @JoinColumn(name="SHOWROOM_ID")
           )
          @Cascade(CascadeType.ALL)
          private Set cars = null;
      
    • Anyway, more tomorrow…
    • Start on queries that:
      • List networks for users
      • List dictionaries for users
      • List Corpora

Phil 12.24.15

7:00 – 4:00 VTX

Phil 12.23.15

7:00 – 3:00 VTX

  • Model Merging, Cross-Modal Coupling, Course Summary
    • Bayesian story merging – Mark Finlayson
    • Cross-modal coupling and the Zebra FinchCoen
      • If items are close in one modality, maybe they should be associated in other modalities. CrossModalCoupling1
      • Good for dealing with unlabeled data that we need to make sense of
    • How You do it (Just AI?)
      • Define or describe a competence
      • Select or invent a representation
      • Understand constraints and regularities – without this, you can’t make models.
      • Select methods
      • Implement and experiment
    • Next Steps
      • 6.868 Society of Mind – Minsky
      • 6.863, 6.048 Language,  Evolution – Berwick
      • 6.945 Large Scale Symbolic Systems – Sussman
      • 6.xxx Human Intellegence Enterprise – Winston
      • Richards
      • Tenenbaum
      • Sinha
      • MIT underground guide?
  • Hibernate
    • So the way we get around joins is to explicitly differentiate the primary key columns. So where I had ‘id_index’ as a common element which I would change in the creation of the view, in hibernate we have to have the differences to begin with (or we change the attribute column?) regardless, the column names appear to have to be different in the table…
    • Here’s a good example of one-table-per-subclass that worked for me.
    • And here’s my version. First, the cfg.xml:
      <hibernate-configuration>
      
          <session-factory>
              <property name="connection.url">jdbc:mysql://localhost:3306/jh</property>
              <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
              <property name="connection.username">root</property>
              <property name="connection.password">edge</property>
              <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property>
              <property name="hibernate.show_sql">true</property>
      
              <!-- Drop and re-create the database schema on startup -->
              <property name="hbm2ddl.auto">create-drop</property>
      
              <mapping class="com.philfeldman.mappings.Employee"/>
              <mapping class="com.philfeldman.mappings.Person"/>
          </session-factory>
      
      </hibernate-configuration>
    • Next, the base Person Class:
      package com.viztronix.mappings;
      
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.Id;
      import javax.persistence.Inheritance;
      import javax.persistence.InheritanceType;
      import javax.persistence.Table;
      import java.util.UUID;
      
      
      @Entity
      @Table(name = "person")
      @Inheritance(strategy=InheritanceType.JOINED)
      public class Person {
      
          @Id
          @GeneratedValue
          @Column(name = "person_ID")
          private Long personId;
      
          @Column(name = "first_name")
          private String firstname;
      
          @Column(name = "last_name")
          private String lastname;
      
          @Column(name = "uuid")
          private String uuid;
      
          // Constructors and Getter/Setter methods,
          public Person(){
              UUID uuid = UUID.randomUUID();
              this.uuid = uuid.toString();
          }
      
          public Long getPersonId() {
              return personId;
          }
      
          // getters and setters...
      
          @Override
          public String toString(){
              return "["+personId+"/"+uuid+"]: "+firstname+" "+lastname;
          }
      }
    • The inheriting Employee class:
      package com.viztronix.mappings;
      
      import java.util.Date;
      
      import javax.persistence.*;
      
      @Entity
      @Table(name="employee")
      @PrimaryKeyJoinColumn(name="person_ID")
      public class Employee extends Person {
      
          @Column(name="joining_date")
          private Date joiningDate;
      
          @Column(name="department_name")
          private String departmentName;
      
          // getters and setters...
      
          @Override
          public String toString() {
              return super.toString()+ " "+departmentName+" hired "+joiningDate.toString();
          }
      }
    • The ‘main’ program that calls the base class and subclass:
      package com.philfeldman.mains;
      
      import com.viztronix.mappings.Employee;
      import com.viztronix.mappings.Person;
      import org.hibernate.HibernateException;
      
      import java.util.Date;
      
      
      public class EmployeeTest extends BaseTest{
      
          public void addRandomPerson(){
              try {
                  session.beginTransaction();
                  Person person = new Person();
                  person.setFirstname("firstname_" + this.rand.nextInt(100));
                  person.setLastname("lastname_" + this.rand.nextInt(100));
                  session.save(person);
                  session.getTransaction().commit();
              }catch (HibernateException e){
                  session.getTransaction().rollback();
              }
          }
      
          public void addRandomEmployee(){
              try {
                  session.beginTransaction();
                  Employee employee = new Employee();
                  employee.setFirstname("firstname_" + this.rand.nextInt(100));
                  employee.setLastname("lastname_" + this.rand.nextInt(100));
                  employee.setDepartmentName("dept_" + this.rand.nextInt(100));
                  employee.setJoiningDate(new Date());
                  session.save(employee);
                  session.getTransaction().commit();
              }catch (HibernateException e){
                  session.getTransaction().rollback();
              }
          }
      
          public static void main(String[] args){
              try {
                  boolean setupTables = false;
                  EmployeeTest et = new EmployeeTest();
                  et.setup("hibernateSetupTables.cfg.xml");
                  //et.setup("hibernate.cfg.xml");
      
      
                  for(int i = 0; i < 10; ++i) {
                      et.addRandomEmployee();
                      et.addRandomPerson();
                  }
      
                  et.printAllRows();
      
                  et.closeSession();
      
              }catch (Exception e){
                  e.printStackTrace();
              }
      
          }
      }
    • And some output. First, from the Java code with the Hibernate SQL statements included. It’s nice to see that the same strategy that I was using for my direction db interaction is being used by Hibernate::
      Hibernate: alter table employee drop foreign key FK_apfulk355h3oc786vhg2jg09w
      Hibernate: drop table if exists employee
      Hibernate: drop table if exists person
      Hibernate: create table employee (department_name varchar(255), joining_date datetime, person_ID bigint not null, primary key (person_ID))
      Hibernate: create table person (person_ID bigint not null auto_increment, first_name varchar(255), last_name varchar(255), uuid varchar(255), primary key (person_ID))
      Hibernate: alter table employee add index FK_apfulk355h3oc786vhg2jg09w (person_ID), add constraint FK_apfulk355h3oc786vhg2jg09w foreign key (person_ID) references person (person_ID)
      Dec 23, 2015 10:40:26 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
      INFO: HHH000230: Schema export complete
      Hibernate: insert into person (first_name, last_name, uuid) values (?, ?, ?)
      ... lots more inserts ...
      Hibernate: insert into person (first_name, last_name, uuid) values (?, ?, ?)
      There are [2] members in the set
      key = [com.philfeldman.mappings.Employee]
      executing: from com.philfeldman.mappings.Employee
      Hibernate: select employee0_.person_ID as person1_1_, employee0_1_.first_name as first2_1_, employee0_1_.last_name as last3_1_, employee0_1_.uuid as uuid4_1_, employee0_.department_name as departme1_0_, employee0_.joining_date as joining2_0_ from employee employee0_ inner join person employee0_1_ on employee0_.person_ID=employee0_1_.person_ID
        [1/17bc0f66-da60-4935-a4d2-5d11e93e2419]: firstname_15 lastname_96 dept_7 hired Wed Dec 23 10:40:26 EST 2015
        [3/6c15103a-49b2-4b63-8ef9-0c8ab3f84eab]: firstname_30 lastname_88 dept_75 hired Wed Dec 23 10:40:26 EST 2015
      
      key = [com.philfeldman.mappings.Person]
      executing: from com.philfeldman.mappings.Person
      Hibernate: select person0_.person_ID as person1_1_, person0_.first_name as first2_1_, person0_.last_name as last3_1_, person0_.uuid as uuid4_1_, person0_1_.department_name as departme1_0_, person0_1_.joining_date as joining2_0_, case when person0_1_.person_ID is not null then 1 when person0_.person_ID is not null then 0 end as clazz_ from person person0_ left outer join employee person0_1_ on person0_.person_ID=person0_1_.person_ID
        [1/17bc0f66-da60-4935-a4d2-5d11e93e2419]: firstname_15 lastname_96 dept_7 hired Wed Dec 23 10:40:26 EST 2015
        [2/3edf8d12-dbd9-42d3-893f-c740714a2461]: firstname_6 lastname_99
        [3/6c15103a-49b2-4b63-8ef9-0c8ab3f84eab]: firstname_30 lastname_88 dept_75 hired Wed Dec 23 10:40:26 EST 2015
        [4/f5bba5c6-77a7-438b-bd73-5e12288d3b2c]: firstname_91 lastname_43
        [5/75db23a9-3be3-44f5-80bf-547ab8c7f12f]: firstname_7 lastname_84 dept_36 hired Wed Dec 23 10:40:26 EST 2015
        [6/45520bb5-8d3d-4577-b487-3e45d506bf50]: firstname_22 lastname_35
        [7/c0bb18e6-6114-4e8a-a7ce-e580ddfb9108]: firstname_1 lastname_22
    • Last, here’s what was produced in the db: dbResults
    • Starting on the network data model
    • Added NetworkType(class) network_types(table)
    • Added BaseNode(class) network_nodes(table)
      • The mapping for the types in the BaseNode class looks like this (working from this tutorial):
        @Entity
        @Table(name="network_nodes")
        public class BaseNode {
            @Id
            @GeneratedValue(strategy= GenerationType.AUTO)
            @Column(name="node_id")
            private int id;
            private String name;
            private String guid;
        
            @ManyToOne
            @JoinColumn(name = "type_id")
            private NetworkType type;
        
            public BaseNode(){
                UUID uuid = UUID.randomUUID();
                guid = uuid.toString();
            }
        
            public BaseNode(String name, NetworkType type) {
                this();
                this.name = name;
                this.type = type;
            }
        
            //...
        
            @Override
            public String toString() {
                return "["+id+"]: name = "+name+", type = "+type.getName()+", guid = "+guid;
            }
        }
      • No changes needed for the NetworkType class, so it’s a one-way relationship, which is what I wanted:
        @Entity
        @Table(name="network_types")
        public class NetworkType {
            @Id
            @GeneratedValue(strategy= GenerationType.AUTO)
            @Column(name="type_id")
            private int id;
            private String name = null;
        
            public NetworkType(){}
        
            public NetworkType(String name) {
                this.name = name;
            }
        
            // ...
        
            @Override
            public String toString() {
                return "["+id+"]: "+name;
            }
        }

 

Phil 12.22.15

VTX 7:00 – 6:00

  • Probabilistic Inference II
    • Assertion – Any variable in a graph is said by me to be independent of any other non-descendant, given its parents. All the causality flows through the parents.
    • A belief net or Bays net is *always* acyclic and directed.
    • Traverse the graph from the bottom up, so that no node depends on a node to its left in a list.
    • Generating the list:BayesNetFromData
    • When using the list, work from the top down in the list
    • Naive Bayesian inference
      • P(a|b)P(b) = P(a,b) = P(b|a)P(a)
      • P(a|b) = (P(b|a)P(a))/P(b) BayesChain
      • Can use Bayes to decide between models – Naive Bayesian Classification
      • Use the sum of the logs of the probabilities rather than the products because otherwise we run out of bits of precision
    • The right thing to do when you don’t know anything (just have symptoms)
  • Hibernate
    • Adding config.setProperty(“hbm2ddl.auto”, “update”); to the setup, so that tables can be rebuilt on demand. Nope, that didn’t work. Maybe I can’t split configuration between the config file and programmatic variables?
    • The only way that I was able to get this to work as an argument was to have a setupTables flag indicate which config to read. That works well though.
    • Got simple collections running, which means that I should be able to get networks built. Basically modified the example from Just Hibernate that starts on page 53.
    • Next, we work on getting inheritance to work. I think this will help.
  • Initial Java class network thoughts, just to try storing and retrieving items
    • BaseItem
      • guid
    •  BaseNode extends BaseItem
      • node_id
      • name
    • BaseEdge extends BaseItem
      • edge_id
      • source
      • target
      • weight
    • BaseNetwork extends BaseItem
      • network_id
      • name
      • owner
      • edgeList
      • nodeList (we need this because we may have orphans in the network)
    • BaseOwner extends BaseItem
      • owner_id
      • name
      • password?

Phil 12.21.15

8:00 – 6:00 VTX

  • No MIT video today. Went out and saw Star Wars. Fun! Need to see it again when the crowds thin out in an IMAX theater.
  • Copied some stunt data into the hibernate_test db.
  • Ran the code that set up the session and connected to the (empty) db. No exceptions, so I think it’s working this time…
  • IDE is tracking annotations. The names in the annotation class need to be the same as the table and element names or there is an error IntelliJ Hibernate Setup
  • Ok, reading and writing into the db. Now to clean it up and separate elements;
  • Here’s the current cleaned up version. Still need to create the table more properly.
    package com.philfeldman.mains;
    
    import com.philfeldman.mappings.Employee;
    import org.hibernate.HibernateException;
    import org.hibernate.Query;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    import org.hibernate.metadata.ClassMetadata;
    import org.hibernate.service.ServiceRegistry;
    import org.hibernate.service.ServiceRegistryBuilder;
    
    import java.util.Map;
    import java.util.Random;
    
    /**
     * Created by philip.feldman on 12/21/2015.
     *
     * A simple test program that will read and write from a table in a database. In MySql, the
     * table is in the form:
             CREATE TABLE employee (
             id int(11) NOT NULL AUTO_INCREMENT,
             name varchar(50) DEFAULT NULL,
             PRIMARY KEY (id)
     ) ;
     */
    public class EmployeeTest {
        private SessionFactory sessionFactory;
        private ServiceRegistry serviceRegistry;
        private Session session;
        private Random rand;
    
        public EmployeeTest()throws ExceptionInInitializerError{
            this.rand = new Random();
            try {
                Configuration config = new Configuration();
                config.configure("hibernate.cfg.xml");
    
                this.serviceRegistry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
                this.sessionFactory = config.buildSessionFactory(serviceRegistry);
                this.session = this.sessionFactory.openSession();
            } catch (Throwable ex) {
                throw new ExceptionInInitializerError(ex);
            }
        }
    
        public void closeSession(){
            this.session.close();
        }
    
        public void printAllEntityNames(){
            System.out.println("querying all the managed entities...");
            final Map metadataMap = this.session.getSessionFactory().getAllClassMetadata();
            System.out.println("There are [" + metadataMap.keySet().size() + "] members in the set");
            for (Object key : metadataMap.keySet()) {
                System.out.println("key = ["+key.toString()+"]");
            }
        }
    
        public void printAllEmployees(){
            String key = Employee.class.getCanonicalName();
            final Map metadataMap = this.session.getSessionFactory().getAllClassMetadata();
            final ClassMetadata classMetadata = (ClassMetadata) metadataMap.get(key);
            final String entityName = classMetadata.getEntityName();
            final Query query = session.createQuery("from " + entityName);
            System.out.println("executing: " + query.getQueryString());
            for (Object o : query.list()) {
                Employee e = (Employee) o;
                System.out.println("  " + e.toString());
            }
        }
    
        public void addRandomEmployee(){
            try {
                session.beginTransaction();
                Employee employee = new Employee();
                employee.setName("rand(" + this.rand.nextInt(100) + ")");
                session.save(employee);
                session.getTransaction().commit();
            }catch (HibernateException e){
                session.getTransaction().rollback();
            }
        }
    
        public static void main(String[] args){
            try {
                //System.out.println("Employee.class.getCanonicalName: "+Employee.class.getCanonicalName());
                /***/
                EmployeeTest et = new EmployeeTest();
                et.printAllEntityNames();
                et.printAllEmployees();
                et.addRandomEmployee();
                et.closeSession();
                 /***/
            }catch (Exception e){
                e.printStackTrace();
            }
    
        }
    }

Phil 12.18.15

7:00 – 5:00 VTX

  • Was listening to the Planet Money podcast on A/B testing last night and they mentioned how they were using the ‘skip’ button to determine how to shape their podcast. So this is a feedback device that people use that has at most a very indirect effect on the relevance of the provided item, but it does provide the system with a value judgement from the consumer. The benefit to the user is the ability to skip content, and that appears to be enough. The benefit to the producer is the aggregate responses of the users (40k in this place, so lots of statistical power). Somewhat related:
  • And I thought of a title that describes the focus of this effort: Using Value-Decorated Semantic Nets to Infer Credibility
  • Probabilistic Inference I
    • Joint probability tables are the ideal, but impractical
    • Basic probability (intuition at 21:00)
      • probability 0 … 1
      • True = 1
      • False = 0
      • P(a) + P(b) – P(a, b) = P(a or b)
    • Conditional probability
      • Definitions
      • P(a|b) = P(a,b)/P(b)
        • Probability of a given be is the probability of a AND b over the probability of b (24:00)
      • P(a, b, c) = ??
        • y = b, c
        • P(a, b, c) = P(a, y) = P(a|y)P(y)
        • = P(a|b,c)P(b,c)
        • = P(a|b,c)P(b|c)P(c) note that as we go from left to right, there is less elements to depend on.
      • Generalized
        • (Px1, …, xn) = chain rule (starts at 28:31)chainedConditionalProbability
    • Independence
      • Definitions
      • P(a|b) = P(a) if a independent of b – video at 32:30
        • The probability of a in the universe is the same as the probability of a and b in b. The two rations are the same. Why is this definition needed?
      • Conditional independence
      • P(a|b,z) = P(z)
      • P(a,b|z) = P(a|z)P((b|z)
    • Belief Nets
      • Causal relationships. The dog barks because of the Racoon
      • Every node is dependent only on its parent(s) and possibly its children (descendents)
      • BeliefNets If this were a joint probability table there would be 2^5 (32) as opposed to the number here, which is 10.
      • P(p,d,b,t,r) = P(p|d,b,t,r)…P(r), which we can reduce the combinations. (See 46:30 or so)
  • Hibernating slowly
    • The ./basic/ as described in the hibernate 5 quickstart doesn’t seem to exist in either the 4.3 or the 5.5 bubndle. It does look like IntelliJ has a JPA and Hibernate section. Trying that.
    • Importing the current pg db, which did get found since I had already set up that relationship with database in yesterday’s post.
    • In the Import Database Schema wizard, I had to create a package for the files to be created in. In this case, since I’ve already had to create a new module under HibernateTest1 (HibernateTest1Module1), I called the package com.philfeldman.ht1m1, which is similar to the Entity prefix of ht1m1_ that I decided to add.
    • Got a ‘Basic’ attribute type should not be ‘Object’ error. When opening up the ‘weather’ element in the dialog (see below) ImportDatabaseSchema I could see that the tempHi and tempLo items are being mapped as Objects. Typing java.Lang.Integer corrects the problem. The thing to remember here is that the error doesn’t ripple up. When ‘weather’ is closed, there are no red items.
    • That worked, but there were some significant compiler errors. Fixed by letting the IDE download java EE6 libraries. It still looks like we’re using java 1.8, but now have a bunch of External libraries that appear to be redundant? LotsaLibs.jpg
    • Anyway, using the persistence view, created a ht1m1_UserEntity class. Now I need to make it persist and add values to it. for that matter, I need to query the weather table…
    • Haven’t gotten to accessing data yet, but you can set up relationships graphically in IntelliJ, which is pretty cool.
    • And now I’m kind of stuck. The console interface with the hibernate/db keeps on asking for a persistence provider which seems to be in the classpath but doesn’t seem to be helping.
  • Starting over
    • Spent a few bucks and got Just Hibernate. Let’s see if that works better.
    • Need to install Git – Done. Yay!
    • Created JustHibernate1 as a JavaEE project with Hibernate and the default download libraries (4.2.2). Also created a corresponding hibernate_test database in MySql. Nothing in it yet.
    • Opened up the database view and connected to my MySql database. This gives me the opportunity to (a) test the connection and (b) get the URL for the hibernate.cfg.xml file (jdbc:mysql://localhost:3306/hibernate_test)
    • Still needed to get the jdbc driver, so I used the Project Structure pane (F4) to import the mysql:mysql-connector-java:5.1.38 from maven. IntelliJ downloaded and stuck it in the lib directory. Here’s the module structureProjectStructureModules And here’s the library structure for the mysql driver. Note that it’s actually pointing at my m2 repo…ProjectStructureLibraries
    • So now I’m about where I was at lunch, but everything is cleaner. Afraid to actually try connecting at 5:00 on a Friday, so we’ll try this on Monday <fingers  crossed>

Phil 12.17.15

7:00 – 4:00 VTX

  • Architectures: GPS, SOAR, Subsumption, Society of Mind
    • GPS – General Problem Solver Newell & Simon
    • SOAR – State Operator and Result. (RCS for problem solving + GOMS?)
    • Emotion Machine – Minsky  Multiple Levels
      • Instinctive reaction
      • Learned reaction
      • Deliberative thinking
      • Reflective thinking – Memory
      • Self-reflecting (planning?)
      • Self-conscious thinking (social interaction)
    • Based on the Common Sense Hypothesis
      • Open Mind Concept
      • Henry Lieberman
      • Media Lab
    • Alternative Ideas
      • Rodney Brooks – Subsumption architecture
        • Creature Hypothesis – once you can get a machine to be as smart as an insect, the rest will be easy. (Very RCS!)
        •  Layers of abstraction, each with its own Vision, Reasoning and Action layers.
          • Avoiding Object Layer
          • Wandering Layer
          • Explore Layer
          • Seek Layer
          • Etc.
        • Rules
          • No representation (no world model)
          • Use the world instead of a model. Everything is reactive.
          • Finite State Machines
        • Roomba is an example.
      • Genisys System
        • Strong Story Hypothesis
          • White room experiment (described in video here)
            • Children begin to orient correctly after they start using the words ‘left’ and ‘right’ when they describe the world.
            • Adults doing ‘english to english translation’ they fail the test.
            • Also in a radiolab show: Words
        • Based on language
          • Perception (Real and imagined [running with a bucket of water])
          • Description of events
            • Stories
            • Culture
              • Macro
              • Micro
  • Did a little poking around with hibernate, since Jeremy says that Hibernate plus annotations are the standard here. It does look like 4.3.8 final is the version that’s being used (4.3.11 is close enough?) with jpa annotations. Jeremy’s also been using Spring Data JPA, which I guess needs to be on the list as well.
  • Debating on whether I should set up a Hibernate sandbox with Gradle, but I think that’s a bridge too far.
  • Oh yeah, when you check out a project in subversion, check it out at its trunk node. Otherwise Gradle doesn’t know what to do. It also seems to be downloading everything again as I import the project. I wonder if this will take 41 minutes again?
    • You can then run by clicking on src/main/java/com.philfeldman.nlpservice/web/Application.
    • Verified that everything works by sending json object to localhost:8870/nlpservice/analyze in Postman: Postman
  • Ok, back to setting up a sandbox for schema development
    • Downloading and installing Postgresql, version 9.4.5
    • The install kind of broke and didn’t create the data files. I wound up doing the Short Version from the command line, which is working just fine.
    • To start the db server – C:\Program Files\PostgreSQL\9.4\bin>postgres.exe -D \Development\PostGresSQL\Data
    • To run the client – C:\Program Files\PostgreSQL\9.4\bin>psql test
    • Set up shortcuts that launch the server and the test db following these instructions.
  • Starting the Hibernate sandbox project.
    • Had to enable the the hibernate IntelliJ plugin
    • connected IntelliJ to the postgres db using the Database View. . I thought the superuser name was ‘postgres’, but \du says it’s ‘philip.feldman’. It must have pulled that from the OS. Password was what I thought I set it to though.
    • In a fit of unrealistic expectation, decided to start with the latest hibernate Version 5.5.1.Final. The jar structure is really different from 4.3.11.Final, but we’ll see how that goes. Using the Hibernate 5.0 quickstart

Phil 12.15.15

7:00 – 3:30 VTX

  • Representations: Classes, Trajectories, Transitions
    • Inner language, the language with which we think
    • Semantic nets
      • parasitic semantics – where we project knowing to the machine. We contain the meaning, not the machine.
    • Combinators = edge
    • Reification – linking links?
    • Sequence
    • Minsky – Frames or templates add a localization layer.
    • Classification
    • Transition
      • Vocabulary of change, not state
      • (!)Increase, (!)decrease, (!)change, (!)appear, (!)disappear
    • Trajectory
      • Objects moving along trajectories
      • Trajectory frame (prepositions help refine – by, with, from, for, etc)
        • Starts at a source
        • Arranged by agent, possibly with collaborator
        • assisted by instrument
        • can have a conveyance
        • Arrives at destination
        • Beneficiary
      • Wall Street Journal Corpus
        • 25% transitions or trajectories.
      • Pat comforted Chris
        • Role Frame
          • Agent: Pat
          • Action: ??
          • Object: Chris
          • Result: Transition Frame
            • Object: Chris
            • Mood: Improved (increased)
    • Story Libraries
      • Event Frames – adds time and place
        • Disaster -adds fatalities, cost
          • Earthquake – adds name, category
          • Hurricane – – adds magnitude, fault
        • Party
          • Birthday
          • Wedding – adds bride and groom
  • Scrum
  • Working on downloading and running the NLP code
    • Downloaded Java EE 7u2
    • Downloaded Gradle 2.9
    • Installed and compiled. Took 41 minutes!
    • Working on running it now, which looks like I need Tomcat. To run Tomcat on port 80, I had to finally chase down what was blocking port 80. I finally found it by running NET stop HTTP, (from here) which gave me a list that I could check against the services. I monitored this with Xampp’s nifty Netstat tool. The offending process was BranchCache, which I disabled. Now we’ll see what that breaks…
    • Tomcat up and running
    • NLPService blew up. More secret knowledge:
      Local RabbitMQ Setup
      
      Install Erlang 
      
      # http://www.erlang.org/download/otp_win64_17.5.exe
      
      # Set *ERLANG_HOME* in system variables. (e.g. C:\Program Files\erl6.4)
      
      Install RabbitMQ 
      
      # http://www.rabbitmq.com/releases/rabbitmq-server/v3.5.3/rabbitmq-server-3.5.3.exe
      
      #* If you get Windows Security Alert(s) for *epmd.exe* and/or *erl.exe*, check "Domain networks..." and uncheck "Private networks" and "Public networks"
      
      # Open the command prompt as *administrator*
      
      # Go to C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.5.3\sbin.
      
      # Run the following commands:             
      
      rabbitmq-plugins.bat enable rabbitmq_web_stomp rabbitmq_stomp rabbitmq_management
      
      rabbitmq-service.bat stop                                                        
      rabbitmq-service.bat install                                                     
      rabbitmq-service.bat start                                                      
      
      RabbitMQ Admin Console
      http://localhost:15672/mgmt
      
      guest/guest
    • Installed Erlang and RabbitMQ. We’ll try running tomorrow.

Phil 12.9.15

7:00 – VTX

  • Learning: Near Misses, Felicity Conditions
    • One shot learning
    • Describing the difference between the desired goal/object and near misses. Model is decorated with information is important.
      • Relations are in imperative form (must not touch, must support, etc.)
    • Pick a seed
    • Apply your heuristics until all the positives are included
    • Then use negatives to throw away unneeded heuristics
    • Use a beam search
    • Near misses lead to specialization, compare to general models lead to generalization (look for close items using low disorder measures for near misses and high for examples?)
    • Model Heuristics (
      An application of variable-valued logic to inductive learning of plant disease diagnostic rules)

      • Require Link (Specialization step)
      • Forbid Link (Specialization step)
      • Extend Set (Generalization step)
      • Drop Link (Generalization step)
      • Climb Tree (Generalization step)
    • Packaging ideas
      • Symbol associated with the work – a visual handle
      • Slogan – a verbal handle (‘Near Miss’ learning)
      • Surprise – Machine can learn something definate from a single example
      • Salient – something that sticks out (One shot learning via near misses)
      • Story
  • More dev machine setup
    • Added typescript-install to the makefile tasks, since I keep on forgetting about it.
    • Compiled and ran WebGlNeworkCSS. Now I need to set up the database.
    • Got that in, but had a problem with the new db having problems with the text type of PASSWORD(). I had to add COLLATE to the where clause as follows:
      "UPDATE tn_users set password = PASSWORD(:newPassword) where password = PASSWORD(:oldPassword) COLLATE utf8_unicode_ci and login = :login"
    • last error is that the temp network isn’t being set in the dropdown for available networks. Fixed. It turned out to be related to the new typescript compiler catching some interface errors that the old version didn’t.
  • Ok, I think it’s time to start writing up what the current system is and how it works.