mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-14 16:26:55 +08:00
fix_pylint_for_CI (#1119)
* fix_pylint_for_CI * reformat_with_black * fix_pylint_C3001 * fix_flake8_error
This commit is contained in:
@@ -48,7 +48,9 @@ def calc_long_short_prec(
|
||||
|
||||
group = df.groupby(level=date_col)
|
||||
|
||||
N = lambda x: int(len(x) * quantile)
|
||||
def N(x):
|
||||
return int(len(x) * quantile)
|
||||
|
||||
# find the top/low quantile of prediction and treat them as long and short target
|
||||
long = group.apply(lambda x: x.nlargest(N(x), columns="pred").label).reset_index(level=0, drop=True)
|
||||
short = group.apply(lambda x: x.nsmallest(N(x), columns="pred").label).reset_index(level=0, drop=True)
|
||||
@@ -98,7 +100,10 @@ def calc_long_short_return(
|
||||
if dropna:
|
||||
df.dropna(inplace=True)
|
||||
group = df.groupby(level=date_col)
|
||||
N = lambda x: int(len(x) * quantile)
|
||||
|
||||
def N(x):
|
||||
return int(len(x) * quantile)
|
||||
|
||||
r_long = group.apply(lambda x: x.nlargest(N(x), columns="pred").label.mean())
|
||||
r_short = group.apply(lambda x: x.nsmallest(N(x), columns="pred").label.mean())
|
||||
r_avg = group.label.mean()
|
||||
|
||||
Reference in New Issue
Block a user