diff --git a/qlib/model/riskmodel/shrink.py b/qlib/model/riskmodel/shrink.py index b2594f707d..c3c0e48ef8 100644 --- a/qlib/model/riskmodel/shrink.py +++ b/qlib/model/riskmodel/shrink.py @@ -247,9 +247,7 @@ def _get_shrink_param_lw_single_factor(self, X: np.ndarray, S: np.ndarray, F: np v1 = y.T.dot(z) / t - cov_mkt[:, None] * S roff1 = np.sum(v1 * cov_mkt[:, None].T) / var_mkt - np.sum(np.diag(v1) * cov_mkt) / var_mkt v3 = z.T.dot(z) / t - var_mkt * S - roff3 = ( - np.sum(v3 * np.outer(cov_mkt, cov_mkt)) / var_mkt**2 - np.sum(np.diag(v3) * cov_mkt**2) / var_mkt**2 - ) + roff3 = np.sum(v3 * np.outer(cov_mkt, cov_mkt)) / var_mkt**2 - np.sum(np.diag(v3) * cov_mkt**2) / var_mkt**2 roff = 2 * roff1 - roff3 rho = rdiag + roff diff --git a/qlib/utils/index_data.py b/qlib/utils/index_data.py index 715040538a..6c4525ce36 100644 --- a/qlib/utils/index_data.py +++ b/qlib/utils/index_data.py @@ -141,8 +141,8 @@ def _convert_type(self, item): elif isinstance(item, np.datetime64): # This happens often when creating index based on np.datetime64 and query with another precision return item.astype(self.idx_list.dtype) - # NOTE: It is hard to consider every case at first. - # We just try to cover part of cases to make it more user-friendly + # NOTE: It is hard to consider every case at first. + # We just try to cover part of cases to make it more user-friendly return item def index(self, item) -> int: