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
1d5dac73
Commit
1d5dac73
authored
Feb 08, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added model composer api
parent
6e2b07e7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
api.py
alphamind/api.py
+8
-0
composer.py
alphamind/model/composer.py
+8
-10
No files found.
alphamind/api.py
View file @
1d5dac73
...
...
@@ -43,6 +43,10 @@ from alphamind.model import load_model
from
alphamind.model.data_preparing
import
fetch_data_package
from
alphamind.model.data_preparing
import
fetch_train_phase
from
alphamind.model.data_preparing
import
fetch_predict_phase
from
alphamind.model.composer
import
ModelComposer
from
alphamind.model.composer
import
DataMeta
from
alphamind.model.composer
import
train_model
from
alphamind.model.composer
import
predict_by_model
from
alphamind.execution.naiveexecutor
import
NaiveExecutor
from
alphamind.execution.thresholdexecutor
import
ThresholdExecutor
...
...
@@ -79,6 +83,10 @@ __all__ = [
'fetch_data_package'
,
'fetch_train_phase'
,
'fetch_predict_phase'
,
'ModelComposer'
,
'DataMeta'
,
'train_model'
,
'predict_by_model'
,
'LinearRegression'
,
'LassoRegression'
,
'ConstLinearModel'
,
...
...
alphamind/model/composer.py
View file @
1d5dac73
...
...
@@ -7,20 +7,18 @@ Created on 2017-9-27
import
copy
import
bisect
from
typing
import
Union
from
typing
import
Iterable
import
pandas
as
pd
from
alphamind.model.modelbase
import
ModelBase
from
alphamind.model.data_preparing
import
fetch_train_phase
from
alphamind.model.data_preparing
import
fetch_predict_phase
from
alphamind.data.transformer
import
Transformer
from
alphamind.data.engines.universe
import
Universe
from
alphamind.data.engines.sqlengine
import
SqlEngine
class
DataMeta
(
object
):
def
__init__
(
self
,
engine
,
freq
:
str
,
universe
:
Universe
,
batch
:
int
,
...
...
@@ -28,8 +26,9 @@ class DataMeta(object):
risk_model
:
str
=
'short'
,
pre_process
:
Iterable
[
object
]
=
None
,
post_process
:
Iterable
[
object
]
=
None
,
warm_start
:
int
=
0
):
self
.
engine
=
engine
warm_start
:
int
=
0
,
data_source
:
str
=
None
):
self
.
engine
=
SqlEngine
(
data_source
)
self
.
alpha_model
=
alpha_model
self
.
freq
=
freq
self
.
universe
=
universe
...
...
@@ -124,10 +123,9 @@ if __name__ == '__main__':
from
alphamind.data.standardize
import
standardize
from
alphamind.data.winsorize
import
winsorize_normal
from
alphamind.data.engines.sqlengine
import
industry_styles
from
alphamind.data.engines.sqlengine
import
SqlEngine
from
alphamind.model.linearmodel
import
ConstLinearModel
engine
=
SqlEngine
(
"postgres+psycopg2://postgres:we083826@localhost/alpha"
)
data_source
=
"postgres+psycopg2://postgres:we083826@localhost/alpha"
alpha_model
=
ConstLinearModel
([
'EPS'
],
np
.
array
([
1.
]))
alpha_factors
=
[
'EPS'
]
freq
=
'1w'
...
...
@@ -138,14 +136,14 @@ if __name__ == '__main__':
pre_process
=
[
winsorize_normal
,
standardize
]
pos_process
=
[
winsorize_normal
,
standardize
]
data_meta
=
DataMeta
(
engine
,
freq
,
data_meta
=
DataMeta
(
freq
,
universe
,
batch
,
neutralized_risk
,
risk_model
,
pre_process
,
pos_process
)
pos_process
,
data_source
=
data_source
)
composer
=
ModelComposer
(
alpha_model
,
data_meta
)
...
...
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