Commit e48b30d2 authored by Dr.李's avatar Dr.李

modified tests

parent 00c100f3
# -*- coding: utf-8 -*-
"""
Created on 2017-4-26
@author: cheng.li
"""
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on 2017-4-26
@author: cheng.li
"""
import numpy as np
def rank_build(er: np.ndarray, use_rank: int, groups: np.ndarray=None):
if groups is not None:
pass
else:
ordering = np.argsort(er)
if __name__ == '__main__':
x = np.random.randn(3000)
......@@ -25,7 +25,7 @@ class TestStandardize(unittest.TestCase):
def test_standardize_with_group(self):
x = np.random.randn(3000, 10)
groups = np.random.randint(30, size=3000)
groups = np.random.randint(10, 30, size=3000)
calc_zscore = standardize(x, groups)
exp_zscore = pd.DataFrame(x).groupby(groups).transform(lambda s: (s - s.mean(axis=0)) / s.std(axis=0))
......
......@@ -37,7 +37,7 @@ class TestWinsorize(unittest.TestCase):
def test_winsorize_normal_with_group(self):
num_stds = 2
x = np.random.randn(3000, 10)
groups = np.random.randint(30, size=3000)
groups = np.random.randint(10, 30, size=3000)
cal_winsorized = winsorize_normal(x, num_stds, groups)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment