Skip to content

PaddyK/configFileCompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

configFileCompiler

This repositories is cloesly related and used to my StudyWorks project. In general this program allows you to specify configuration files for weka experiments.

Dependencies

Installation

  1. Clone this repo
  2. Set up ANT
  3. Get ANTLR Jar (I used 4.4)
  4. in the file build.xml specify the path to the antlr jar by adapting property in line 8 <property name="antlrLib" value="../put/your/path/here" />
  5. Call ant package to build the jar and then ant run to check working (adapt property configfile in line 3`

Config file structure

<experiment>
  <ressources>
    <resource name="resource1" value="val"/>
    ...
  </ressources>
  <classifier name="RandomForest" />
  <classifier name="some classifier from weka">
    <attribute name="attr name" value="val/>
    ..
    <attribute name="W">
      <classifier name="subsequent classifier" /> <!-- it is possible to nest this arbitrarily deep ..>
    </attribute>
  </classifier>
</experiment>

Usage

In the program you wanna use this put the following snipped somewhere:

List<ExperimentSetup> setups = null;
try {
			ANTLRFileStream			stream = new ANTLRFileStream(configFile);
			WekaConfigGrammarLexer	lexer  = new WekaConfigGrammarLexer(stream);
			CommonTokenStream		ts     = new CommonTokenStream(lexer);
			WekaConfigGrammarParser	parser = new WekaConfigGrammarParser(ts);
			setups = parser.configfile().f.interpret();

		} catch(Exception e) {
			e.printStackTrace();
		}

To retrieve a resource do the following:

ExperimentSetup setup = setups.get(0);
setup.getResource("resource name");

In order to retrieve the settings for the classifier, do the following:

List<ClassifierSetups> csetups = setup.getClassifierSetups();
ClassifierSetup csetup = csetups.get(0);
csetup.getOptionAsArray();
csetup.getClassifierName();

The getOptionAsArray()function returns an array with the options. This is similar to the use of weka on the command line.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published