1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-01 18:11:18 +08:00

Fix ops bug & add raise comments of Skew Kurt

This commit is contained in:
bxdd
2020-11-24 12:29:45 +00:00
committed by you-n-g
parent 7152f8321b
commit 67e7fdf80b

View File

@@ -16,9 +16,8 @@ try:
from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi
from ._libs.expanding import expanding_slope, expanding_rsquare, expanding_resi
except ImportError as err:
print(err)
print("Do not import qlib package in the repository directory")
sys.exit(-1)
print("Do not import qlib package in the repository directory!")
raise
__all__ = (
"Ref",
@@ -854,6 +853,8 @@ class Skew(Rolling):
"""
def __init__(self, feature, N):
if N != 0 and N < 3:
raise ValueError("The rolling window size of Skewness operation should >= 3")
super(Skew, self).__init__(feature, N, "skew")
@@ -874,6 +875,8 @@ class Kurt(Rolling):
"""
def __init__(self, feature, N):
if N != 0 and N < 4:
raise ValueError("The rolling window size of Kurtosis operation should >= 5")
super(Kurt, self).__init__(feature, N, "kurt")
@@ -1257,7 +1260,7 @@ class WMA(Rolling):
def weighted_mean(x):
w = np.arange(len(x))
w /= w.sum()
w = w / w.sum()
return np.nanmean(w * x)
if self.N == 0: