Skip to content

Commit

Permalink
Major changes to project structure and usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmcnelis committed Mar 4, 2012
1 parent db6d78f commit ef7cce5
Show file tree
Hide file tree
Showing 21 changed files with 322 additions and 1,063 deletions.
17 changes: 13 additions & 4 deletions README.mkd
Expand Up @@ -15,33 +15,42 @@ the issue.
Example of running clustering


class MyRecordClass extends Record {
class MyRecordClass {
@Feature
double myFeature1
@Feature
double myFeature2
@Feature
double myFeature3
@Label
@Label(setlabel="setLabel")
String myLabel;
Object nonFeatureItem;
String nonFeatureOrLabelString;
void setLabel(String label);
//Only use non-primitives in the set method signature
void setLabel(Double doubleLabel);
//Other stuff I want to do
//This API uses equals often, so your object should override it
boolean equals(Object o);
}

class MyClusterRunner {
public static void main(String[] args) {
double epsilon = 4d; //Maximum distance between records in a cluster
int minClusterSize = 3; //Minimum number of records in a cluster
RecordList myRecords = new RecordList();
IRudderList<MyRecordClass> myRecords = new RudderList<MyRecordClass>();
//populate your object
DBScan dbscan = new DBScan(epsilon, minClusterSize);
db.setSourceData(list);
ArrayList<Cluster> clusters = db.getClusters();
//do stuff with your clusters i.e. print record label and cluster
for(int i=0; i<clusters.size(); i++) {
for(MyRecordClass r : clusters.getElements()) {
System.out.println("Cluster " + i+ ": " + r.getLabel());
System.out.println("Cluster " + i+ ": " + myRecords.getStringLabel(r));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/mcnelis/rudder/data/FeatureType.java
@@ -1,5 +1,5 @@
package me.mcnelis.rudder.data;

public enum FeatureType {
TEXT, NUMBERIC
TEXT, NUMERIC
}
5 changes: 2 additions & 3 deletions src/main/java/me/mcnelis/rudder/data/Label.java
@@ -1,15 +1,14 @@
package me.mcnelis.rudder.data;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** denotes a label for a class feature in a class
* @author dmcnelis
*
*/
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Label {

String setlabel() default "setLabel";
FeatureType type() default FeatureType.NUMERIC;
}
22 changes: 0 additions & 22 deletions src/main/java/me/mcnelis/rudder/data/MockRecord.java

This file was deleted.

2 changes: 0 additions & 2 deletions src/main/java/me/mcnelis/rudder/data/NumericFeature.java
@@ -1,9 +1,7 @@
package me.mcnelis.rudder.data;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Denotes a numeric feature in a class
Expand Down

0 comments on commit ef7cce5

Please sign in to comment.