uepg-21 / gpquant Goto Github PK
View Code? Open in Web Editor NEWMining technical factors based on symbolic regression via genetic algorithm
Mining technical factors based on symbolic regression via genetic algorithm
Seems gpquant not support multi-process , cannot find parameters like 'n_jobs' in gplearn to control concurrency .
SymbolicRegressor logic running inside one process, and will be very slow if we use large dataset.
你好大佬,请问代码中的轮盘赌的方式是否是每次随机选择,而没有对前一个子代的优质公式进行保留,用于变异进化
Do I understand correctly that if I want to use metrics such as annual return or shape ratio, I need to set the parameter 'transformer' to 'quantile'? I am then wondering about the method of specifying 'transformer_kwargs' in order to use that metric. And how do we set up the DataFrame (df) and signal for the backtester?"
Thank!
Hello, may I please ask how to generate multiple orthogonal factors that tries to fit y with X? It seems that the current implementation only supports fitting one expression for one y, so some manual decomposition of Y is required. If you are too busy to implement, please share how would you try to tackle this. Here is my thought:
Implement another fitness eval function, that is sharpe - sum(correlation(prev_results))
Hope to hear from you soon, nice work!
Best regards,
JU PING
请问如何fit多个股票序列呢,这个项目看起来只能fit一支股票,不知道有没有pandas groupby等trick能找到多个股票上同时fitness比较好的因子
In centos server (CentOS Linux release 7.9.2009) and python 3.8 environment, import SymbolicRegressor failed.
Error details like below:
[baikai@localhost gp]$ python3
Python 3.8.5 (default, Sep 4 2020, 07:30:14)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
from gpquant.SymbolicRegressor import SymbolicRegressor
Traceback (most recent call last):
File "", line 1, in
File "/home/baikai/.local/lib/python3.8/site-packages/gpquant/SymbolicRegressor.py", line 10, in
from .SyntaxTree import SyntaxTree
File "/home/baikai/.local/lib/python3.8/site-packages/gpquant/SyntaxTree.py", line 61, in
class SyntaxTree:
File "/home/baikai/.local/lib/python3.8/site-packages/gpquant/SyntaxTree.py", line 173, in SyntaxTree
def __flatten(self) -> list[Node]:
TypeError: 'type' object is not subscriptable
sr.fit(df.iloc[:508], df["C"].iloc[:508])
Traceback (most recent call last):
File "C:\Users\lpoem\PycharmProjects\factor_mining\main.py", line 44, in
sr.fit(df.iloc[:508], df["C"].iloc[:508])
File "C:\Users\lpoem\PycharmProjects\factor_mining.venv\Lib\site-packages\gpquant\SymbolicRegressor.py", line 144, in fit
self.__evolve()
File "C:\Users\lpoem\PycharmProjects\factor_mining.venv\Lib\site-packages\gpquant\SymbolicRegressor.py", line 106, in __evolve
parent = self.__tournament()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\lpoem\PycharmProjects\factor_mining.venv\Lib\site-packages\gpquant\SymbolicRegressor.py", line 87, in __tournament
parent_index = contenders[np.nanargmax(fitness)]
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lpoem\PycharmProjects\factor_mining.venv\Lib\site-packages\numpy\lib\nanfunctions.py", line 613, in nanargmax
raise ValueError("All-NaN slice encountered")
ValueError: All-NaN slice encountered
def __tournament(self) -> SyntaxTree:
contenders = random.sample(range(self.population_size), self.tournament_size)
fitness = [self.fitness[i] for i in contenders]
if self.metric.sign > 0:
parent_index = contenders[np.nanargmax(fitness)]
else:
parent_index = contenders[np.nanargmin(fitness)]
return self.trees[parent_index]
__tournament()函数似乎在较大数据规模下会出现fitness元素全为NaN的问题,不知道问题出在哪?可以请帮忙看一下是哪的问题?
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.