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
91f70b4e
Commit
91f70b4e
authored
May 03, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the performance of winsorize
parent
2990e8c3
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
153 deletions
+142
-153
aggregate.py
alphamind/aggregate.py
+7
-6
benchmarks.py
alphamind/benchmarks/benchmarks.py
+24
-24
factor analysis.ipynb
notebooks/factor analysis.ipynb
+111
-123
No files found.
alphamind/aggregate.py
View file @
91f70b4e
...
@@ -75,16 +75,18 @@ def agg_std(groups, x, ddof=1):
...
@@ -75,16 +75,18 @@ def agg_std(groups, x, ddof=1):
@
nb
.
njit
@
nb
.
njit
def
set_value
(
groups
,
source
,
destinantion
):
def
copy_value
(
groups
,
source
):
length
,
width
=
destinantion
.
shape
length
=
groups
.
shape
[
0
]
width
=
source
.
shape
[
1
]
destination
=
np
.
zeros
((
length
,
width
))
for
i
in
range
(
length
):
for
i
in
range
(
length
):
k
=
groups
[
i
]
k
=
groups
[
i
]
for
j
in
range
(
width
):
for
j
in
range
(
width
):
destinantion
[
i
,
j
]
=
source
[
k
,
j
]
destination
[
i
,
j
]
=
source
[
k
,
j
]
return
destination
def
transform
(
groups
,
x
,
func
):
def
transform
(
groups
,
x
,
func
):
res
=
np
.
zeros_like
(
x
)
if
func
==
'mean'
:
if
func
==
'mean'
:
value_data
=
agg_mean
(
groups
,
x
)
value_data
=
agg_mean
(
groups
,
x
)
...
@@ -97,8 +99,7 @@ def transform(groups, x, func):
...
@@ -97,8 +99,7 @@ def transform(groups, x, func):
else
:
else
:
raise
ValueError
(
'({0}) is not recognized as valid functor'
.
format
(
func
))
raise
ValueError
(
'({0}) is not recognized as valid functor'
.
format
(
func
))
set_value
(
groups
,
value_data
,
res
)
return
copy_value
(
groups
,
value_data
)
return
res
def
aggregate
(
groups
,
x
,
func
):
def
aggregate
(
groups
,
x
,
func
):
...
...
alphamind/benchmarks/benchmarks.py
View file @
91f70b4e
...
@@ -19,33 +19,33 @@ from alphamind.benchmarks.settlement.simplesettle import benchmark_simple_settle
...
@@ -19,33 +19,33 @@ from alphamind.benchmarks.settlement.simplesettle import benchmark_simple_settle
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
#
benchmark_neutralize(3000, 10, 1000)
benchmark_neutralize
(
3000
,
10
,
1000
)
#
benchmark_neutralize_with_groups(3000, 10, 1000, 30)
benchmark_neutralize_with_groups
(
3000
,
10
,
1000
,
30
)
#
benchmark_neutralize(30, 3, 50000)
benchmark_neutralize
(
30
,
3
,
50000
)
#
benchmark_neutralize_with_groups(30, 3, 50000, 3)
benchmark_neutralize_with_groups
(
30
,
3
,
50000
,
3
)
#
benchmark_neutralize(50000, 50, 20)
benchmark_neutralize
(
50000
,
50
,
20
)
#
benchmark_neutralize_with_groups(50000, 50, 20, 50)
benchmark_neutralize_with_groups
(
50000
,
50
,
20
,
50
)
#
benchmark_standardize(3000, 10, 1000)
benchmark_standardize
(
3000
,
10
,
1000
)
#
benchmark_standardize_with_group(3000, 10, 1000, 30)
benchmark_standardize_with_group
(
3000
,
10
,
1000
,
30
)
# benchmark_standardize(3
0, 10, 50000)
benchmark_standardize
(
10
0
,
10
,
50000
)
# benchmark_standardize_with_group(30, 10, 5000, 5
)
benchmark_standardize_with_group
(
100
,
10
,
5000
,
4
)
#
benchmark_standardize(50000, 50, 20)
benchmark_standardize
(
50000
,
50
,
20
)
#
benchmark_standardize_with_group(50000, 50, 20, 50)
benchmark_standardize_with_group
(
50000
,
50
,
20
,
50
)
benchmark_winsorize_normal
(
3000
,
10
,
1000
)
benchmark_winsorize_normal
(
3000
,
10
,
1000
)
benchmark_winsorize_normal_with_group
(
3000
,
10
,
1000
,
30
)
benchmark_winsorize_normal_with_group
(
3000
,
10
,
1000
,
30
)
benchmark_winsorize_normal
(
30
,
10
,
50000
)
benchmark_winsorize_normal
(
30
,
10
,
50000
)
benchmark_winsorize_normal_with_group
(
30
,
10
,
5000
,
5
)
benchmark_winsorize_normal_with_group
(
30
,
10
,
5000
,
5
)
benchmark_winsorize_normal
(
50000
,
50
,
20
)
benchmark_winsorize_normal
(
50000
,
50
,
20
)
benchmark_winsorize_normal_with_group
(
50000
,
50
,
20
,
50
)
benchmark_winsorize_normal_with_group
(
50000
,
50
,
20
,
50
)
#
benchmark_build_rank(3000, 1000, 300)
benchmark_build_rank
(
3000
,
1000
,
300
)
#
benchmark_build_rank_with_group(3000, 1000, 10, 30)
benchmark_build_rank_with_group
(
3000
,
1000
,
10
,
30
)
#
benchmark_build_rank(30, 50000, 3)
benchmark_build_rank
(
30
,
50000
,
3
)
#
benchmark_build_rank_with_group(30, 50000, 1, 3)
benchmark_build_rank_with_group
(
30
,
50000
,
1
,
3
)
#
benchmark_build_rank(50000, 20, 3000)
benchmark_build_rank
(
50000
,
20
,
3000
)
#
benchmark_build_rank_with_group(50000, 20, 10, 300)
benchmark_build_rank_with_group
(
50000
,
20
,
10
,
300
)
#
benchmark_simple_settle(3000, 10, 1000)
benchmark_simple_settle
(
3000
,
10
,
1000
)
#
benchmark_simple_settle_with_group(3000, 10, 1000, 30)
benchmark_simple_settle_with_group
(
3000
,
10
,
1000
,
30
)
#
benchmark_simple_settle(30, 10, 50000)
benchmark_simple_settle
(
30
,
10
,
50000
)
#
benchmark_simple_settle_with_group(30, 10, 50000, 5)
benchmark_simple_settle_with_group
(
30
,
10
,
50000
,
5
)
#
benchmark_simple_settle(50000, 50, 20)
benchmark_simple_settle
(
50000
,
50
,
20
)
#
benchmark_simple_settle_with_group(50000, 50, 20, 50)
benchmark_simple_settle_with_group
(
50000
,
50
,
20
,
50
)
notebooks/factor analysis.ipynb
View file @
91f70b4e
This diff is collapsed.
Click to expand it.
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