Machine Learning Quant: FinRL + AutoML

1.
무척 흥미러운 작명.퀀트, 트레이더, 퀀트트레이더 그리고 아마추어퀀트까지. Quant라는 수식가 현대 트레이딩을 규정하는 핵심적인 용어로 발전하는 과정을 보여줍니다. 데이타와 기계의 시대를 맞아서 적절한 작명이라고 생각합니다. 대부분 기계학습과 자본시장을 결합할 때 사용하는 표현은 Machine Learning in Quant (Investing, Trading, Trader)입니다. Quant의 일부분이 아니라 Quant의 본질로 기계학습을 사용한 표현이기때문입니다.

Machine Learning Quant

이 명칭을 쓰는 분들은 MLQ.ai입니다.이 때 MLQ는 Machine Learning Quant의 약자입니다.

Based in Toronto, Canada, we’re a group of machine learning engineers, quantitative analysts, and quantum computing enthusiasts.

이 명칭을 사용하는 분들이 올린 Deep Reinforcement Learning for Trading: Strategy Development & AutoML을 보면 Machine Learning Quant라는 말을 사용할 수 있는 AutoML을 설명하고 있습니다. 이 글은 Reinforcement Learning for Trading Strategies 과정을 글로 소개한 부분입니다. 제가 대충 본 여러 논문을 보더라도 강화학습(Reinforcement Learning)이 트레이딩에 가장 적합하고 이런 과점에서 RL을 설명합니다. 글 마지막에 AutoML을 다룹니다. AutoML이 무얼지 찾아보았습니다.

AutoML (Automated Machine Learning) 이란 무엇인가요?머신러닝 모델을 개발하고 실제 운영에 도입하기에는 수많은 과정을 거치게 됩니다 (Figure 1).

전지전능한 인공지능이 존재하여 컴퓨터와 데이터만 주어지면 모든 과정을 알아서 해결해 줄 수 있다면 좋겠지만, 현실의 머신러닝 모델링은 문제 정의 과정에서부터 데이터 수집, 전처리, 모델 학습 및 평가를 거쳐 서비스 적용에 이르기까지에는 여러 분야 전문가들의 많은 시간과 노력이 요구됩니다.AutoML은 머신러닝을 적용 할 때 마다 이러한 과정을 되풀이하면서 발생하는 비효율적인 작업을 최대한 자동화하여 생산성과 효율을 높이기 위하여 등장하였습니다. 특히, 데이터 전처리 과정에서부터 알고리즘 선택 및 튜닝까지의 과정에서 모델 개발자의 개입을 최소화 하여 품질 좋은 모델을 효과적으로 개발할 수 있는 기술에 대한 연구가 오랜동안 진행되어 왔습니다.
AutoML 이란 무엇일까?중에서

좀더 전문적인 설명입니다.

AutoML 이란 간단하게 설명을 드리면 Machine Learning 으로 설계하는 Machine Learning을 의미하며, 크게 3가지 방향으로 연구가 진행이 되고 있습니다.

Automated Feature Learning
Architecture Search
Hyperparameter Optimization

Machine Learning에서 중요한 부분을 차지하는 Feature Extraction, 혹은 Feature Engineering 은 학습 모델에 입력을 그대로 사용하지 않고, 유의미한 feature(특징점)를 추출해서 입력으로 사용하는 방법을 의미합니다. 기존에는 사람이 직접 feature 추출 방법을 정해서 하는 방식이라 각 모델마다 최적의 feature 추출 방식을 찾는 과정에 많은 시간이 소요되었습니다. Automated Feature Learning은 사람이 직접 실험적으로 feature 추출 방법을 정하는 대신 최적의 feature 추출 방법을 학습을 통해서 찾는 방법을 의미합니다.
Learning Transferable Architectures for Scalable Image Recognition 리뷰중에서

AtuoML에 관심을 가진 계기는 HFT Quant님의 트윗때문입니다. AutoML-Zero:Evolving Machine Learning Algorithms From Scratch Review을 논문을 소개하였습니다.

이 논문을 자세히 소개하는 글이 AutoML-Zero:Evolving Machine Learning Algorithms From Scratch Review입니다. Hoya21’s Research Blog는 기계학습과 관련한 논문을 우리글로 소개해주십니다. AutoML-Zero는 model, optimization, initialization 등 ML과 관련 있는 요소들을 오로지 수학적인 연산 정도만 옵션으로 주고 다 설계할 수 있는지를 살펴보는 내용이라고 합니다.

다시금 MLQ의 글로 가보면 강화학습모델과 AutoML을 결합하여 트레이딩시스템을 만들어보자는 이야기로 결론을 맺습니다.

Reinforcement learning is a branch of machine learning that is based on training an agent how to operate in an environment based on a system of rewards.A key point of reinforcement learning is that it won’t give us predictions for things like price targets, or sentiment analysis, instead it takes these inputs and determines the optimal actions to maximize our expected reward.Typically, the expected reward that we’re trying to maximize will be a risk-adjusted return measurement like the Sharpe Ratio.
One of the main ways that we can generate the price predictions to feed the RL agent is to use an LSTM, which is an artificial recurrent neural network (RNN) architecture used in deep learning.Another tool that we can use for our prediction models is AutoML, which is allows you to build machine learning models that are customized to your data, without any coding.

Download (PDF, 1.7MB)

2.
FinRL은 앞서 Reinforcement Learning을 기반으로 주식거래를 자동으로 하도록 하는 Python Library입니다. 단순히 라이브러리가 아니라 관련한 논문을 계속 발표하고 있습니다.

1) Practical Deep Reinforcement Learning Approach for Stock Trading, paper and codes, Workshop on Challenges and Opportunities for AI in Financial Services, NeurIPS 2018.
2) Multi-agent Reinforcement Learning for Liquidation Strategy Analysis, paper and codes. Workshop on Applications and Infrastructure for Multi-Agent Learning, ICML 2019.
3) Deep Reinforcement Learning for Automated Stock Trading: An Ensemble Strategy, paper and codes, ACM International Conference on AI in Finance, ICAIF 2020.
4) FinRL: A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance, Deep RL Workshop, NeurIPS 2020.

이중에서 가장 최근에 발표한 논문이 FinRL: A Deep Reinforcement Learning Library for Automated Stock Trading in Quantitative Finance입니다.


Download (PDF, 568KB)

그러면 어떻게 사용할까요? FinRL for Quantitative Finance: Tutorial for Single Stock Tradingd을 보시면 자세히 정리하고 있습니다. 앞서 2020년에 있었던 NeurIPS 2020에서 발표한 자료입니다. 자세한 정보는 FinRL: A Deep Reinforcement Learning Library for Quantitative Finance에서 확인하실 수 있습니다. 앞서 AutoML과 FinRL을 결합하면 그림이 그려질까요?

Contributions of FinRL:

FinRL is an open source library specifically designed and implemented for quantitativefinance. Trading environments incorporating market frictions are used and provided.
Trading tasks accompanied by hands-on tutorials with built-in DRL agents are available in a beginner-friendly and reproducible fashion using Jupyter notebook. Customization of trading time steps is feasible.
FinRL has good scalability, with a broad range of fine-tuned state-of-the-art DRL algorithms. Adjusting the implementations to the rapid changing stock market is well supported.
Typical use cases are selected and used to establish a benchmark for the quantitative finance community. Standard backtesting and evaluation metrics are also provided for easy and effective performance evaluation.

보너스.Introduction to Python forEconometrics, Statistics and Data Analysis입니다. 옥스포드대학 교수인 Kevin Sheppard이 공개한 책입니다.

Python is a widely used general purpose programming language, which happens to be well suited to econometrics, data analysis and other more general numeric problems. These notes provide an introduction to Python for a beginning programmer. They may also be useful for an experienced Python programmer interested in using NumPy, SciPy, matplotlib and pandas for numerical and statistical analysis (if this is the case, much of the beginning can be skipped).

Download (PDF, 4.1MB)

2 Comments

  1. E Lee

    이 주제에 대한 국내 글을 찾기 어려운데, 잘 읽었습니다. 혹시 AutoML과 FinRL을 접목을 시도 해 보신적이 있는지 궁금합니다. FinRL와 증권사 API로 트레이딩 봇을 만들어보려고 합니다.

    Reply
    1. smallake (Post author)

      제가 직접 시험하지는 않습니다. 대부분…

      https://quantpedia.com/

      위 사이트를 보시면 논문을 이용하여 “See out-of-sample implementation of selected strategies” 작업을 해서 결과를 서비스를 제공합니다. 문의하신 논문이 있을지는 모르겠네요…

      Reply

Leave a Comment

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

이 사이트는 스팸을 줄이는 아키스밋을 사용합니다. 댓글이 어떻게 처리되는지 알아보십시오.