
FilterĮither takes the class attribute into account or notĮ.g., removing a certain attribute or removing instances that meet a certain condition tOptions(("-C 1.0 -L 0.0010 -P 1.0E-12 -N 0 -V -1 -W 1 -K \".PolyKernel -C 250007 -E 1.0\"")) Īlso, the OptionTree.java tool allows you to view a nested options string, e.g., used at the command line, as a tree. Will generate output like this: // create new instance of scheme Especially handy if the command line contains nested classes that have their own options, such as kernels for SMO:

So if you use InstanceQuery to do text mining against text that appears in a VARCHAR column, Weka will regard such text as nominal values. * InstanceQuery automatically converts VARCHAR database columns to NOMINAL attributes, and long TEXT database columns to STRING attributes.
#Weka jar online how to#
The Windows databases article explains how to do this. * For MS Access, you must use the JDBC-ODBC-bridge that is part of a JDK.
#Weka jar online driver#
* Don't forget to add the JDBC driver to your CLASSPATH. Instances data = query.retrieveInstances() You can declare that your data set is sparse InstanceQuery query = new InstanceQuery()
#Weka jar online code#
Secondly, your Java code needs to look like this to load the data from the database: import JdbcURL=jdbc:mysql://localhost:3306/some_database Your props file must contain the following lines: jdbcDriver=.mysql.Driver Since you're only reading, you can use the default user nobody without a password. (The driver class is .mysql.Driver.) The database where your target data resides is called some_database. The MySQL JDBC driver is called Connector/J. Suppose you want to connect to a MySQL server that is running on the local machine on the default port 3306. First, you'll have to modify your DatabaseUtils.props file to reflect your database connection. Reading from Databases is slightly more complicated, but still very easy. For example, the XRFF format saves the class attribute information as wellĭata.setClassIndex(data.numAttributes() - 1) setting class attribute if the data format does not provide this information import .DataSource ĭataSource source = new DataSource("/some/where/data.arff") It can also read CSV files and other formats (basically all file formats that Weka can import via its converters it uses the file extension to determine the associated loader). The DataSource class is not limited to ARFF files. The classifiers and filters always list their options in the Javadoc API ( stable, developer version) specification.Ī comprehensive source of information is the chapter Using the API of the Weka manual. A link to an example class can be found at the end of this page, under the Links section. The following sections explain how to use them in your own code.

