Adding a new method in the Classifier interface

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Adding a new method in the Classifier interface

Julien Nioche-2
Hi,

Attached is one patch that adds a method to the Classifier interface,
inspired by the JDM API.
This methods takes as argument an object of the type
ClassifierCapability. Each Classifier implementation would then
publicise about what it can do or what kind of data it can accept. It
would be easier to automatically convert the data to the format accepted
by the Classifier.

What do you think of that? What else could be added in the list of
capabilities?

******************************************************
Exemple of supportCapability in a given Classifier implementation :

  /** Informations about what the classifier can do **/
  public boolean supportCapability(ClassifierCapability capability){
   if (capability==ClassifierCapability.BiNominalClass) return false;
   if (capability==ClassifierCapability.PolyNominalClass) return false;
   if (capability==ClassifierCapability.NumericAttributes) return false;
   if (capability==ClassifierCapability.BiNominalAttributes) return false;
   if (capability==ClassifierCapability.PolyNominalAttributes) return false;
   if (capability==ClassifierCapability.StringAttributes) return true;
   if (capability==ClassifierCapability.NumericAttributes) return true;
   if (capability==ClassifierCapability.Updatable) return true;
   return false;
  }

Index: Classifier.java
===================================================================
RCS file: /usr/local/global-cvs/ml_cvs/weka/classifiers/Classifier.java,v
retrieving revision 1.12
diff -u -r1.12 Classifier.java
--- Classifier.java 13 Feb 2005 23:36:12 -0000 1.12
+++ Classifier.java 11 May 2005 15:45:54 -0000
@@ -48,6 +48,8 @@
   /** Whether the classifier is run in debug mode. */
   protected boolean m_Debug = false;
 
+  public abstract boolean supportCapability(ClassifierCapability capability);
+  
   /**
    * Generates a classifier. Must initialize all fields of the classifier
    * that are not being set via options (ie. multiple calls of buildClassifier
Index: ClassifierCapability.java
===================================================================
RCS file: ClassifierCapability.java
diff -N ClassifierCapability.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ClassifierCapability.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,21 @@
+/*
+ * Created on 2005-5-11
+ * ClassifierCapability.java
+ */
+package weka.classifiers;
+
+/**
+ * Indicates what type of data a given Classifier implementation can support
+ **/
+public interface ClassifierCapability
+{
+  public static final ClassifierCapability PolyNominalAttributes = null;
+  public static final ClassifierCapability BiNominalAttributes = null;
+  public static final ClassifierCapability StringAttributes = null;
+  public static final ClassifierCapability NumericAttributes = null;
+  
+  public static final ClassifierCapability PolyNominalClass = null;
+  public static final ClassifierCapability BiNominalClass = null;
+  
+  public static final ClassifierCapability Updatable = null;
+}

_______________________________________________
Wekalist mailing list
[hidden email]
https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist

J.Nioche.vcf (222 bytes) Download Attachment
Loading...