Does anyone know how to reuse a WEKA model in MATLAB? I've recently created a Bayes Net model in WEKA, and I want to import that model in MATLAB so I can re-create the Bayesian Network in MATLAB.
Someone help please!!
You can use Weka in MATLAB by importing weka.jar. Here is a small .m file script showing how to use Weka's BayesNet in MATLAB, written by Muhammad Shoaib Sehgal.
% Note: You can either set WEKA_HOME as an environment variable or pass
% absolute path of weka.jar to javaaddpath. For example,
% javaaddpath('c:\weka\bin\weka.jar');
javaaddpath('WEKA_HOME/weka.jar');
clear all
clc
import weka.classifiers.Classifier
import weka.classifiers.bayes.BayesNet
import weka.classifiers.Evaluation;
% calling classifier from matlab
v1 = java.lang.String('-t');
%v2 = java.lang.String('D:\Shoaib\BioMANTA\bioManta code\classification\loc_nlboost\bn\loc_trDt.csv');
v2 = java.lang.String('WEKA_HOME\trainData.arff');
v3 = java.lang.String('-T');
v4 = java.lang.String('WEKA_HOME\testDATA.arff');
prm = cat(1,v1,v2,v3,v4);
Evaluation.evaluateModel(javaObject('weka.classifiers.bayes.BayesNet'),prm);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With