Comments (3)
From a quick glance, you seem to treat the data like you would for Weka. However, Meka works a bit different. See the following examples:
- preparing the class attributes -
MekaClassAttributes
filter - train/predict -
MLUtils.prepareData(Instances)
method
Final remark, you only seem to have a single class attribute...
from meka.
Thanks for your answer, you mentioned good points, I changed my code and used Meka ways, now code is as under:
try {
ConverterUtils.DataSource dataSource = new ConverterUtils.DataSource(FILE_PATH); // original dataset
Instances preparedDataSet = dataSource.getDataSet();
CRUpdateable classifier = new CRUpdateable();
RandomForest randomForest = createRandomForest(1); // random forest is not updatable classifier
classifier.setClassifier(randomForest);
Instances trainingInstances = new Instances(dataSource.getStructure());
Instances testInstances = new Instances(dataSource.getStructure());
int countTestInstances = 0;
int countTrainInstances = 0;
boolean firstTrain = true;
boolean benchTest = true;
for(int row = 123; row < 5021; row++) {
Instance trainingInstance = preparedDataSet.instance(row);
trainingInstances.add(trainingInstance); // collect instances to use as training
countTrainInstances++;
if (firstTrain && countTrainInstances%100 == 0 ) {
trainingInstances = PrepareClassAttributes(trainingInstances,"1,2,3,4,5,6,7");
firstTrain = false;
classifier.buildClassifier(trainingInstances);
}
if(!firstTrain){
benchTest = true;
classifier.updateClassifier(trainingInstance);
for(int j=row+1;j<row+101;j++){
if(benchTest && countTestInstances != 100) {
Instance testInstance = preparedDataSet.instance(j);
testInstances.add(testInstance);
countTestInstances++;
if (countTestInstances % 100 == 0) {
testInstances = PrepareClassAttributes(testInstances,"1,2,3,4,5,6,7");
System.out.println("Evaluate CRUpdateable classifier on ");
String top = "PCut1";
String vop = "3";
Result result = Evaluation.evaluateModel(classifier, trainingInstances , testInstances, top, vop);
System.out.println("Evaluation Info: " + result.toString());
countTestInstances = 0;
benchTest = false;
testInstances.delete();
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
but yet the Accuracy is zero, and the stats results are strange:
N(test) 100
L 7
Hamming score 0
Exact match 0
Hamming loss 1
ZeroOne loss 1
Levenshtein distance 1
Label indices [ 0 1 2 3 4 5 6 ]
Accuracy (per label) [ 0.000 0.000 0.000 0.000 0.000 0.000 0.000 ]
from meka.
Actually the stats results make sense given that there are 0 correct predictions. Without being familiar with your data, it is difficult to know if this is 'strange' or not. Have you tried getting results using a simple test in the GUI first? Or to print out the prediction for each instance?
from meka.
Related Issues (20)
- java.lang.OutOfMemoryError: GC overhead limit exceeded HOT 5
- MULAN Wrapper HOT 4
- Running MEKA on GPU HOT 1
- Error occurs when tring to use SMO -C for parameter tuning HOT 2
- Can you replicate the error and post the steps that cause this? HOT 1
- how to apply test dataset in meka 1.9.3 SNAPSHOT HOT 2
- Update Weka to 3.9.4 HOT 1
- Why rename the input attributes? HOT 7
- run error! attach image HOT 4
- MEKA GUI - Performance HOT 1
- Multitarget - same metrics for several different algorithms HOT 4
- Capability of MEKA on multi-target regression HOT 2
- Illegal options -t HOT 2
- Semi-Supervised Learning HOT 4
- Unable to launch MEKA1.9.6 GUI HOT 9
- F-score results for Cross Validation on Multi-target data HOT 1
- Not able to select a test set in Supplied test set evaluation mode
- Prediction speed scales with training data size rather than output size HOT 3
- [Question] How to use Meka to train and evaluate a semi-supervised model? HOT 3
- ASAP! HELP! Open test file button is not available and I don't understand why? HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meka.