Weka exception: Can't open file iris.arrf - weka

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.

Related

QuestDB could not open file [errno=2, path=] although file exists

I have launched QuestDB through this way:
docker run -p 9000:9000 --memory="100g" --name docker_questdb -v questdb/questdb
After uncommenting the following line in the server.conf:
cairo.sql.copy.root=
Then running the import command:
COPY d1temp FROM '/home/user/d1_data/d1.csv'
would generate the following error:
QuestDB could not open file [errno=2, path=/home/user/d1_data/d1.csv]
However, the file actually exists:
less /home/user/d1_data/d1.csv
s0,s1,s2
0.093684,0.601416,0.020954
0.181069,0.323754,0.624349
0.665080,0.735986,0.346020
0.317661,0.295168,0.540372
0.702641,0.381416,0.251456
0.056244,0.428558,0.985173
0.893521,0.018625,0.100640
Could this solved please? In the meantime, how could this be fixed?
Os errno=2 is 'No such file or directory'.
If path you specified is outside the container then you need to make sure it's shared via -v. It's best to enter the container and check that file exists inside (e.g. with docker exec) .
Lastly - the path used in copy command is not absolute but relative to cairo.sql.copy.root so if cairo.sql.copy.root is set to '/home/user/d1_data/' then command should look like :
COPY d1temp FROM 'd1.csv'

CNTK fastrCNN - Training Custom Images - FileNotFoundError: [WinError 2] The system cannot find the file specified

I am trying to train fastrCNN module from CNTK library. I have made necessary changes in PARAMETERS.py file. When I ran A1_GenerateROI.py, It generated ROIs but I got following message.
Number of images in set train = 73
Processing image set 'train', image 0 of 73
wrote gt roidb to C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/train.cache_gt_roidb.pkl
Only keeping the first 100 ROIs..
wrote ss roidb to C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/train.cache_selective_search_roidb.pkl
Processing image set 'train', image 50 of 73
Number of images in set test = 18
Processing image set 'test', image 0 of 18
wrote gt roidb to C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/test.cache_gt_roidb.pkl
Only keeping the first 100 ROIs..
wrote ss roidb to C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/test.cache_selective_search_roidb.pkl
DONE.
Now when I try run A2_RunCntk.py I am gettting following error msg.
(cntk-py35) C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN>python A2_RunCntk.py
--------------------------------------------------------------
2017-05-19 09:53:31
PARAMETERS: datasetName = KYC
PARAMETERS: cntk_nrRois = 100
cntk.exe configFile=C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/fastrcnn.cntk currentDirectory=C:\local\CNTK-2-0-beta15-0-Windows-64bit-CPU-Only\cntk\Examples\Image\Detection\FastRCNN/proc/KYC_100/cntkFiles/ NumLabels=4 NumTrainROIs=100 TrainROIDim=400 TrainROILabelDim=400 NumTestROIs=100 TestROIDim=400 TestROILabelDim=400
Traceback (most recent call last):
File "A2_RunCntk.py", line 41, in <module>
pid = subprocess.Popen(cmdStr, cwd = cntkFilesDir)
File "c:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "c:\local\Anaconda3-4.1.1-Windows-x86_64\envs\cntk-py35\lib\subprocess.py", line 955, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Which file is mentioned here, I am not able to figure it out and what should I do. I do not see same error when I try to run Grocery image data set.
Thanks for help in advance.
Set the path to CNTK.exe following this guide: https://learn.microsoft.com/en-us/cognitive-toolkit/Object-Detection-using-Fast-R-CNN#quick-guide
The tutorial further assumes that the folder where cntk.exe resides is in your PATH environment variable. (To add the folder to your PATH you can run the following command from a command line (assuming the folder where cntk.exe is on your machine is C:\src\CNTK\x64\Release): set PATH=C:\src\CNTK\x64\Release;%PATH%.)
Make sure that CNTK is properly installed in your environment.
Run pip list in your Python environment and check if you have CNTK module properly installed.
It should look similar to this:
pip list in Python console
For more instructions follow this: https://learn.microsoft.com/en-us/cognitive-toolkit/setup-cntk-on-your-machine

GeoDjango GDAL_ERROR when uplading .shp

Try to parse a .shp in django shell:
from django.contrib.gis.gdal import DataSource
ds = DataSource('/Users/.../Downloads/Iceland.shp')
get:
GDAL_ERROR 4: Unable to open /Users/.../Downloads/Iceland.shx or /Users/.../Downloads/Iceland.SHX.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/.../lib/python2.7/site-packages/django/contrib/gis/gdal/datasource.py", line 78, in __init__
raise GDALException('Could not open the datasource at "%s"' % ds_input)
GDALException: Could not open the datasource at "/Users/.../Downloads/Iceland.shp"
File exists, chmod is 755, .shx file is correct (tested in online services).
Then I try to test .kml file and it works
OS: Mac OS X 10.10.5
You are missing "Iceland.shx" file. It should be in the same archive as Iceland.shp. Just put it in the same directory. I've tried this files: http://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/iceland-shapefile and catch same error.
If it will not help, there some other options how to debug:
Check the mandatory .shx, .shp and .dbf files are in the same directory.
Check no other programs have the shapefile open (and locked).
Open the shapefile in QGIS/ArcGIS and validate geometry.
Try another shapefile
I need to add that I have the same error when I tried to run the command:
python manage.py ogrinspect /map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi
And the error was generated because of a backslash before the map, so it passed when I run:
python manage.py ogrinspect map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi
When I was looking for my solution I found this question, which is answered. Anyway, I wanted to post this answer for those people who came here like I do a few min ago. Maybe someone help.
python manage.py ogrinspect map/data/points.shp BuildingFootprints --srid=4326 --mapping --multi
Ensure your data is located in the folder... map/data/points.shp BuildingFootprints

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.

Create a session secret - Python - Google Drive SDK

Using: Windows 7, Python 2.7
Code:
Dr Edit - Google's example for creating a new file in Google Drive
Dr Edit Using Python with Google Drive SDK
The README instructions state:
Create a session secret, which should be at least 64 bytes of random
characters, for example with
python -c "import os; print os.urandom(64)" > session.secret
I have no idea how to run this command line. I've tried to run it in the Windows Command Prompt. I've tried to run it in Python Shell. I've tried to run it in the Python Commmand Line. SyntaxError: invalid syntax
Is this README doc correct? Is it outdated? Am I doing something wrong? Is this a line of code that is supposed to be part of a python program? What is the -c for?
I just realized the the python -c is probably just notation to indicate that the user should use the python command line to enter what follows.
So I entered:
import os
print os.urandom(64)
And a string of special characters were printed:
タAËDkæ4ÃZ﾿ヌTツUルヒL゚é-ツؓルト0ᄚ'Ënᄚô#ߝUíèRKRüÏ*'ᄇᄂヤナ%ÿëᄄÄÓò&
There is probably supposed to be a session.secret object? file? variable? that the string of special characters get written to.
I needed to learn the Python Print function.
You can read and write files in Python without importing a library.
The Open() function in Python will open a file, OR create a new file
There are four modes to open (create) a file
'r' read only
'w' write only
'a' append
'r+' both reading and writing
This will create a new text file named "daSecretCode" if there wasn't one already. NOTE: The file gets created in the directory from where the .py module was run from.
daNewFile = open("daSecretCode.txt", "w")
Write content to file:
daNewFile.write("oerjfwi456745oetr78u9f9oirhiwurhkwejr")
Close the file:
daNewfile.close()
Write a new session secret to a new file:
import os
daSecretCode = repr(os.urandom(64))
daNewfile = open("daSecretCode.txt", "w")
daNewfile.write(daSecretCode)
daNewfile.close()
I'm not sure how I could format the content to look like the original output. The characters get formatted into something else.