Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
e48b30d2
Commit
e48b30d2
authored
Apr 26, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified tests
parent
00c100f3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
__init__.py
alphamind/portfolio/__init__.py
+6
-0
rankbuilder.py
alphamind/portfolio/rankbuilder.py
+20
-0
test_standardize.py
alphamind/tests/test_standardize.py
+1
-1
test_winsorize.py
alphamind/tests/test_winsorize.py
+1
-1
No files found.
alphamind/portfolio/__init__.py
View file @
e48b30d2
# -*- coding: utf-8 -*-
"""
Created on 2017-4-26
@author: cheng.li
"""
\ No newline at end of file
alphamind/portfolio/rankbuilder.py
0 → 100644
View file @
e48b30d2
# -*- 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
)
alphamind/tests/test_standardize.py
View file @
e48b30d2
...
...
@@ -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
))
...
...
alphamind/tests/test_winsorize.py
View file @
e48b30d2
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment