Time Series Analysis with Python
With Applications of Machine Learning Algorithms
Session by Dr. Yves J. Hilpisch | The Python Quants GmbH
Hyderabad, 07. October 2017
| import dash | |
| import dash_core_components as dcc | |
| import dash_html_components as html | |
| import plotly.graph_objs as go | |
| import pandas as pd | |
| app = dash.Dash() | |
| df = pd.read_csv( | |
| 'https://gist.githubusercontent.com/chriddyp/' |
| """Reactive expressions for Dash! | |
| Dash[1] is an interesting project build reactive web applications in Python. | |
| While the ideas are exciting, the syntax for specifying custom code is way | |
| too complicated that it should be. | |
| Here is a sample code to display sum of two input values. | |
| @app.callback( | |
| [Input(component_id='x', component_property='value')] |
| # standard library | |
| import os | |
| # dash libs | |
| import dash | |
| from dash.dependencies import Input, Output | |
| import dash_core_components as dcc | |
| import dash_html_components as html | |
| import plotly.figure_factory as ff | |
| import plotly.graph_objs as go |
| import numpy as np | |
| EPSILON = 1e-10 | |
| def _error(actual: np.ndarray, predicted: np.ndarray): | |
| """ Simple error """ | |
| return actual - predicted |
| @import url('https://fonts.googleapis.com/css?family=Goudy+Bookletter+1911|Inconsolata|Lora|Slabo+27px|Song+Myung|Source+Serif+Pro|Roboto Mono'); | |
| * { | |
| -webkit-box-sizing: border-box; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Source Serif Pro', Lora, 'Slabo 27px', 'Goudy Bookletter 1911', serif; | |
| line-height: 1.4em; |
| def coskew(df): | |
| # Number of stocks | |
| num = len(df.columns) | |
| # Two dimionsal matrix for tensor product | |
| mtx = np.zeros(shape = (len(df), num**2)) | |
| v = df.values | |
| means = v.mean(0,keepdims=True) |