Book Image

Mastering Python for Finance

Book Image

Mastering Python for Finance

Overview of this book

Table of Contents (17 chapters)
Mastering Python for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Discussion of algorithms in backtesting


After taking into consideration the designing of a backtesting model, one or more algorithms may be used to improve the model on a continuous basis. This section briefly covers some of the algorithmic techniques used in areas of backtesting, such as data mining and machine learning.

K-means clustering

The k-means clustering algorithm is a method of clustering analysis in data mining. From the backtest results of n observations, the k-means algorithm is designed to classify the data into k clusters based on their relative distance from each other. The center point of each cluster is computed. The objective then is to find the within-cluster sum of squares that gives us a model averaged point. The model averaged point indicates the likely average performance of the model, which can be used for further comparison with the performance of other models.

K-nearest neighbor machine learning algorithm

The k-nearest neighbor (KNN) is a lazy learning technique that...