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
80748343
Commit
80748343
authored
Jan 11, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added update special tables
parent
a6e9e0c8
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
488 additions
and
164 deletions
+488
-164
formula_expression.py
alphamind/examples/formula_expression.py
+10
-12
candidate_prod_model_20171204.ipynb
notebooks/candidate_prod_model_20171204.ipynb
+4
-2
model_comparing.ipynb
notebooks/model_comparing.ipynb
+211
-101
model_comparing_classifiers.ipynb
notebooks/model_comparing_classifiers.ipynb
+263
-49
No files found.
alphamind/examples/formula_expression.py
View file @
80748343
...
...
@@ -17,25 +17,24 @@ import datetime as dt
start
=
dt
.
datetime
.
now
()
universe
_name
=
'zz500'
universe
=
Universe
(
'custom'
,
[
'zz800'
])
factor_name
=
'PE'
expression
=
1.
/
LAST
(
factor_name
)
simple_expression
=
CSRes
(
LAST
(
'OperCashInToAsset'
),
'roe_q'
)
alpha_factor_name
=
'
1/PE
'
alpha_factor
=
{
alpha_factor_name
:
expression
}
alpha_factor_name
=
'
alpha_factor
'
alpha_factor
=
{
alpha_factor_name
:
simple_
expression
}
# end of formula definition
engine
=
SqlEngine
(
'postgresql+psycopg2://postgres:A12345678!@10.63.6.220/alpha'
)
universe
=
Universe
(
'custom'
,
[
universe_name
])
neutralize_risk
=
[
'SIZE'
]
+
industry_styles
freq
=
'
5
b'
neutralize_risk
=
[
'SIZE'
,
'LEVERAGE'
]
+
industry_styles
freq
=
'
10
b'
n_bins
=
5
horizon
=
map_freq
(
freq
)
start_date
=
'2012-01-01'
end_date
=
'201
7-11-21
'
end_date
=
'201
8-01-05
'
dates
=
makeSchedule
(
start_date
,
end_date
,
...
...
@@ -93,10 +92,9 @@ df = df.cumsum().plot(ax=axes[0], title='Quantile Analysis for {0}'.format(alpha
# =================================================================== #
factor_name
=
'PE'
expression
=
DIFF
(
1.
/
LAST
(
factor_name
))
alpha_factor_name
=
'1/PE
_1w_diff'
alpha_factor
=
{
alpha_factor_name
:
expression
}
alpha_factor_name
=
alpha_factor_name
+
'
_1w_diff'
alpha_factor
=
{
alpha_factor_name
:
DIFF
(
simple_expression
)
}
dates
=
makeSchedule
(
start_date
,
end_date
,
...
...
notebooks/candidate_prod_model_20171204.ipynb
View file @
80748343
...
...
@@ -24,7 +24,9 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\"\"\"\n",
...
...
@@ -517,7 +519,7 @@
" risk = train_risk[ref_date][:, 1:]\n",
" new_x = cross_product(x, risk)\n",
"\n",
" model = LinearRegression(features=linear_model_features_keys, fit_intercept=True) # n_jobs=8, min_samples_split=20)\n",
"
#
model = LinearRegression(features=linear_model_features_keys, fit_intercept=True) # n_jobs=8, min_samples_split=20)\n",
" model = LassoRegression(alpha=0.01, features=linear_model_features_keys, fit_intercept=True) # n_jobs=8, min_samples_split=20)\n",
" model.fit(new_x, y)\n",
" models_series.loc[ref_date] = model\n",
...
...
notebooks/model_comparing.ipynb
View file @
80748343
This diff is collapsed.
Click to expand it.
notebooks/model_comparing_classifiers.ipynb
View file @
80748343
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