Speedy Python with Numba and Genetic Programming

(Last Updated On: May 22, 2017)
Learn the Secret

Get  our 2 Free Books

Get these now which land directly to their inbox.
Invalid email address

Speedy Python with Numba and Genetic Programming

A comment came in from highly active newsletter subscriber:

Python slow and inefficient”


You mention Cython in speeding up your code, you may like to consider for certain situations adding numba to your arsenal as well. Numba allows you to keep your python code in generic form and use a decorator to invoke a LLVM (JIT)compiler to compile the byte code run close to machine code times. http://numba.pydata.org/numba-doc/dev/user/examples.html


I use this often after profiling the python code to target bottlenecks, (http://markdewing.github.io/blog/posts/prototype-for-profiling-python/)

It can be used with multithread and also Numba Pro and CUDA with Nvidia GPUs. By profiling the code you can ascertain where the bottlenecks are in the code and where to target your efforts in speeding up code.



For comparison studies see https://www.ibm.com/developerworks/community/blogs/jfp/entry/How_To_Compute_Mandelbrodt_Set_Quickly?lang=en


(Another option for fast computation is to write a Fortran function directly ( yes I am of that vintage! J ), and use the f2py package to interface with the function.)


The other comment: you refer to the issue of the “market landscape always changing”, and you need a library of algorithms to cater for this.  I would add not only a library, but a “dynamic” library. One such approach would be to use Machine learning to generate new ideas constantly. Genetic Programs (GP) can generate trading ideas or systems from the data itself (more advanced applications will write the system code) , you may have a machine dedicated solely for this task. If you map your search space to a higher dimension you may discover patterns  that are exploitable and give you an edge. Being nimble counts.


I followed up with questions of:

What GP Python packages to use? Compatible with Machine Learning Python packages that this can work with? Any such examples for this use?

This story shall continue


NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
This entry was posted in Quant Development and tagged , , , on by .

About caustic

Hi i there My name is Bryan Downing. I am part of a company called QuantLabs.Net This is specifically a company with a high profile blog about technology, trading, financial, investment, quant, etc. It posts things on how to do job interviews with large companies like Morgan Stanley, Bloomberg, Citibank, and IBM. It also posts different unique tips and tricks on Java, C++, or C programming. It posts about different techniques in learning about Matlab and building models or strategies. There is a lot here if you are into venturing into the financial world like quant or technical analysis. It also discusses the future generation of trading and programming Specialties: C++, Java, C#, Matlab, quant, models, strategies, technical analysis, linux, windows P.S. I have been known to be the worst typist. Do not be offended by it as I like to bang stuff out and put priorty of what I do over typing. Maybe one day I can get a full time copy editor to help out. Do note I prefer videos as they are much easier to produce so check out my many video at youtube.com/quantlabs