[jboss-svn-commits] JBL Code SVN: r19368 - in labs/jbossrules/contrib/machinelearning/dt_examples/src: rules/examples and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 1 16:19:07 EDT 2008
Author: gizil
Date: 2008-04-01 16:19:07 -0400 (Tue, 01 Apr 2008)
New Revision: 19368
Added:
labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl
Removed:
labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl
Modified:
labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/GolfExample.java
labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/Poker.java
labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/PokerExample.java
labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/RestaurantExample.java
labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/restaurants.drl
Log:
golf.drl
Modified: labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/GolfExample.java
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/GolfExample.java 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/GolfExample.java 2008-04-01 20:19:07 UTC (rev 19368)
@@ -25,8 +25,8 @@
WorkingMemory simple = new WorkingMemory();
/* create the drl */
Object golf = new Golf();
- List<Object> my_objects = FileProcessor.processFileExmC45(simple,
- golf, drlFile, "../data/golf/golf.data.txt", ",");
+ //List<Object> my_objects = FileProcessor.processFileExmC45(simple,golf, drlFile, "../data/golf/golf.data.txt", ",");
+ List<Object> my_objects = FileProcessor.processFileExmC45(simple,golf, drlFile, "../data/golf/golf.data.txt", ",");
/* parse the drl */
boolean parse_w_drools = false;
Modified: labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/Poker.java
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/Poker.java 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/Poker.java 2008-04-01 20:19:07 UTC (rev 19368)
@@ -6,27 +6,27 @@
public class Poker {
@DomainSpec(readingSeq = 0)
private int s1; // 'Suit of card #1': Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}
- @DomainSpec(readingSeq = 1)
+ @DomainSpec(readingSeq = 1, discrete=false)
private int c1; // 'Rank of card #1': Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King)
@DomainSpec(readingSeq = 2)
private int s2; // 'Suit of card #2': Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}
- @DomainSpec(readingSeq = 3)
+ @DomainSpec(readingSeq = 3, discrete=false)
private int c2; // 'Rank of card #2': Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King)
@DomainSpec(readingSeq = 4)
private int s3; // 'Suit of card #3': Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}
- @DomainSpec(readingSeq = 5)
+ @DomainSpec(readingSeq = 5, discrete=false)
private int c3; // 'Rank of card #3': Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King)
@DomainSpec(readingSeq = 6)
private int s4; // 'Suit of card #4': Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}
- @DomainSpec(readingSeq = 7)
+ @DomainSpec(readingSeq = 7, discrete=false)
private int c4; // 'Rank of card #4': Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King)
@DomainSpec(readingSeq = 8)
private int s5; // 'Suit of card #5': Ordinal (1-4) representing {Hearts, Spades, Diamonds, Clubs}
- @DomainSpec(readingSeq = 9)
+ @DomainSpec(readingSeq = 9, discrete=false)
private int c5; // 'Rank of card #5': Numerical (1-13) representing (Ace, 2, 3, ... , Queen, King)
@DomainSpec(readingSeq = 10, target = true)
Modified: labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/PokerExample.java
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/PokerExample.java 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/PokerExample.java 2008-04-01 20:19:07 UTC (rev 19368)
@@ -26,6 +26,7 @@
WorkingMemory simple = new WorkingMemory();
/* create the drl */
Object nurse = new Poker();
+
List<Object> my_objects = FileProcessor.processFileExmC45(simple,
nurse, drlFile, "../data/poker/poker-hand-training-true.data.txt", ",");
Modified: labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/RestaurantExample.java
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/RestaurantExample.java 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/java/examples/RestaurantExample.java 2008-04-01 20:19:07 UTC (rev 19368)
@@ -140,8 +140,9 @@
System.out.println("Time" + dt + "\n" + bocuksTree);
RulePrinter my_printer = new RulePrinter();
+ boolean sort_via_rank = true;
my_printer
- .printer(bocuksTree, "examples", "src/rules/examples/" + file);
+ .printer(bocuksTree, "examples", "src/rules/examples/" + file, sort_via_rank);
return facts;
}
Deleted: labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl 2008-04-01 20:19:07 UTC (rev 19368)
@@ -1,37 +0,0 @@
-package examples;
-
-rule "#0 decision = Don't Play with rank:0.14285714285714285"
- when
- examples.Golf(windy == true, outlook == "rain", decision : decision)
- then
- System.out.println("Decision on decision = "+decision +": (Don't Play)");
-end
-
-rule "#1 decision = Play with rank:0.21428571428571427"
- when
- examples.Golf(outlook == "rain", windy == false, decision : decision)
- then
- System.out.println("Decision on decision = "+decision +": (Play)");
-end
-
-rule "#2 decision = Play with rank:0.2857142857142857"
- when
- examples.Golf(outlook == "overcast", decision : decision)
- then
- System.out.println("Decision on decision = "+decision +": (Play)");
-end
-
-rule "#3 decision = Don't Play with rank:0.0"
- when
- examples.Golf(outlook == "sunny", humidity > 77.5, decision : decision)
- then
- System.out.println("Decision on decision = "+decision +": (Don't Play)");
-end
-
-rule "#4 decision = Play with rank:0.14285714285714285"
- when
- examples.Golf(outlook == "sunny", humidity <= 77.5, decision : decision)
- then
- System.out.println("Decision on decision = "+decision +": (Play)");
-end
-
Added: labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl (rev 0)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/golf.drl 2008-04-01 20:19:07 UTC (rev 19368)
@@ -0,0 +1,37 @@
+package examples;
+
+rule "#2 decision = Play classifying 4.0 num of facts with rank:0.2857142857142857"
+ when
+ examples.Golf(outlook == "overcast", decision : decision)
+ then
+ System.out.println("Decision on decision = "+decision +": (Play)");
+end
+
+rule "#1 decision = Play classifying 3.0 num of facts with rank:0.21428571428571427"
+ when
+ examples.Golf(outlook == "rain", windy == false, decision : decision)
+ then
+ System.out.println("Decision on decision = "+decision +": (Play)");
+end
+
+rule "#0 decision = Don't Play classifying 2.0 num of facts with rank:0.14285714285714285"
+ when
+ examples.Golf(outlook == "rain", windy == true, decision : decision)
+ then
+ System.out.println("Decision on decision = "+decision +": (Don't Play)");
+end
+
+rule "#4 decision = Play classifying 2.0 num of facts with rank:0.14285714285714285"
+ when
+ examples.Golf(outlook == "sunny", humidity <= 77.5, decision : decision)
+ then
+ System.out.println("Decision on decision = "+decision +": (Play)");
+end
+
+rule "#3 decision = Don't Play classifying 0.0 num of facts with rank:-1.0"
+ when
+ examples.Golf(outlook == "sunny", humidity > 77.5, decision : decision)
+ then
+ System.out.println("Decision on decision = "+decision +": (Don't Play)");
+end
+
Modified: labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/restaurants.drl
===================================================================
--- labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/restaurants.drl 2008-04-01 19:36:12 UTC (rev 19367)
+++ labs/jbossrules/contrib/machinelearning/dt_examples/src/rules/examples/restaurants.drl 2008-04-01 20:19:07 UTC (rev 19368)
@@ -1,58 +1,58 @@
package examples;
-rule "#5 will_wait = false with rank:0.0"
+rule "#7 will_wait = true classifying 3.0 num of facts with rank:0.2727272727272727"
when
- examples.Restaurant(patrons == "Full", hungry == true, type == "French", will_wait : will_wait)
+ examples.Restaurant(patrons == "Some", will_wait : will_wait)
then
+ System.out.println("Decision on will_wait = "+will_wait +": (true)");
+end
+
+rule "#0 will_wait = false classifying 2.0 num of facts with rank:0.18181818181818182"
+ when
+ examples.Restaurant(patrons == "None", will_wait : will_wait)
+ then
System.out.println("Decision on will_wait = "+will_wait +": (false)");
end
-rule "#1 will_wait = false with rank:0.09090909090909091"
+rule "#6 will_wait = false classifying 2.0 num of facts with rank:0.18181818181818182"
when
+ examples.Restaurant(patrons == "Full", hungry == false, will_wait : will_wait)
+ then
+ System.out.println("Decision on will_wait = "+will_wait +": (false)");
+end
+
+rule "#1 will_wait = false classifying 1.0 num of facts with rank:0.09090909090909091"
+ when
examples.Restaurant(patrons == "Full", hungry == true, type == "Italian", will_wait : will_wait)
then
System.out.println("Decision on will_wait = "+will_wait +": (false)");
end
-rule "#2 will_wait = true with rank:0.09090909090909091"
+rule "#2 will_wait = true classifying 1.0 num of facts with rank:0.09090909090909091"
when
examples.Restaurant(patrons == "Full", hungry == true, type == "Burger", will_wait : will_wait)
then
System.out.println("Decision on will_wait = "+will_wait +": (true)");
end
-rule "#3 will_wait = true with rank:0.09090909090909091"
+rule "#3 will_wait = true classifying 1.0 num of facts with rank:0.09090909090909091"
when
examples.Restaurant(patrons == "Full", hungry == true, type == "Thai", fri_sat == true, will_wait : will_wait)
then
System.out.println("Decision on will_wait = "+will_wait +": (true)");
end
-rule "#4 will_wait = false with rank:0.09090909090909091"
+rule "#4 will_wait = false classifying 1.0 num of facts with rank:0.09090909090909091"
when
examples.Restaurant(patrons == "Full", hungry == true, type == "Thai", fri_sat == false, will_wait : will_wait)
then
System.out.println("Decision on will_wait = "+will_wait +": (false)");
end
-rule "#0 will_wait = false with rank:0.18181818181818182"
+rule "#5 will_wait = false classifying 0.0 num of facts with rank:-1.0"
when
- examples.Restaurant(patrons == "None", will_wait : will_wait)
+ examples.Restaurant(patrons == "Full", hungry == true, type == "French", will_wait : will_wait)
then
System.out.println("Decision on will_wait = "+will_wait +": (false)");
end
-rule "#6 will_wait = false with rank:0.18181818181818182"
- when
- examples.Restaurant(hungry == false, patrons == "Full", will_wait : will_wait)
- then
- System.out.println("Decision on will_wait = "+will_wait +": (false)");
-end
-
-rule "#7 will_wait = true with rank:0.2727272727272727"
- when
- examples.Restaurant(patrons == "Some", will_wait : will_wait)
- then
- System.out.println("Decision on will_wait = "+will_wait +": (true)");
-end
-
More information about the jboss-svn-commits
mailing list