Commit 62f5ccf7 authored by Dr.李's avatar Dr.李

try disable jit to make coveralls work

parent 5e369db0
......@@ -42,9 +42,10 @@ install:
- pip install simpleutils
- pip install coveralls
script:
- python setup.py build_ext --inplace
- coverage run alphamind/tests/test_suite.py
- coverage report
- coverage html
- export NUMBA_DISABLE_JIT=1
- python setup.py build_ext --line_trace --inplace
- coverage run --rcfile=./.coveragerc alphamind/tests/test_suite.py
- coverage report --rcfile=./.coveragerc -i
- coverage html --rcfile=./.coveragerc -i
after_success:
coveralls
- coveralls
......@@ -22,13 +22,3 @@ def standardize(x: np.ndarray, groups: np.ndarray=None, ddof=1) -> np.ndarray:
return (x - mean_values) / std_values
else:
return (x - simple_mean(x, axis=0)) / simple_std(x, axis=0)
if __name__ == '__main__':
import pandas as pd
df = pd.read_csv('d:/test_data.csv', index_col=0)
x = df.values
groups = df.index.values.astype(int)
standardize(x, groups)
......@@ -63,15 +63,3 @@ def winsorize_normal(x: np.ndarray, num_stds: int = 3, groups: np.ndarray = None
mean_values = simple_mean(x, axis=0)
res = mask_values_1d(x, mean_values, std_values, num_stds)
return res
if __name__ == '__main__':
x = np.random.randn(3000, 10)
groups = np.random.randint(0, 20, size=3000)
import datetime as dt
start = dt.datetime.now()
for _ in range(3000):
winsorize_normal(x, 2, groups)
print(dt.datetime.now() - start)
......@@ -43,17 +43,3 @@ def linear_build(er: np.ndarray,
prob = cvxpy.Problem(objective, constraints)
prob.solve(solver=solver)
return prob.status, prob.value, np.array(w.value).flatten()
if __name__ == '__main__':
er = np.arange(300)
bm = np.ones(300) * 0.00333333333
risk_exposure = np.random.randn(300, 10)
s, v, x = linear_build(er, 0., 0.01, risk_exposure, bm, (-0.01*np.ones(10), 0.01*np.ones(10)))
print(s)
print(x.sum())
print(x.min(), ',', x.max())
print((x - bm) @ risk_exposure)
......@@ -46,4 +46,3 @@ def percent_build(er: np.ndarray, percent: float, groups: np.ndarray=None) -> np
use_rank = int(percent * len(neg_er))
set_value(weights, ordering[:use_rank], 1.)
return weights
......@@ -42,14 +42,3 @@ def rank_build(er: np.ndarray, use_rank: int, groups: np.ndarray=None) -> np.nda
ordering = neg_er.argsort(axis=0)
set_value(weights, ordering[:use_rank], 1.)
return weights
if __name__ == '__main__':
n_sample = 6
n_groups = 3
x = np.random.randn(n_sample)
groups = np.array([1, 1, 2, 1, 0, 2])
print(groups)
print(groupby(groups))
print(rank_build(x, 1, groups))
\ No newline at end of file
......@@ -24,11 +24,3 @@ def simple_settle(weights: np.ndarray, ret_series: np.ndarray, groups: np.ndarra
if ret_mat.ndim == 1:
ret_mat = ret_mat.reshape((-1, 1))
return simple_sum(ret_mat, axis=0)
if __name__ == '__main__':
from alphamind.aggregate import group_mapping_test
s = np.random.randint(2, 5, size=6)
print(s)
print(group_mapping_test(s))
\ No newline at end of file
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