How to use Weka JSONLoader in Java IDE?

user9151321

I want to use Weka in order to parse an existing json file in java eclipse. I believe this can be done using the JSONLoader class. After I read the classes' specifications (http://weka.sourceforge.net/doc.dev/weka/core/converters/JSONLoader.html#JSONLoader--) I thought that this could be easily done by doing this:

JSONLoader jsonLoader = new JSONLoader(jsonFile);

Then I thought by just doing jsonLoader.getFileDescription() or jsonLoader.getSource() would give me results. This is not how it's done though and I can't find anywhere how to use the JSONLoader class in my java code. So in order not to make this question too broad, how can I create a JSONLoader object that reads a source that is in JSON format?

AndreyF

First of all it has nothing to do with eclipse so you should edit your question.

A brief look at the documentation of JSONLoader(in the link you provided) can tell that you need to set the data source you want to parse using setSource (the constructor is empty):

JSONLoader jsonLoader = new JSONLoader();
File f = new File("PATH_TO_YOUR_JSON_FILE");
jsonLoader.setSource(f); //you can also use InputStream instead of a File

After doing that you can use other methods that parse your JSON:

Instances dataset = jsonLoader.getDataSet();
jsonLoader.getFileDescription();
...

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to reuse saved classifier created from explorer(in weka) in eclipse java

From Dev

Run java weka utility

From Dev

Which Weka and LibSVM .jar files to use in Java code for SVM classification

From Dev

How to use Naive Bayes of Weka in a Java program

From Dev

Weka "Use Training Set" in Test Option method for Java

From Dev

How to use liblinear with weka gui?

From Dev

Weka - How to use classifier in Java

From Dev

How to use data from Python for Weka?

From Dev

Weka Prediction with Java

From Dev

How to disable logs of LibSVM weka library in java?

From Dev

How to use class Imbalance technique (SMOTE) with Java Weka API?

From Dev

Java WEKA API - StratifiedRemoveFolds

From Dev

how to use python code out of the IDE

From Dev

Which Weka and LibSVM .jar files to use in Java code for SVM classification

From Dev

How to use selenium IDE to generate HTML report

From Dev

How to set evaluation criteria of Weka grid search through java code

From Dev

How to use Naive Bayes of Weka in a Java program

From Dev

How do I use custom stopwords and stemmer file in WEKA (Java)?

From Dev

How to use data from Python for Weka?

From Dev

Weka Prediction with Java

From Dev

Weka how to predict new unseen Instance using Java Code?

From Dev

How to change the color of an object created with JSONLoader on click

From Dev

How to use http in cloud9 ide?

From Dev

Use Netbeans Ide for HTML Project with NO Java

From Dev

How to use if/else statement in Selenium IDE

From Dev

How to use Weka Packages in R?

From Dev

How to use JavaFX SimpleSwingBrowser in Processing IDE?

From Dev

How to open .java in selenium IDE

From Dev

How can I use Ruby in SikuliX IDE?

Related Related

HotTag

Archive