Show entropy values in J48 trees WEKA - weka

I am quite new to Weka but what I am trying to do is to print the Entropy values for each split in my J48 trees.
The command line I am using to train the tree is:
java -classpath CLASSPATH:weka.jar weka.classifiers.trees.J48 -C 0.25 -M 2 -t Matrix70.arff -d 70.model -S ENTROPY
but I have an error message:
Weka exception: Illegal options: ENTROPY
Do you know how to get ENTROPY values?
Thanks

Related

Weka exception: Can't open file iris.arrf

I am trying to run a script from command line for Weka classification task, it is working perfectly for training CSV data. But for Arrf file it is not working.
Command:
java -cp "C:\Program Files\Weka-3-8-5\weka.jar" weka.classifiers.trees.J48 -t iris.arrf
Error: Weka exception: Can't open file iris.arrf.
The Iris file is the sample data obtained from Weka/data folder so I don't know where is the issue.
You misspelled the file name, using .arrf instead of .arff.

Error while reading a compressed csv file using Python2.7

I am getting an error while reading a compressed csv file.
The error is as below:
"zlib.error: Error -3 while decompressing: invalid distances set"
Code :
filename = 'testfile.gz'
with gzip.open(filename, 'rb') as reader:
for line in reader:
print(line)
I tried gunzip on the file and it worked without any issues.
I used gunzip -t . It gave rc 0.
This one seems like a bug in zlib library with version 1.2.7-15
$ rpm -qa | grep zlib
zlib-1.2.7-15.el7.x86_64
I got it updated to 1.2.7-17 and the issue got resolved.
$ rpm -qa | grep zlib
zlib-1.2.7-17.el7.x86_64

Running two related commands in Subprocess Python

I am trying to start mjpg-streamer from a python script on the raspberry pi. The instructions for how to start it from the command line are here and consist of running
export LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www"
-i "input_raspicam.so"
from /var/www/mjpg-streamer/mjpg-streamer-experimental. When I do it in the terminal, it works fine.
However, I am trying to run it using subprocess.call like this:
subprocess.call('export LD_LIBRARY_PATH=.', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
subprocess.call('./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so -x 640 -y 480 -fps 15 -vf -hf"', shell=True, cwd='/var/www/mjpg-streamer/mjpg-streamer-experimental')
And that is giving me the error:
MJPG Streamer Version: svn rev: ERROR: could not find input plugin
Perhaps you want to adjust the search path with:
# export LD_LIBRARY_PATH=/path/to/plugin/folder
dlopen: input_raspicam.so: cannot open shared object file: No such file or directory
I'm guessing it is because the first command doesn't provide the relevant link to the plugin? I'm not entirely sure of how these commands work anyway, so any insight into that would also be helpful!
I have also tried using os.system to run these commands and have received the same error.
I'm sure I'm doing something silly, so thanks in advance for your patience!

gdal2tiles.py no input file specified, wrong formatting?

I'm having trouble running gdal2tiles.py through a command line. I followed instructions on installing gdal from http://cartometric.com/blog/2011/10/17/install-gdal-on-windows/ I then verified through command prompt that gdal was installed by typing in gdalinfo --version, and the correct version came up which means that my path and variables are set.
So when I try to run this:
gdal2tiles.py -p raster -z 0-6 test.jpg abc
I keep getting an error that says "error: No input file was specified" and
"Usage: gdal2tiles.py [options] input_file(s) [output]"
I am able to run other gdal commands and they work just fine. I've also tried to run
gdal2tiles.py test.jpg
and this gives the same error.
I'm pretty sure I have the right formatting so if anyone has any suggestions or might have a solution to this please let me know. Thanks
In command prompt just type in:
python gdal2tiles.py -p raster -z 0-6 test.jpg abc
That corrected the problem for me.

Weka: Array Index out of bounds exception with CSV files

I get an unfriendly ArrayOutOfBoundsException when I try to input a CSV file to Weka. But it works fine when I use the same in the GUI.
pvadrevu#MacPro~$ java -Xmx2048m -cp weka.jar weka.classifiers.functions.Logistic -R 1.0E-8 -M -1 -t "some.csv" -d temp.model
Refreshing GOE props...
[KnowledgeFlow] Loading properties and plugins...
[KnowledgeFlow] Initializing KF...
java.lang.ArrayIndexOutOfBoundsException: 1
weka.classifiers.evaluation.Evaluation.setPriors(Evaluation.java:3843)
weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1503)
weka.classifiers.Evaluation.evaluateModel(Evaluation.java:650)
weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:359)
weka.classifiers.functions.Logistic.main(Logistic.java:1134)
at weka.classifiers.evaluation.Evaluation.setPriors(Evaluation.java:3843)
at weka.classifiers.evaluation.Evaluation.evaluateModel(Evaluation.java:1503)
at weka.classifiers.Evaluation.evaluateModel(Evaluation.java:650)
at weka.classifiers.AbstractClassifier.runClassifier(AbstractClassifier.java:359)
at weka.classifiers.functions.Logistic.main(Logistic.java:1134)
Turns out that the new versions of Weka donot handle CSV files through command line. There are two options:
Revert back to an older version of Weka. 3.6.11 works fine for me while 3.7.11 does not.
Convert the CSV files to ARFF. It can be done using the Weka GUI.