Sep 25, 2014
Sep 24, 2014
confusion matrix matlab
tl =
1 1 1
1 1 2
2 2 2
pl =
1 1 1
2 1 1
2 2 2
>> confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2+1)
ans =
4 1 0
1 3 0
0 0 0
>> conf_mat = confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2)
conf_mat =
4 1
1 3
>> sum(conf_mat, 2)
ans =
5
4
>> nrm(:,ones(1,size(conf_mat,2)))
ans =
5 5
4 4
>> conf_mat./nrm(:, ones(1,size(conf_mat,2)))
ans =
0.8000 0.2000
0.2500 0.7500
1 1 1
1 1 2
2 2 2
pl =
1 1 1
2 1 1
2 2 2
>> confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2+1)
ans =
4 1 0
1 3 0
0 0 0
>> conf_mat = confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2)
conf_mat =
4 1
1 3
>> sum(conf_mat, 2)
ans =
5
4
>> nrm(:,ones(1,size(conf_mat,2)))
ans =
5 5
4 4
>> conf_mat./nrm(:, ones(1,size(conf_mat,2)))
ans =
0.8000 0.2000
0.2500 0.7500
Sep 20, 2014
Panda3D installation
Tried two days to install Panda3D into my ubuntu machine and ended up with frustration. The OSX version is just a few clicks solution from the .dmg file. Life is easy if you find the correct direction :)
Panda3D for OSX
- Download the disk-image
- Finish installation
- Run a sample program such as Asteroids given with the SDK in /Developers/Examples.
- install the NVidia Cg toolkit if following error occurs
- dyld: Library not loaded: @executable_path/../Library/
Frameworks/Cg.framework/Cg
Panda3D installation
Tried two days to install Panda3D into my ubuntu machine and ended up with frustration. The OSX version is just a few clicks solution from the .dmg file. Life is easy if you find the correct direction :)
Panda3D for OSX
- Download the disk-image
- Finish installation
- Run a sample program such as Asteroids given with the SDK in /Developers/Examples.
- install the NVidia Cg toolkit if following error occurs
- dyld: Library not loaded: @executable_path/../Library/
Frameworks/Cg.framework/Cg
PATH variable
------------------------------ ---
Find the required location of the file, eg. java. Put the directory into the PATH variable.
touch ~/.bash_profile
open ~/.bash_profile
PATH=/opt/local/lib:/System/ Library/Frameworks/Python. framework/Versions/2.5/bin:/ opt/local/bin:/opt/local/sbin: /sw/bin:/sw/sbin:/usr/bin:/ bin:/usr/sbin:/sbin:/usr/ local/bin:/usr/local/git/bin:/ usr/texbin:/usr/X11/bin:/usr/ X11R6/bin
source ~/.bash_profile
Python in OSX
Though OSX comes with a version of python, if another version is required here are some guidelines.
# I have used macport to install the desired version of python (eg., 2.7). This will be installed in the following directory.
$ cd /Library/Frameworks/Python. framework/Versions/
$ ls
2.7 Current
# Now move the installed version into the directory /System/Library/ Frameworks/Python.framework/ Versions/
where all other previously installed python version are.
$ sudo mv /Library/Frameworks/Python. framework/Versions/2.7 /System/Library/Frameworks/ Python.framework/Versions/
# remove the older version of "Current" from /System/Library/Frameworks/ Python.framework/Versions/
$ sudo chown -R root:wheel /System/Library/Frameworks/ Python.framework/Versions/2.7
$ sudo rm /System/Library/Frameworks/ Python.framework/Versions/ Current
# create new symbolic link for the newly installed python version (eg, 2.7)
$ sudo ln -s /System/Library/Frameworks/ Python.framework/Versions/2.7 /System/Library/Frameworks/ Python.framework/Versions/ Current
# remove the old python symbolic link
$ sudo rm /usr/bin/pydoc
$ sudo rm /usr/bin/python
$ sudo rm /usr/bin/pythonw
$ sudo rm /usr/bin/python-config
# create the new symbolic links so that when you type on the terminal this is the desired python that would execute. This is because python
$ sudo ln -s /System/Library/Frameworks/ Python.framework/Versions/2.7/ bin/pydoc /usr/bin/pydoc
$ sudo ln -s /System/Library/Frameworks/ Python.framework/Versions/2.7/ bin/python /usr/bin/python
$ sudo ln -s /System/Library/Frameworks/ Python.framework/Versions/2.7/ bin/pythonw /usr/bin/pythonw
$ sudo ln -s /System/Library/Frameworks/ Python.framework/Versions/2.7/ bin/python-config /usr/bin/python-config
# update the ~/.bash_profile PATH variable to link the current python path
touch ~/.bash_profile
open ~/.bash_profile
PATH=/opt/local/lib:/System/ Library/Frameworks/Python. framework/Versions/2.5/bin:/ opt/local/bin:/opt/local/sbin: /sw/bin:/sw/sbin:/usr/bin:/ bin:/usr/sbin:/sbin:/usr/ local/bin:/usr/local/git/bin:/ usr/texbin:/usr/X11/bin:/usr/ X11R6/bin
source ~/.bash_profile
Installed modules via macport successfully get installed into /opt/local/lib/python2.5/ site-packages/
But when compiling a python script it doesn't find the path of the modules that are included using import statement such as
import path
import json
import numpy
import Image
The following error message pops up "ImportError: No module named Image" or "ImportError: No module named simplejson".
Updating the PATH variables to point to the python version or macport installation path did not help. Explicit location of the installed modules needs to be shown to get rid of the error.
Add the path in the python code to show the path of the installed package. For example, to show the installed packages via macport find the path of the location of where the modules get installed:
$port content py25-numpy
It will show the /opt/local/lib/python2.5/ site-packages/
Add the path using
sys.path.append("/opt/local/ lib/python2.5/site-packages/")
Similarly, for the downloaded package such as path, add the location of the downloaded copy using sys.path.append() method.
sys.path.append("~
/Desktop/seeing3d_renderer/ seeing3d-master/pathpy/
)
One solution could be use the try-catch:
try:
import json
except ImportError:
import simplejson as json
with open(access) as log_file:
Should be replaced with the following for the earlier python version such 2.5.
stream = None
log_file = None
try:
stream = open(access, 'r')
log_file = stream.readlines()
except IOError:
print "Cannot find open the file", access
Car rental steps
Just a note for reminder from my last rental experience at California.
- Book from Hertz/National/others
- Go and pick up the car
- Pay additional fee for eg GPS (Hertz charges 13.99 dollar/day), upgrade to better model etc
- Drop off location can be changed.
- Fill in the gas tank (if this is how the contract was made).
- Write the millage and time-of-return on paper.
- Drop off the filled-out form with keys into the drop off box (if rental location closed) or to the rental guy at the store.
Subscribe to:
Posts (Atom)
Notebooks
illuminate.google.com notebooklm.google.com
-
To install pngwrite we need to install to helper library before we install pngwriter. 1. libpng 2. freetype2 We can use fink or macport to i...
-
Use 'Disk Utility' application to format the USB drive in MS-DOS (FAT) format Download the windows ISO file from the Windows websit...