Re: [Wekalist] Using the Evaluation class properly programmatically
by Hans van Rijnberk , Assort Vision, Utrecht
Look in detail which are Evaluation class attributes ("Java Class
attributes" not meaning Weka set attributes). When initialised myEvaluation
gets data properties set in the object but not the FastVector of data
holding the individual Instance objects. The Instances Data Object is passed
to crossValidateModel by reference only. In crossValidateModel method only,
the individual Instance objects are copied and these copies are used.
For crossValidateModel a local copy is made. So when you call
crossValidateModel it will use Data object to make local copies of it within
crossValidateModel method. The memory for the copy will be freed and the
reference link to the data object broken after crossValidateModel finishes.
The rest of the Evaluation object though still persists. It seems this is a
proper way to deal with large structures and memory.
At 16:00 4/2/05 -0500, jcrowell wrote:
>I'm writing a tool that allows a user to load up a set of files and then
>test different classifiers on them. It is clear that I should use the
>Evaluation.java class for this purpose. However, I don't fully understand
>the reasoning behind some of the methods in the class.
>When I create an Evaluation object I must do so by passing in an Instances
>object. For example:
>Evaluation myEvaluation = new Evaluation(new Instances(reader));
>Then if I want to test a classifier I call the method with the following
>void crossValidateModel(Classifier classifier, Instances data, int numFolds,
>What I don't understand is why I have to not only provide a classifier in
>this method call, but also another set of Instances.
>Why do I have to provide another Instances object?
>Didn't I provide the Instances object when I created the Evaluation object?
>What did the Evaluation object do with the Instances object that I created
>it with if not prepare to use it for purposes of classification?
>Sorry for being a newbie.
>Decision Systems Group
>Wekalist mailing list
Hans van Rijnberk