13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

238

lr_model.predict(X_test),

color=’black’,

linewidth=1.0

)

plt.xlabel("X")

plt.ylabel("y")

plt.show()

Figure 17.2: Plot of the test data x i vs y i values, overlaid with point-estimated line of best fit.

In subsequent chapters similar examples will be utilised for various machine learning techniques

such as Random Forests, Support Vector Machines and Boosted Trees. It will be shown

that the API for fitting such models is very similar to the above, making it extremely straightforward

to test new ML models in a rapid research-oriented manner.

17.5 Full Code

# lin_reg_distribution_plot.py

from matplotlib import cm

from matplotlib.ticker import LinearLocator, FormatStrFormatter

import matplotlib.pyplot as plt

from mpl_toolkits.mplot3d import Axes3D

import numpy as np

from scipy.stats import norm

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!