How do I use Weka's MLP output prediction model in Matlab?
echalom <echalom <at> alum.mit.edu>
2014-11-17 10:30:03 GMT
I'm trying to do prediction in Matlab using the output of Weka's single
In my case I have a single layer with 100 nodes and 200 features.
I'm running Weka 3.7.10, and the options for
-L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H a
Node 0 is Linear in my case, not Sigmoid.
Node 1-100 are all Sigmoid. I didn't use the -C or -I option, so by default
Weka normalizes the data.
When I try to compute the predicted value in Matlab, I don't get the same
value as on Weka.
In the following code:
featvals is my feature vector (stored as 200 rows)
featweightsall is the 200 feature weights from each of the 100 nodes that
nodeweights is the 100 nodeweights that Weka provides.
nodethresh is the 101 thresholds that Weka provides (rows 2-101 contain the
threshold for Nodes 1-100, and row 1 contains the threshold for Node 0).
featvalsnorm = interp1([min(featvals) max(featvals)],[-1
featvalsnorm2 = (featvals -
for j = 1:100
featweights = featweightsall( ((j-1)*200+1):(j*200));
x = sum(featvalsnorm.*featweights) + nodethresh(j+1);
nodenorm(j) = 1/(1+exp(-x));
predvalnorm = sum(nodenorm.*nodeweights)+nodethresh(1);
predval = interp1([-1 1],[min(featvals)
View this message in context: http://weka.8497.n7.nabble.com/How-do-I-use-Weka-s-MLP-output-prediction-model-in-Matlab-tp32703.html
Sent from the WEKA mailing list archive at Nabble.com.
Wekalist mailing list
Send posts to: Wekalist <at> list.waikato.ac.nz
List info and subscription status: http://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html