IB量化博客


1 2 3 4 5 2 39


Quant

Forward Propagation In Neural Networks - Part I


By Varun Divakar

 

Quant

 

In this blog, we will intuitively understand how a neural network functions and the math behind it with the help of an example. In this example, we will be using a 3-layer network (with 2 input units, 2 hidden layer units, and 2 output units). The network and parameters (or weights) can be represented as follows.

Quant

Let us say that we want to train this neural network to predict whether the market will go up or down. For this, we assign two classes Class 0 and Class 1. Here, Class 0 indicates the datapoint where the market closes down, and conversely, Class 1 indicates that the market closes up. To make this prediction, a train data(X) consisting of two features x1, and x2. Here x1 represents the correlation between the close prices and the 10- day simple moving average (SMA) of close prices, and x2 refers to the difference between the close price and the 10-day SMA.

In this example below, the datapoint belongs to the class 1. The mathematical representation of the input data is as follows:

 

X = [x1, x2] = [0.85,.25] y= [1]

 

Example with two data points:

Quant

Quant

The output of the model is categorical or a discrete number. We need to convert this output data also into a matrix form. This enables the model to predict the probability of a datapoint belonging to different classes. When we make this matrix conversion, the columns represent the classes to which that example belongs, and the rows represent each of the input examples.

Quant

In the matrix y, the first column represents class 0 and second column represents class 1. Since our example belongs to the Class 1, we have 1 in the second column, and zero in the first.

Quant

This process of converting discrete/categorical classes to logical vectors/ matrix is called One Hot Encoding. We use one hot encoding as the neural network cannot operate on label data directly. They require all input variables and output variables to be numeric.

In a neural network, apart from the input variable we add a bias term to every layer other than the output layer. This bias term is a constant, mostly initialized to 1. The bias enables moving the activation threshold along the x-axis.

 

Quant

Quant

 

When the bias is negative the movement is made to the right side, and when the bias is positive the movement is made to the left side. So a biased neuron should be capable of learning even such input vectors that an unbiased neuron is not able to learn. In the dataset X, to introduce this bias we add a new column denoted by ones, as shown below.

 

Quant

Let us visualize the neural network, with the bias included in the input layer.

Quant

 

 

The second layer in the neural network is the hidden layer, which takes the outputs of the first layer as its input. The third layer is the output layer which gives the output of the neural network.

In the next post Varun will show us how to randomly initialize the weights or parameters for each of the neurons in the first layer.

 

To download the code in this article, visit QuantInsti website and the educational offerings at their Executive Programme in Algorithmic Trading (EPAT™).

This article is from QuantInsti and is being posted with QuantInsti’s permission. The views expressed in this article are solely those of the author and/or QuantInsti and IB is not endorsing or recommending any investment or trading discussed in the article. This material is for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IB to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


21523




Quant

Join IBKR for a Free Webinar with Sentieo: Optimize Your Research Process: Fight data overload and get the info you want - fast


Monday, December 10, 2018 12:00 EST

Register

 

Are you spending too much time searching for data in external and internal documents? In this webinar, we’ll show you how to cut your research time in half — from idea generation through idea/ company/ portfolio management. We’ll use the Sentieo research platform to show you how to:

  • review documents quickly
  • track an idea
  • build models
  • compile findings into an investment thesis
  • manage various theses

 

Sponsored by Sentieo

 

Information posted on IBKR Quant that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Quant are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results


21430




Quant

Too Much Arbitrage Contributes to Overreaction in Post Earnings Announcement Drift


A new financial research paper has been published and is related to all equity long short strategies but mainly to:
#33 - Post-Earnings Announcement Effect

Authors: Xiao Li

Title: Does Too Much Arbitrage Destablize Stock Price? Evidence from Short Selling and Post Earnings Announcement Drift.

Link: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3249254

Abstract:

Stein (2009) suggests that too much arbitrage capital exploiting underreaction can lead to overreaction, pushing price further away from fundamental value. I test this hypothesis by investigating the relation between changes in short interest ratio around earning announcement and the subsequent drift return. There are two main findings in this paper. First, my results suggest that too much arbitrage capital does contribute to overreaction (with a t-statistics around 4 on average). These findings are robust to alternative sample periods or length of the window for drift calculation. Second, contrary to the findings in prior literature that show that short sellers mitigate the magnitude of drift, my results show that almost all of this effect are actually contributed by the observations that are more likely to represent overreaction.

 

Quantpedia

 

To learn more about this paper, view the full article on Quantpedia website:
https://www.quantpedia.com/Blog/Details/too-much-arbitrage-contributes-to-overreaction-in-post-earnings-announcement-dr

About Quantpedia

Quantpedia Mission is to process financial academic research into a more user-friendly form to help anyone who seeks new quantitative trading strategy ideas. Quantpedia team consists of members with strong financial and mathematical background (former quantitative portfolio managers and founders of Quantconferences.com) combined with members with outstanding IT and technical knowledge. Learn more about Quantpedia here: https://quantpedia.com

This article is from Quantpedia and is being posted with Quantpedia’s permission. The views expressed in this article are solely those of the author and/or Quantpedia and IB is not endorsing or recommending any investment or trading discussed in the article. This material is for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IB to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


21429




Quant

The Hurst Exponent


By Varun Divakar and Ashish Garg

Quant

 

In this blog, we will be discussing an important concept in time series analysis: The Hurst exponent. We will learn how to calculate it with the help of an example. First, let us understand what Hurst exponent is.

Hurst Exponent Definition
The Hurst exponent is used as a measure of long-term memory of time series. It relates to the autocorrelations of the time series and the rate at which these decrease as the lag between pairs of values increases.

Hurst Value

Hurst Value is more than 0.5
If the Hurst value is more than 0.5 then it would indicate a persistent time series (roughly translates to a trending market).
Hurst Value is less than 0.5
If the Hurst Value is less than 0.5 then it can be considered as an anti-persistent time series (roughly translates to sideways market).
Hurst Value is 0.5
If the Hurst value is 0.5 then it would indicate a random walk or a market where prediction of future based on past data is not possible.

How To Calculate The Hurst Exponent
To calculate the Exponent, we need to divide the data into different chunks. For example, if you have the return data of BTC/USD for the past 8 days’ data, then you divide it into halves as follows:
Following the example of 8 observations for illustrative purposes only1:
Quant

1Length of the subseries in practical applications is usually much longer and affects the mean and standard deviation of the R/S statistic.

Then we divide the data into 3 different chinks as follows:

  1. Division 1 – one chunk of 8 observations
  2. Division 2 – two chunks of 4 observations each
  3. Division 3 – four chunks of 2 observations each

Quant

After dividing the data into chunks, we perform the following calculations on each chunk:

1. First we calculate the mean of the chunk, with say n observations,

.M = (1/n) [ h(1)+h(2)+...+h(n) ]

Quant

2. Then we calculate the standard deviation (S) of the n observations

s(n) = STD( h(1)+h(2)+...+h(n))

Quant

3. Then we create a mean centered series by subtracting the mean from the observations,

x(1) = h(1) – M
x(2) = h(2) – M
...
x(n) = h(n) - M

Quant

Then we calculate the cumulative deviation by summing up the mean centered values,

Y(1) = x(1)
Y(2) = x(1) + x(2)
...
Y(n) = x(1) + x(2) + ...+ x(n)

5. Next, we calculate the Range (R), which is the difference between the maximum value of the cumulative deviation and the minimum value of the cumulative deviation,

R(n) = MAX[Y(1),Y(2)...Y(n)] - MIN[Y(1),Y(2)...Y(n)]

6. And finally, we compute the ratio of the range R to the standard deviation S. This also known as the rescaled range.

Quant

Once we have the rescaled range for all the chunks, we compute the mean of each Division and note it along with the number of samples in each chunk of that Division as shown.

Quant

Quant

Next, we calculate the logarithmic values for the size of each region and for each region’s rescaled range.

Quant

The Hurst exponent ‘H’ is nothing but the slope of the plot of each range’s log(R/S) versus each range’s log(size). Here log(R/S) is the dependent or the y variable and log(size) is the independent or the x variable:

Quant

This Hurst exponent value is indicating that our data is a persistent one, but we have to keep in mind that our data set is too small to draw such a conclusion. For example, if you want to calculate Hurst exponent in Python using the ‘hurst’ library, it requires you to give at least 100 data points.

 

Disclaimer: All investments and trading in the stock market involve risk. Any decisions to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.

To download the code in this article, visit QuantInsti website and the educational offerings at their Executive Programme in Algorithmic Trading (EPAT™).

This article is from QuantInsti and is being posted with QuantInsti’s permission. The views expressed in this article are solely those of the author and/or QuantInsti and IB is not endorsing or recommending any investment or trading discussed in the article. This material is for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IB to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


21428




Quant

Alpha Architect - SEC Cybersecurity Requirements and Advisors


Webinar Recording

In case you missed it! Watch it on IBKR’s YouTube Channel:
 

https://youtu.be/jzjlbxD0Mw8

 

Cybersecurity

 

In this webinar, Patrick Cleary will demystify the world of cybersecurity and provide actionable next steps for financial advisors looking to implement a best in class cybersecurity program. He will outline what resources are available, how to get started writing a cybersecurity manual, and what regulators will be looking for when an examination occurs. Most importantly, Patrick will highlight several low cost action items that many Advisors can do themselves to build a robust program from scratch.

 

Speaker: Patrick, R. Cleary, Alpha Architect

Sponsored by:   Alpha Architect

 

Information posted on IBKR Quant that is provided by third-parties and not by Interactive Brokers does NOT constitute a recommendation by Interactive Brokers that you should contract for the services of that third party. Third-party participants who contribute to IBKR Quant are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results


21407




1 2 3 4 5 2 39

披露

感谢您给予我们反馈。如您有任何关于IB量化博客的问题或意见,请联系ibkrquant@ibkr.com

IBKR量化博客上提供的材料(包括文章与点评)仅供参考。此等材料不代表盈透证券(IB)推荐您或您的客户采用任何在IBKR量化博客上发布内容的独立顾问、对冲基金或其他实体之服务或在此类个人/实体处投资,也不代表盈透证券推荐您在任何顾问或对冲基金处投资。在IBKR量化博客上发布内容的顾问、对冲基金及其他分析师独立于IB,IB不就此等顾问、对冲基金及其他个人/实体的历史及未来业绩、或其提供的信息的准确性做任何称述与担保。盈透证券不会开展“适合性审查”来确保任意顾问、对冲基金或其他个人/实体的交易适合您。

IB量化博客上提及的证券或其他金融产品并不适合所有投资者。发布的材料并未考虑您特定的投资目标、财务状况或需求,也不构成任意证券、金融产品或策略之推荐。在进行任意投资或交易前,您应考虑该投资或交易是否适合您特定的情况,且在必要时寻求专业建议。过去的业绩不保证将来的业绩。

任何第三方提供的信息均来自我们认为可靠及准确的来源;然而,IB不担保其准确性且不对任何错误或遗漏承担责任。

盈透或其关联公司的雇员发布的任何信息基于一般认为的真实可信的信息。然而,IB及其关联公司无法保证信息的完整性、准确性或适当性。IB不对任何金融产品过去或将来的表现作出任何声明或担保。在IB量化博客上发布内容不代表IB认为特定的金融产品或交易策略适合您。