The sharing of resources about Statistical Learning Theory and Machine Learning(includeing SVM,Semi-Supervised Learning,Ensemble Learning,Clustering) ,welcome to contact and communicate with me: Email: xiankaichen@gmail.com,QQ:112035246,

Friday, November 14, 2008

How to write and add your own algorithm to Weka

Recently,I am studying the weka .My  purpose is that add my own algorithm to Weka.
  
I have collected some resource about these aspects from Weka website。 The links show as follow:
        In this webpage,it list many frequently asked questions by two catalogue:uing weka and developing weka
Due to siginificant changes in the API beyond version 3.5.2, there are now two different HOWTOs available.
Please choose the version of Weka you want to develop for:

As of Weka 3.4.4, all the derived classes of superclasses that can be edited in the GenericObjectEditor, like subclasses ofweka.classifiers.Classifier for instance, can be determined dynamically at runtime. Read here for more information.
Note: Weka 3.5.8 turned the automatic discovery off by default.

The GenericObjectEditor is the core component in Weka for modifying schemes, like classifiers and filters in the GUI. It has to be configured correctly in order to show default and additional schemes. See the following articles for more details:

My Experience:

1.netbean+weka for developing    english and chinese
2.if you want to use the weka3.5.8,due to Weka 3.5.8 turned the automatic discovery off by default.so you must make the adjust:
Automatic class discovery was turned off in 3.5.8. GUIs load faster   
without it turned on and it doesn't work when Weka is loaded as a   
plugin via a custom class loader. However, it is easily re-enabled. Just edit the   
GenericPropertiesCreator.props file (located in weka/gui) and change   
the "UseDynamic" property from "false" to "true". 

3.you can be easy to add a new algorithm to weka.if you are famliar with chinese .the follow website is a good introduction:http://blog.chinaunix.net/u1/34560/showart_269880.html
4.when adding a new algorithm to weka.you may take attention to the problem,namely ,that  your own algorithm can not display in the GUI(i.e  Exprolor) even you have modify the "UseDynamic".For this problem.you should adjust your new package's position,For Instance:you want to add a new package"weka.classifier.cxk".you must configure the GenericPropertiesCreator.props  again:
Original:
weka.classifiers.Classifier=\ 
weka.classifiers.bayes,\ 
weka.classifiers.functions,\
weka.classifiers.lazy,\
weka.classifiers.trees,\ 
weka.classifiers.meta,\
weka.classifiers.cxk,\
 weka.classifiers.rules
Modify

weka.classifiers.Classifier=\ 
weka.classifiers.cxk,\
weka.classifiers.bayes,\ 
weka.classifiers.functions,\
weka.classifiers.lazy,\
weka.classifiers.trees,\ 
weka.classifiers.meta,\
 weka.classifiers.rules