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
7b72cb5a
Commit
7b72cb5a
authored
Apr 30, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more
parent
b9d2a972
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
721 additions
and
708 deletions
+721
-708
.gitignore
.gitignore
+9
-2
__init__.py
alphamind/__init__.py
+6
-6
aggregate.pyx
alphamind/aggregate.pyx
+256
-256
benchmarks.py
alphamind/benchmarks/benchmarks.py
+47
-47
neutralize.py
alphamind/benchmarks/data/neutralize.py
+41
-41
standardize.py
alphamind/benchmarks/data/standardize.py
+62
-62
winsorize.py
alphamind/benchmarks/data/winsorize.py
+87
-87
__init__.py
alphamind/benchmarks/portfolio/__init__.py
+5
-5
rankbuild.py
alphamind/benchmarks/portfolio/rankbuild.py
+76
-76
__init__.py
alphamind/benchmarks/settlement/__init__.py
+5
-5
simplesettle.py
alphamind/benchmarks/settlement/simplesettle.py
+70
-70
__init__.py
alphamind/data/__init__.py
+6
-6
neutralize.py
alphamind/data/neutralize.py
+51
-45
No files found.
.gitignore
View file @
7b72cb5a
*.pyc
*.pyc
.idea/*
.idea/*
build/*
dist/*
Alpha_Mind.egg-info/*
*.pyd
*.c
*.cpp
*.html
alphamind/__init__.py
View file @
7b72cb5a
alphamind/aggregate.pyx
View file @
7b72cb5a
alphamind/benchmarks/benchmarks.py
View file @
7b72cb5a
alphamind/benchmarks/data/neutralize.py
View file @
7b72cb5a
alphamind/benchmarks/data/standardize.py
View file @
7b72cb5a
alphamind/benchmarks/data/winsorize.py
View file @
7b72cb5a
alphamind/benchmarks/portfolio/__init__.py
View file @
7b72cb5a
alphamind/benchmarks/portfolio/rankbuild.py
View file @
7b72cb5a
alphamind/benchmarks/settlement/__init__.py
View file @
7b72cb5a
alphamind/benchmarks/settlement/simplesettle.py
View file @
7b72cb5a
alphamind/data/__init__.py
View file @
7b72cb5a
alphamind/data/neutralize.py
View file @
7b72cb5a
...
@@ -7,10 +7,11 @@ Created on 2017-4-25
...
@@ -7,10 +7,11 @@ Created on 2017-4-25
import
numpy
as
np
import
numpy
as
np
from
numpy.linalg
import
solve
from
numpy.linalg
import
solve
from
typing
import
Tuple
from
alphamind.aggregate
import
groupby
from
alphamind.aggregate
import
groupby
def
neutralize
(
x
:
np
.
ndarray
,
y
:
np
.
ndarray
,
groups
:
np
.
ndarray
=
None
)
->
np
.
ndarray
:
def
neutralize
(
x
:
np
.
ndarray
,
y
:
np
.
ndarray
,
groups
:
np
.
ndarray
=
None
)
->
Tuple
[
np
.
ndarray
,
np
.
ndarray
]:
if
groups
is
not
None
:
if
groups
is
not
None
:
res
=
np
.
zeros
(
y
.
shape
)
res
=
np
.
zeros
(
y
.
shape
)
groups_ids
=
groupby
(
groups
)
groups_ids
=
groupby
(
groups
)
...
@@ -36,10 +37,15 @@ def ls_res(x: np.ndarray, y: np.ndarray, b: np.ndarray) -> np.ndarray:
...
@@ -36,10 +37,15 @@ def ls_res(x: np.ndarray, y: np.ndarray, b: np.ndarray) -> np.ndarray:
return
y
-
x
@
b
return
y
-
x
@
b
def
ls_explained
(
x
:
np
.
ndarray
,
y
:
np
.
ndarray
,
b
:
np
.
ndarray
)
->
np
.
ndarray
:
pass
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
x
=
np
.
random
.
randn
(
3000
,
3
)
x
=
np
.
random
.
randn
(
3000
,
3
)
y
=
np
.
random
.
randn
(
3000
,
2
)
y
=
np
.
random
.
randn
(
3000
,
2
)
groups
=
np
.
random
.
randint
(
30
,
size
=
3000
)
groups
=
np
.
random
.
randint
(
30
,
size
=
3000
)
print
(
neutralize
(
x
,
y
,
groups
))
b
=
ls_fit
(
x
,
y
)
\ No newline at end of file
ls_explained
(
x
,
y
,
b
)
\ No newline at end of file
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