zhuww / ubc_ai Goto Github PK
View Code? Open in Web Editor NEWUBC AI project
UBC AI project
UBC AI project (pfd AI part) by Aaron Berndsen and Weiwei Zhu If you use PICS AI (UBC AI) then please acknowledge it by citing Zhu, W. W. et al. 2014 ApJ, 781, 117 . NEW! The PICS AI now support the .ar2 file format from psrchive. For this to work you need to install psrchive's python module: INSTALL psrchive with configure --enable-shared make sure to add $PSRHOME/lib/python2.X/site-packages/ to your PYTHONPATH. Installing psrchive is NOT required when dealing with only pfd files. *** When using a more recent version of numpy, the classfy program may sometimes end up in a dead loop of printing a DeprecationWarining message due to a line in presto's python module: $PRESTO/lib/python/psr_utils.py:892:DeprecationWarning: using a non-integer number instead of an integer will result in an error in the future Currently, the one way to walk around this problem is to fix the psr_utils.py file in line 888: 887: """ 888: bins = int(bins % len(arr)) This fix the variable "bins" to be integer and solve our problem. TO USE THIS CODE YOU NEED TO INSTALL: PRESTO (make sure to include the presto python library in your $PYTHONPATH) sklearn (python package, version 0.12.1) libblas-dev theano (python package, version 0.8.2) python-dev imagemagick TO INSTALL the packages: apt-get install python-dev apt-get install libblas-dev easy_install scikit-learn==0.12.1 easy_install theano==0.8.2 apt-get install imagemagick TO USE OUR PICKLED CLASSIFIERS: ***The following code is from the quickclf.py code in the repo, this code classifer all .pfd file in the current workign directory and save teh result to clfresult.txt. One can then open up and inspect the result using: python pfdviewr.py clfresult.txt ***Be careful: When there are more than one cpu available, the default behavior of the code is to use multi-threading. The code will use up to 20 threads or max(cpu)-1. If you want to turn this behavior off, you can change the default max_threads parameter in file: threadit.py. import cPickle, glob, ubc_AI from ubc_AI.data import pfdreader AI_PATH = '/'.join(ubc_AI.__file__.split('/')[:-1]) classifier = cPickle.load(open(AI_PATH+'/trained_AI/clfl2_BD.pkl','rb')) pfdfile = glob.glob('*.pfd') AI_scores = classifier.report_score([pfdreader(f) for f in pfdfile]) text = '\n'.join(['%s %s' % (pfdfile[i], AI_scores[i]) for i in range(len(pfdfile))]) fout = open('clfresult.txt', 'w') fout.write(text) fout.close()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.