RE: [Classifier4j-devel] Training and Classifying
Status: Beta
Brought to you by:
nicklothian
From: Nick L. <nl...@es...> - 2004-05-17 23:12:35
|
> > Hi Nick, > > The problem I am having is as follows: > > I wish to classify an unknown article against trained data, > which is in > the "word_probability" table. > > So, to do this I must use BayesianClassifier as follows: > > 1. Create an instance of JDBCWordsDataSource > 2. Create a new instance of BayesianClassifier, passing the > JDBCWordsDataSource to the constructor > 3. Call BayesianClassifier.classify(String) > > However, by creating an instance of JDBCWordsDataSource (1), the > constructor for this method creates a new table. > ------ which I do not want because I will have to delete the table > containing all my trained data. > Well that would be bad! Fortunatly you are incorrect about the constructor: JDBCWordsDataSource detects is the table already exists, and if the table does exist it doesn't create it - see <http://classifier4j.sourceforge.net/xref/net/sf/classifier4J/bayesian/JDBCW ordsDataSource.html#235> (Note that there is a bug in the 0.5 version of Classifer4J here if you are using MySQL on Unix - the table names are case sensitive. Get the CVS version). If you are actually seeing this behaviour (the table being dropped) could you please give more details about the database you are using, etc. > What I want is to be able to retrieve my trained data (in a > JDBCWordsDataSource??), then classify the new article against > this data. > > How can I do this? I would very much appreciate some sample code. > It sounds like you are on the right track. Let me know if you try this and it doesn't work. Nick |