Skip to content

Properties File

General#

A properties file is a simple text file with this structure:

<key>=<value>

Notes:

  • Comments start with the hash sign #.
  • Backslashes within values need to be doubled (the backslashes get interpreted already when a property is read).

To make a rather long property line more readable, one can use a backslash to continue on the next line. The Filter property, e.g., looks like this:

weka.filters.Filter= \
> weka.filters.supervised.attribute, \
> weka.filters.supervised.instance, \
> weka.filters.unsupervised.attribute, \
> weka.filters.unsupervised.instance

Precedence#

The Weka property files (extension .props) are searched for in the following order:

  • current directory
  • (< Weka 3.7.2) the user's home directory (see FAQ Where is my home directory located? for more information)
  • (>= Weka 3.7.2) $WEKA_HOME/props (the default value for WEKA_HOME is user's home directory/wekafiles).
  • the class path (normally the weka.jar file)

If WEKA encounters those files it only supplements the properties, never overrides them. In other words, a property in the property file of the current directory has a higher precedence than the one in the user's home directory.

Note: Under Cywgin, the home directory is still the Windows one, since the java installation will be still one for Windows.

How to modify a .props file?#

It is quite possible, that the default setup of WEKA is not to your liking and that you want to tweak it a little bit. The use of .props files instead of hard-coding makes it quite easy to modify WEKA's behavior. As example, we are modifying the background color of the 2D plots in the Explorer, changing it to dark gray. The responsible .props file is weka/gui/visualize/Visualize.props. These are the necessary steps:

  • close WEKA
  • extract the .props file from the weka.jar, using an archive manager that can handle ZIP files (e.g., 7-Zip under Windows)
  • place this .props file in your home directory (see FAQ Where is my home directory located? on how to determine your home directory), or for Weka 3.7.2 or higher place this .props file in $WEKA_HOME/props (the default value of WEKA_HOME is user's home directory/wekafiles)
  • open this .props with a text editor (NB: Notepad under Windows might not handle the Unix line-endings correctly!)
  • navigate to the property weka.gui.visualize.Plot2D.backgroundColour and change the color after the equal sign ("=") to darkGray (the article about weka/gui/visualize/Visualize.props lists all possible colors)
  • save the file and restart WEKA

Notes#

  • Escaping

    Backslashes in values need to be escaped (i.e., doubled), otherwise they get interpreted as character sequence. E.g., "is\this" will be interpreted as "ishis". Correctly escaped, this would read as "is\this".

See also#

Further information about specific props files: