Machine Learning in Forex Trading: Choosing a machine learning library

There are many ways in which you can perform machine learning tasks in Forex trading. There are several libraries available for your use and each one of them offers a given set of advantages and disadvantages. When you first start in the world of machine learning it becomes difficult to know which one to use among all the possibilities but choosing the wrong library can have very important consequences in terms of what you can do and what you can achieve. On today’s post I am going to go through some of the fundamental factors that you must take into account when deciding which machine learning library to use. I will also mention some of the most popular libraries currently available as well as some benchmarks and my experience when using several of these implementations.

Selection_779

When choosing a machine learning library there are basically five factors that will determine which library is the best fit for you. These factors are current algorithm implementations, future algorithm implementations, easiness of use, accuracy and performance. The first two factors describe the current level of implementation within the algorithm – what it currently can do – and what it will be able to do in the future. If you want to keep up with the latest possible techniques and advances you need to ensure that you get a library that is constantly being updated while if you are more concerned about using a technique right now then you will need to search for a library that has that specific implementation. For example you might not need a library that is constantly being updated but you do know you need a rather complete neural network implementation right now, if this is the case then FANN might be a good choice (second image on this post taken form the FANN sourceforge page).

The third factor is probably the most influential. People often make a decision about which library to use based solely on this factor and this usually leads them to a decision they may later regret. Easiness of use describes all aspects pertaining to the actual practical use of the library: is it coded in a language you understand? Does it have a structure that is easy to understand? Does it have functions that make sense that are easy to call? Are the results easy to read? Is is easy to generate the inputs needed by the library? All of these are important questions that will let you know how easy or hard it is use a given library. Often programmers rush to libraries that are well known for their easiness of use (Weka, scikit-learn) while they neglect to take into account other features that might end up being more important. Of course easiness of use is huge but consider whether it’s acceptable to use a library that is 100x slower just because coding might be easier. Consider all your needs before committing to a library just because of the language it uses, the number of online examples or the size of the online community that uses it.

img81

The fourth factor is not something that you should ignore, accuracy is extremely important. We tend to assume that all libraries available give accurate results but it can be the case that some libraries might not give you accurate results on some specific algorithms. Bugs happen and if you used an algorithm that hardly anyone uses within a library it is reasonable to suppose that it will tend to be more buggy, even if the library is widely used and viewed as accurate in general. For this I would suggest using a tool like benchm-ml with which you can make comparisons of several different machine learning implementations on standard data sets. Yes, if you’re using a library not included you’ll have to add it in order to test it but this might save you from some big headaches if there are some important problems with the library, in particular if those problems are related with the actual algorithms you want to use. The mlcomp website gives a similar overview of machine learning algorithms and their accuracy and performance.

If you want to do trading with ML then performance is going to be a very important concern. Not only because most successful trading applications will require extensive computation but because the speed at which you can compute will most likely be critical to the actual execution of your algorithms in the market. For this reason it is very important to choose libraries that are fast. For this you might want to consider libraries coded in C/C++ that can offer you unparalleled performance. These are the C/C++ libraries I have used in the past for the coding of trading systems in C++: Shark, FANN, MLC++, MLPack and DLib. From these libraries I have finally settled with Shark since it offers the most balanced perspective between easiness of use and performance in C/C++ for me. It is also maintained and updated regularly with new algorithms, another important factor in my view. If you want to get a better view of performance you can take a look at the mlpack automatic benchmark page where they keep updated performance benchmarks of several libraries across several different algorithms and datasets (the first graph above is a benchmark of an all k-nearest neighbor algorithm for 6 programs across 9 algorithms).

cart2

Finally another consideration – which is unique to trading – is how easy it will be to use your algorithms when you move to live trading. There is nothing more frustrating than having something that works perfectly ok and then realizing that you cannot use it because it’s simply not possible to establish communication between your machine learning process and the actual live trading process. When you select a machine learning library consider how easy it will be to include it within your live trading framework. If it will be too hard to include it then you might as well choose another one that will be better to use. Changing machine learning libraries will also be a pain later on so make sure you pay attention to all these questions from the start or you’ll end up regretting not taking the time.

If you would like to learn more about our journey in machine learning and how we use fast C/C++ libraries to code constantly retraining systems for Forex trading  please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading

 

Print Friendly, PDF & Email
You can leave a response, or trackback from your own site.

2 Responses to “Machine Learning in Forex Trading: Choosing a machine learning library”

  1. Nick says:

    Another nice post Daniel !
    How can I contact you please ?

    Best,
    Nick

    • admin says:

      Hi Nick,

      Thanks for writing! I’m glad you liked the post. I just sent you an email to the address you used to post this comment. Please feel free to let me know if you want me to contact you at another address,

      Best Regards,

      Daniel

Leave a Reply

WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.