Christian Schulz | 1 Aug 2003 12:16
Picon

Re: Prediction with Neural Network Classifier by using a Model

Hi,
mysterious ,using:

java weka.classifiers.functions.neural.NeuralNetwork -t gender.arff -p 0
.....i'm getting no output, too?

But if you call the NeuralNetwork class directly, it works via the
DistributionClassifier
methods

  for(int i=0;i<data.numInstances();i++) {
         out.write("Predicted class for instance " + i + " is " +
         " " + model1.classifyInstance(data.instance(i)) + "\n");
         double[]
dist=((DistributionClassifier)model1).distributionForInstance(data.instance(
i));
         out.write("Distribution of Probabilities for instance " + i + " is:
\n");
         for (int k=0; k<dist.length; k++)
             out.write(100*dist[k] + "\n");
     }

 you getting some outputs like:

Predicted class for instance 0 is  0.0
Distribution of Probabilities for instance 0 is:
99.54234555758711
0.45765444241290193
Predicted class for instance 1 is  0.0
Distribution of Probabilities for instance 1 is:
99.99999970748677
2.9251323941226344E-7
Predicted class for instance 2 is  0.0
Distribution of Probabilities for instance 2 is:
99.17165599384222
0.8283440061577779
Predicted class for instance 3 is  1.0
Distribution of Probabilities for instance 3 is:
0.8564604202707004
99.1435395797293!?

regards,christian

> Dear Weka Users,
>
> I am resending this message so it can be seen in the August Archive. No
one
> answered the question, I am just wodering if there is something wrong with
> my approach ... Please do reply back.
>
> Dear List,
>
> I have a problem with prediction when I use the Neural Network classifier:
I
> have a training file, test file and I have a model built from the training
> file. I come accross the following problems:
>
> 1) When I use the -p 0 option with the following command i get an error:
>
> java -cp weka.jar weka.classifiers.neural.NeuralNetwork -T test.arff -l
> model -p 0 > out.txt
>
> When I remove the -p 0 (prediction for unseen class), it works provided I
> provide the correct value for the class. (Hence prediction from the model
is
> impractical).
>
> 2) When I use the -p 0 option with the following command it works:
>
> java weka.classifiers.neural.NeuralNetwork -L 0.3 -M 0.2 -N 500 -V 0 -S
0 -E
> 20 -H a -G -R -t train.arff -T test.arff -p 0 > out.txt
>
> In this case I get a prediction for the instance with an unknown class.
> (Hence prediction is only possible when both a training file and test file
> are present). It takes too long.
>
> Problem:
> The problem with approach 2 is that each time I have to wait a long time
> before I can get the prediction. I was wondering if any  one has observed
> similar problems on using a MODEL to predict an unknown class using N
Nets.
>
> Please do help, stuck on this for a while now.
>
> Kashif
>
>
>
>
> _______________________________________________
> Wekalist mailing list
> Wekalist <at> list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist

Gmane