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
90291216
Commit
90291216
authored
Nov 23, 2017
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug for linear regression model
parent
06b87635
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
api.py
alphamind/api.py
+2
-0
train_one_day_model.py
alphamind/examples/train_one_day_model.py
+38
-0
No files found.
alphamind/api.py
View file @
90291216
...
@@ -27,6 +27,7 @@ from alphamind.model.linearmodel import LinearRegression
...
@@ -27,6 +27,7 @@ from alphamind.model.linearmodel import LinearRegression
from
alphamind.model.linearmodel
import
ConstLinearModel
from
alphamind.model.linearmodel
import
ConstLinearModel
from
alphamind.model.loader
import
load_model
from
alphamind.model.loader
import
load_model
from
alphamind.model.data_preparing
import
fetch_data_package
from
alphamind.model.data_preparing
import
fetch_data_package
from
alphamind.model.data_preparing
import
fetch_train_phase
from
alphamind.execution.naiveexecutor
import
NaiveExecutor
from
alphamind.execution.naiveexecutor
import
NaiveExecutor
from
alphamind.execution.thresholdexecutor
import
ThresholdExecutor
from
alphamind.execution.thresholdexecutor
import
ThresholdExecutor
...
@@ -75,6 +76,7 @@ __all__ = [
...
@@ -75,6 +76,7 @@ __all__ = [
'neutralize'
,
'neutralize'
,
'factor_tables'
,
'factor_tables'
,
'fetch_data_package'
,
'fetch_data_package'
,
'fetch_train_phase'
,
'LinearRegression'
,
'LinearRegression'
,
'ConstLinearModel'
,
'ConstLinearModel'
,
'load_model'
,
'load_model'
,
...
...
alphamind/examples/train_one_day_model.py
0 → 100644
View file @
90291216
# -*- coding: utf-8 -*-
"""
Created on 2017-11-8
@author: cheng.li
"""
from
alphamind.api
import
*
ref_date
=
'2017-11-21'
universe_name
=
[
'zz500'
,
'hs300'
]
universe
=
Universe
(
universe_name
,
universe_name
)
frequency
=
'5b'
batch
=
8
neutralize_risk
=
[
'SIZE'
]
+
industry_styles
engine
=
SqlEngine
()
linear_model_features
=
[
'eps_q'
,
'roe_q'
,
'BDTO'
,
'CFinc1'
,
'CHV'
,
'IVR'
,
'VAL'
,
'GREV'
]
training_data
=
fetch_train_phase
(
engine
,
linear_model_features
,
ref_date
,
frequency
,
universe
,
batch
,
neutralize_risk
,
pre_process
=
[
winsorize_normal
,
standardize
],
post_process
=
[
winsorize_normal
,
standardize
],
warm_start
=
batch
)
model
=
LinearRegression
(
linear_model_features
,
fit_intercept
=
False
)
x
=
training_data
[
'train'
][
'x'
]
y
=
training_data
[
'train'
][
'y'
]
.
flatten
()
model
.
fit
(
x
,
y
)
print
(
model
.
impl
.
coef_
)
\ 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