Need help with finance_ml?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

jjakimoto
249 Stars 105 Forks MIT License 26 Commits 2 Opened issues

Description

Advances in Financial Machine Learning

Services available

!
?

Need anything else?

Contributors list

No Data

finance_ml

Python implementations of Machine Learning helper functions based on a book,

Advances in Financial Machine Learning
[1], written by
Marcos Lopez de Prado
.

Installation

Excute the following command

python
python setup.py install

Implementation

labeling

  • Triple Barriers Labeling
  • CUSUM sampling ```Python from financeml.labeling import getbarrierlabels, cusumfilter from financeml.stats import getdaily_vol

vol = getdailyvol(close) trgt = vol timestamps = cusumfilter(close, vol) labels = getbarrierlabels(close, timestamps, trgt, sltp=[1, 1], numdays=1, minret=0, numthreads=16) print(labels.show())

Return the following pandas.Series
python 2000-01-05 -1.0 2000-01-06 1.0 2000-01-10 -1.0 2000-01-11 1.0 2000-01-12 1.0 ``` * Future Returns for Regression

multiprocessing

Parallel computing using

multiprocessing
library. Here is the example of applying function to each element with parallelization. ```python import pandas as pd import numpy as np

def apply_func(x): return x ** 2

def func(df, timestamps, f): df_ = df.loc[timestamps] for idx, x in df.items(): df.loc[idx] = f(x) return df_

df = pd.Series(np.random.randn(10000)) from financeml.multiprocessing import mppandas_obj

results = mppandasobj(func, pdobj=('timestamps', df.index), numthreads=24, df=df, f=apply_func) print(results.head())

Output:
0 0.449278 1 1.411846 2 0.157630 3 4.949410 4 0.601459 dtype: float64 ```

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.