Thursday, February 19, 2009

R Interface to Weka for Statistical Learning

Weka is a Java based collection of machine learning algorithms for data mining tasks that contain tools for data pre-processing, classification, regression, clustering, association rules, and visualization at http://www.cs.waikato.ac.nz/~ml/index.html. An example of classification can be seen with the following applet at http://www.cs.technion.ac.il/~rani/LocBoost/.

R is an open source application for statistical computing and graphics that I use for modeling commodity prices and have discussed in publications located at TCW. Together, they form the R/Weka interface at http://cran.r-project.org/web/packages/RWeka/index.html . The working paper on this project is at http://epub.wu-wien.ac.at/dyn/virlib/wp/eng/mediate/epub-wu-01_ba6.pdf?ID=epub-wu-01_ba6 . I am doing some work in Weka because of its preference in computer science curriculums. A comparision of Weka and R can be found at http://74.125.47.132/search?q=cache:BNwL-HtkC4IJ:wiki.pentaho.com/download/attachments/3801462/ComparingWekaAndR.pdf%3Fversion%3D1+r+and+weka&hl=en&ct=clnk&cd=8&gl=us .

A good introduction to the interface is at http://statmath.wu-wien.ac.at/~zeileis/papers/DSC-2007a.pdf . For example, they show through R a list of the Weka interfaces:

R> list_Weka_interfaces()
$Associators
[1] "Apriori" "Tertius"
$Classifiers
[1] "AdaBoostM1" "Bagging" "DecisionStump" "IBk"
[5] "J48" "JRip" "LBR" "LMT"
[9] "LinearRegression" "Logistic" "LogitBoost" "M5P"
[13] "M5Rules" "MultiBoostAB" "OneR" "PART"
[17] "SMO" "Stacking"
$Clusterers
[1] "Cobweb" "DBScan" "FarthestFirst" "SimpleKMeans"
[5] "XMeans"
$Filters
[1] "Discretize" "Normalize"

I think it is worth the effort to combine these two technolgies in a middeware web service component to enhance existing AI applications. See our pubs for how to interface C#.NET with R.

Wednesday, February 18, 2009

Jadex for BDI Agent Programming

Currently, I am working on developing EBDI agents in both C#.NET and Java for my commodity price modeling research and decided to use as a protoype Jadex at http://jadex.informatik.uni-hamburg.de/bin/view/About/Overview . Jadex is very easy to use with permits development of autonomous intelligent agents in both XML and Java that can also be used with Jade. The central idea is to build a multi-agent community or society that use artifical intelligence concepts to do statistical modeling. You can download the 60 day trial version of Jadex-2-beta2 from the above site an run the jadex platform with the Jadex Control Center v2 for your project applications. Figure 1 shows the Jadex Control Center with the HelloWorld Agent example application.


Figure 1. Jadex Control Center

There are plenty examples here to learn as well as very good documentation on the BDI agent architecture with the version of 0.96x having a User Guide, Tutorial, and Toolguide at http://jadex.informatik.uni-hamburg.de/bin/view/Resources/Online+Documentation. The API for the examples is at http://jadex.informatik.uni-hamburg.de/docs/jadex-0.94x/examples/index.html . There garbage collector example provides a good example of beliefs, goals and plans. Figure 2 shows the environment agent.

Figure 2. Garbage Collector Environment


This agent shows the environment and produces items on it. There are two plans for this agent: (1) create the plan, (2) show the gui. The garbage burner agent has three beliefs: (1) environment, (2) the items at the current position, and (3) the actual position on the grid. The goal is to both (1) burn the items, and (2) pick up the items. Therefore, there has to be two plans: (1) burn plan and (2) pickup plan. The garbage collector agent is a little more complex by having similar beliefs as the garbage burner, but has an additional belief needed to determine if the item is dirty. The goals are: (1) run the grid and look for items, (2) go to a specified position, (3) pick up the item, and (4) take the item to a burner. Thus , we have 4 plans for these goals. The final agent, the manager agent determines the state: (1) one burner/one collector, (2) two burners/six collectors, and (3) two burners/two collectors.

Since plans are in Java and agents are in XML, the CreatePlan method shows the body of the plan in Java.


package jadex.bdi.examples.garbagecollector;
import jadex.bdi.runtime.Plan;
/**
* Create pieces of garbage in the environment.
*/
public class CreatePlan extends Plan
{
/**
* The plan body.
*/
public void body()
{
Environment env = (Environment)getBeliefbase().getBelief("env").getFact();
int garb_cnt = 0;
while(true)
{
// Add a piece of waste randomly.
waitFor(1000);
// Position pos = env.getFreePosition();
Position pos = env.getRandomPosition();
if(pos!=null)
{
env.addWorldObject(Environment.GARBAGE, "garbage#"+garb_cnt++, pos);
}
}
}
}

Thus, by working through the example above and other examples in the JCC with the on-site documentation, deploying BDI agents can be done quickly for agent based applications.

Research Gate


Research Gate at https://www.researchgate.net/ is a professional network for scientists. The above figure shows the options of profile, mesages, contacts, groups and research tools available to the scientist. The research tools use semantic relations for related publications, related researchers and groups. Publication information is searched through keywords and abstracts are parsed. The research vita page for my profile includes:
  1. Academic research projects
  2. Corporate research projects

  3. Education

  4. Additional training/courses

  5. Scholarship and grants

  6. Awards and Prizes

  7. Additional information such as teaching activity, board member, journal referee, scientific and society membership
The publication page consists of:
  • Journal articles

  • Conference proceedings/articles

  • Book articles or chapters

  • Theses

  • Patents
The research skills page includes:
  • Technical

  • Statistical

  • IT

  • Other
Another interesting feature is the ability to list in your personal library your favorite papers which you can import and export as an XML file. There are privacy, notification settings that are also important for the researcher. This week I will be doing research on this site to determine how effective it is with respect to building research communties.

Monday, February 16, 2009

C4 Brain Architecture for EBDI Agents

The Media Lab at MIT developed an layered brain architecture for Synthetic Creatures at http://web.media.mit.edu/~bruce/Site01.data/ijcai01.pdf that has the following discrete systems:

  • Sensory System
  • Perception System

  • Navigation System

  • Motor System

  • Working Memory

  • Blackboard

Another paper on C4 is at http://characters.media.mit.edu/Papers/gdc01.pdf . I like their use of the Percept Tree that is encoded in a Percept memory data structure which is matched to records in Working Memory. Of course, we can add emotion to the agents by using the work of Camuri and Coglio at http://www.kestrel.edu/home/people/coglio/mm98.pdf and the work by Jiang et al. on the EBDI(emotion, belief, desire and intention) framework at http://jmvidal.cse.sc.edu/papers/jiang07a.pdf. Specifically, the BDI agent has


  • Beliefs—knowledge about the environment

  • Desires—goals of the agent

  • Intentions—decisions about present and future behavior

MSDN has a good article on BDI agents for service orchestration at http://msdn.microsoft.com/en-us/library/bb898865.aspx and the authors state that a goal directed model can be used for application design:


"This model initially has high-level plans. These high-level plans are to achieve a sequence of goals. Each goal is achieved by a set of plans. If a goal can be achieved in different ways, it is further decomposed and separate plans are developed to achieve the goal. More plans can be added to the application at any time. The set of plans that are developed to achieve a goal is a service that is defined by the goal it fulfils."


As an example of their graph:


These BDI agents then dynamically build the application at runtime by selecting the appropriate plan out of a library of plans for the goal. An example of BDI using C#.NET is at http://www.blasteinn.com/robotdata/LegoRobot_Report.pdf . Another good article on BDI is Creating Interactive Characters with BDI agents at http://cfpm.org/~emma/pubs/NorlingSonenberg04.pdf that uses JACK- an automous systems development platform. I have downloaded the 60 day trail and read the manual at http://www.aosgrp.com/documentation/jack/Agent_Manual_WEB/index.html . A good powerpoint presentation is at http://www.mip.sdu.dk/~bbk/AOSE/JACK/19991029Coburn-AgentsMelb.pdf and http://goanna.cs.rmit.edu.au/~ssardina/courses/Roma07PhDcourse/lect09/busetta99jack.pdf as I attempt to build BDI agents with JACK in Java. More later.

RDF/XML and C#.NET

RDF (Resource Description Framework) is the standard for the Semantic Web. RDF can be mixed with C#.NET in an open source project called the semantic web at http://razor.occams.info/code/semweb/ . As stated by the authors, SemWeb is a

"... library can be used for reading and writing RDF (XML, N3), keeping RDF in persistent storage (memory, MySQL, etc.), querying persistent storage via simple graph matching and SPARQL, and making SPARQL queries to remote endpoints. Limited RDFS and general-purpose inferencing is also possible. SemWeb's API is straight-forward and flexible".

A basic "Hello World" application using SemWeb is

using System;
using SemWeb;

public class Example
{
const string RDF = http://www.w3.org/1999/02/22-rdf-syntax-ns#;

public static void Main() {
MemoryStore store = new MemoryStore();
Entity computer = new Entity("http://example.org/computer");
Entity says = "http://example.org/says";
Entity wants = "http://example.org/wants";
Entity desire = new BNode();
Entity description = new Entity("http://example.org/description");
store.Add(new Statement(computer, says, (Literal)"Hello world!"));
store.Add(new Statement(computer, wants, desire));
store.Add(new Statement(desire, description, (Literal)"to be human"));
store.Add(new Statement(desire, RDF+"type", (Entity)"http://example.org/Desire"));
using (RdfWriter writer = new RdfXmlWriter(Console.Out)) { writer.Namespaces.AddNamespace("http://example.org/", "ex");
writer.Write(store);
}
}
}

A discussion on this example and others can be found at http://razor.occams.info/code/semweb/semweb-current/doc/helloworld.html. Another example of a Semantic Web framework for .NET is LinqToRDF at http://code.google.com/p/linqtordf/. Andrew Matthews has an excellent LinqToRDF tutorial which shows how to create an ontology, link the ontology to .NET and query the ontology using SPARSQL. Creation of an ontology begins with XML namespaces for OWL, RDF and XML:


@prefix rdf: .
@prefix daml: .
@prefix log: .
@prefix rdfs: .
@prefix owl: .
@prefix xsdt: .
@prefix : .


followed by some classes for the ontology:


:Album a owl:Class.
:Track a owl:Class.
:title rdfs:domain :Track;
rdfs:range xsdt:string.
:artistName
rdfs:domain :Track;
rdfs:range xsdt:string.
:albumName
rdfs:domain :Track;
rdfs:range xsdt:string.
:year
rdfs:domain :Album;
rdfs:range xsdt:integer.
:genreName
rdfs:domain :Track;
rdfs:range xsdt:string.
:comment
rdfs:domain :Track;
rdfs:range xsdt:string.
:isTrackOn
rdfs:domain :Track;
rdfs:range :Album.
:fileLocation
rdfs:domain :Track;
rdfs:range xsdt:string.

Having used Linq in .NET 3.5 in VS.NET 2008, the following class Track links to the above ontology

using LinqToRdf;
namespace RdfMusic
{
[OwlResource(OntologyName="Music", RelativeUriReference="Track")]
public class Track : OwlInstanceSupertype
{
[OwlResource(OntologyName = "Music",
RelativeUriReference = "title")]
public string Title { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="artistName")]
public string ArtistName { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="albumName")]
public string AlbumName { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="year")]
public string Year { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="genreName")]
public string GenreName { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="comment")]
public string Comment { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="fileLocation")]
public string FileLocation { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference="rating")]
public int Rating { get; set; }
public Track(TagHandler th, string fileLocation)
{
FileLocation = fileLocation;
Title = th.Track;
ArtistName = th.Artist;
AlbumName = th.Album;
Year = th.Year;
9
GenreName = th.Genere;
Comment = th.Comment;
}
private EntityRef _Album { get; set; }
[OwlResource(OntologyName = "Music",
RelativeUriReference = "isTrackOn")]
public Album Album
{
get
{
if (_Album.HasLoadedOrAssignedValue)
return _Album.Entity;
if (DataContext != null)
{
var ctx = (MusicDataContext)DataContext;
string trackUri = this.InstanceUri;
string trackPredicateUri =
this.PredicateUriForProperty(MethodBase.GetCurrentMethod());
_Album = new EntityRef(
from r in ((MusicDataContext)DataContext).Albums
where r.StmtObjectWithSubjectAndPredicate(trackUri,
trackPredicateUri)
select r);
return _Album.Entity;
}
return null;
}
}
public Track()
{
}
}

One of the nice features of the open source C# semWeb is the RDFS inferencing engine with

using System;
using System.IO;
using SemWeb;
using SemWeb.Inference;

public class EulerTest {
public static void Main() {
// Create the instance data
MemoryStore dataModel = new MemoryStore();
BNode me = new BNode("me");
BNode you = new BNode("you");
Entity rdfType = http://www.w3.org/1999/02/22-rdf-syntax-ns#type;
Entity rdfsLabel= http://www.w3.org/2000/01/rdf-schema#label;
Entity foafPerson = http://xmlns.com/foaf/0.1/Person;
Entity foafAgent = http://xmlns.com/foaf/0.1/Agent;
Entity foafName = http://xmlns.com/foaf/0.1/name;
dataModel.Add(new Statement(me, rdfType, foafPerson));
dataModel.Add(new Statement(you, rdfType, foafPerson));
dataModel.Add(new Statement(me, foafName, (Literal)"John Doe"));
dataModel.Add(new Statement(you, foafName, (Literal)"Sam Smith"));
// Create the RDFS engine and apply it to the data model.
RDFS engine = new RDFS();
engine.LoadSchema(RdfReader.LoadFromUri(new Uri(http://xmlns.com/foaf/0.1/index.rdf)));
dataModel.AddReasoner(engine);
// Query the data model
// Ask for who are typed as Agents.
Note that the people are
// typed as foaf:Person, and the schema asserts that foaf:Person
// is a subclass of foaf:Agent.
Console.WriteLine("Who are Agents?");
foreach (Entity r in dataModel.SelectSubjects(rdfType, foafAgent))
Console.WriteLine("\t" + r);
// Ask for the rdfs:labels of everyone. Note that the data model
// has foaf:names for the people, and the schema asserts that
// foaf:name is a subproperty of rdfs:label.
Console.WriteLine("People's labels:");
foreach (Statement s in dataModel.Select(new Statement(null, rdfsLabel, null))) Console.WriteLine("\t" + s);
}
}

In addition, there is backward-forward-backward chaining reasoning with Euler path detection-"don't step in your own steps". For more information on Euler, look at http://www.agfa.com/w3c/euler/. Thus, in the construction of intelligent autonomous Agent based models in C#, there are opportunities to implement rule based engines with ontologies.

Anatomic Pathology Laboratory Information Systems

In the course of consulting, I review Dice.com and in the process I learn much about technologies from the job descriptions. For example, a HL7 integration engineer needs to have experience with HL7 in order to design and implement the integration of Digital Pathology products with Anatomic Pathology Laboratory Information Systems (APLIS). Interesting... HL7 at http://www.hl7.org/ is the ANSI protocols for clinical and adminstrative health data, i.e. pharamacy, medical devices, imaging or insurance transactions. Basically, a XML protocol for interoperability between heterogeneous databases.

To find out more about APLIS, I read the Tuthill (2008) article on how to implement an anatomic pathology information system and the conversion of

"Approximately 2.5 million anatomic pathology cases and reports were taken from our legacy system and converted into electronic files in the CoPathPlus database."

So, this seems that APLIS is an ERP for laboratories that could be SOA\WEB 2.0 based. This link, http://www.health-infosys-dir.com/yphclis.asp, provides a listing of Laboratory Information Systems with associated web sites. As an example, Antek Healthware has a product LabDAQ at http://www.antekhealthware.com/products/labdaq/index.php that shows how LabDAQ is used as a middleware to collect results from lab analyzers that is fed into electronic medical records.

In the latest issue of LabMedicine at http://labmed.ascpjournals.org/content/current , the article by Berte (2009) states that

"All laboratory work takes place as a series of interconnected processes, from the time the test or examination is ordered by a clinician to the time the result report is available for patient diagnosis or treatment. These interconnected processes are known as the laboratory’s preanalytic, analytic, and post-analytic path of workflow."

Something to think about with interconnected processes and preanalytic, analytic and post-analytic paths in the workflows.

In addition to the above, it seems it is important to know clinical data, architecture, patient management systems, controlled medical vocabularies, DICOM, HL7 CDA, CCOW, IHE workflows, SNOMED. In addition, a basic understanding of HIPAA, identity management, auditing, and access control as well as experience with interface engines: CloverLeaf, OpenEngine, ConnectR, and BizTalk.

Thus, these job descriptions provide an invaluable tool for developing a mental map of the solutions and technologies in different problem domains.


References

Tuthill, M. (2008). Automating Anatomic Pathology. Health Management Technology. Retrieved on February 16, 2009 from http://www.healthmgttech.com/features/2008_march/0308_automating.aspx .

Berte, L. (2009). Technology Will Solve Our Problems...Not! Lab Medicine 40:75-76.

Wednesday, February 11, 2009

Google Visualization and SciVee

Last night I was watching a video on Ted.Com and viewed the graphics of the statistics presented from Gapminder.Org. This got me thinking about using the Google Visualization API Gadget Gallery at the Google Gadget Library along with SciVee for video of my research at SciVee. For visualization, here is an example of using data with their Gauge chart.

function drawGauge() {
gaugeData = new google.visualization.DataTable();
gaugeData.addColumn('number', 'Engine');
gaugeData.addColumn('number', 'Torpedo');
gaugeData.addRows(2);
gaugeData.setCell(0, 0, 120);
gaugeData.setCell(0, 1, 80);

gauge = new google.visualization.Gauge(document.getElementById('gauge'));
gaugeOptions = {
min: 0,
max: 280,
yellowFrom: 200,
yellowTo: 250,
redFrom: 250,
redTo: 280,
minorTicks: 5
};
gauge.draw(gaugeData, gaugeOptions);
}

function changeTemp(dir) {
gaugeData.setValue(0, 0, gaugeData.getValue(0, 0) + dir * 25);
gaugeData.setValue(0, 1, gaugeData.getValue(0, 1) + dir * 20);
gauge.draw(gaugeData, gaugeOptions);
}

at in the AJAX API Playground . A Test page for working on these Gadgets is at The Cromwell Workshop .

SciVee permits uploading video with scientific publications through the creation of a PubCast. Here you

  1. Create the Video for Your Paper
  2. Upload Your Paper and Video
  3. Sync Images and Paper to Video
  4. Review your Work and Inform co-authors
  5. Publish Your Pubcast

Furthermore, you can upload your publication to PubMed ID/DOI. There are some interesting videos on SciVee Videos .

Putting these two vehicles together further enhances both the publication and understanding of scientific collaboration.



Tuesday, February 10, 2009

Processing and Arduino

After a trip to the Mattress Factory Art Museum at (http://www.mattress.org/) in Pittsburgh. I have been thinking more and more about the visualization of multi-dimensional systems. In looking at the links from the last blog on agent models and GIS, I learned about the programming language "Processing" at http://processing.org/ . Since they are also doing work with Arduino,

"Processing is an open source programming language and environment for people who want to program images, animation, and interactions. It is used by students, artists, designers, researchers, and hobbyists for learning, prototyping, and production. It is created to teach fundamentals of computer programming within a visual context and to serve as a software sketchbook and professional production tool. Processing is an alternative to proprietary software tools in the same domain."

The work with Arduino at http://www.arduino.cc/ returns me to my work and thoughts on interfacing multiple sensor boards with XBee wireless technologies for the design of a human interface that monitors EKG and EEG signals as well as body movements to construct painting videos. Below is the user Interface shown in Figure 1. which is the same as Arduino's for writing programs.

Figure 1. Windows GUI with Animated Sprite Program.





More on this later.

GIS and Agent Modeling

Research into both GIS and Agent Modeling has led to this blog at http://gisagents.blogspot.com/:

"GIS and Agent-based modelling is written by Dr. Andrew Crooks, it aims at highlighting and examining the latest advances in the fields of agent-based modelling and GIS. Furthermore the blog highlights current research into these fields at the Centre for Advanced Spatial Analysis (CASA), University College London."

There are many good resources with papers and links for anyone interested in doing GIS with agent modeling.

Wednesday, February 4, 2009

FreeSwitch and .NET

I have been reading the complete IP Telephony eBook by ShoreTel along with the white papers and decided that I wanted to go further into this technology. Here are some of the advantages of IP Telephony solutions:
  1. Business application integration (for CRM database)
  2. Calendar integration
  3. Call waiting
  4. Caller ID
  5. Click-of-a-mouse simplicity—employees
    make or transfer calls right on their
    computer
  6. Conference call with document sharing
  7. Contact screen and caller information
  8. Desktop application (i.e., Microsoft
    Outlook) integration
FreeSwitch (FS) at (http://en.wikipedia.org/wiki/FreeSWITCH) is an open source communication platform for voice and chat driven products written in C that can be interfaced with applications written in C/C++, Java, .NET, PHP, Python, etc. It provides the ability to do:
  • Conferencing
  • XML-RPC control of live calls
  • IVR
  • TTS/ASR
  • PSTN
  • Voice over IP
For more general information, contact http://wiki.freeswitch.org/wiki/Main_Page . Michael Jerris has a good introduction to FS at http://taug.ca/files/Freeswitch-Intro.pdf . You can interface with FS by:
  • XML-RPC
  • Event Socket
  • Embedded Languages
  • Modules
  • ODBC
  • CDR
  • XML

I downloaded the pre-built binaries to get a view of the application, see Figure 1. The FreeSwitch Home Page is at (http://www.freeswitch.org/docs/).

Figure1 . Console Applications of FreeSwitch


From here, I downloaded the source code for all 128 projects into Visual C++ 2008 Express Edition, see Figure 2. From there, I did the build (It seem to take forever) all the projects with modules, downloads, etc. successfully and ran the FreeSwitchConsole Application.

Figure 2. FreeSwitch Visual Studio 2008 Express




The modules for FS at (http://wiki.freeswitch.org/wiki/FreeSwitch_Modules) have a java module that can be implemented from http://wiki.freeswitch.org/wiki/Java . The next step is to do some sample code to show some of the features of using this application. There are several examples at http://wiki.freeswitch.org/wiki/Category:Examples . The Answering Machine example in Javascript is interesting; however, in future posts I plan to include some .NET examples to provide additional insight into how to use and integrate these modules into your business needs.