Making a Python trading system for MT. - page 12

 

http://www.thealgoengineer.com/2014/online_linear_regression_kalman_filter/

That's where it's going, I hope... or what's the point of the narratives

Online Linear Regression using a Kalman Filter
Online Linear Regression using a Kalman Filter
  • www.thealgoengineer.com
13 Aug 2014 • 5 min. read • Comments Linear regression is useful for many financial applications such as finding the hedge ratio between two assests in a pair trade. In a perfect world, the realtionship between assests would remain constant along with the slope and intercet of a linear regression. Unfortutanely this is usually the exception...
 
Maxim Dmitrievsky:

http://www.thealgoengineer.com/2014/online_linear_regression_kalman_filter/

That's where it's going, I hope... or what's the point of the narratives

Kalman is a bygone conclusion.

And the essence of narratives is nothing). I'm doing it for my own purposes at the moment. It's hard to get copies of it on the internet, had to figure it out myself, and if anyone needs it let them use it.

 
Yuriy Asaulenko:

Kalman is a bygone conclusion.

And the point of the narratives is nothing:) I'm on it now, and if anyone needs it let them use it. It's hard to find copies of it on the internet, I had to figure it out myself.

i don't know, i have a similar example with poly reg saved from somewhere, almost 1 in 1

and with kalman and lin. reg I don't get it... some unfinished article

import operator
import numpy as np
import matplotlib.pyplot as plt

from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.preprocessing import PolynomialFeatures

np.random.seed(0)
x = 2 - 3 * np.random.normal(0,1,20)
y = x - 2 * (x**2) + 0.5 * (x**3) - np.random.normal(-3,3,20)

#  transforming the data to include another axis
x = x[:, np.newaxis]
y = y[:, np.newaxis]

polynomial_features = PolynomialFeatures(degree=3)
x_poly = polynomial_features.fit_transform(x)
print(str (x_poly))

model = LinearRegression()
model.fit(x_poly, y)
y_pred = model.predict(x_poly)

rmse = np.sqrt(mean_squared_error(y,y_pred))
r2 = r2_score(y,y_pred)

print(rmse)
print(r2)

plt.scatter(x, y, s=10)
#  sort the values of x before line plot
sort_axis = operator.itemgetter(0)
sorted_zip = sorted(zip(x,y_pred), key=sort_axis)
x, y_pred = zip(*sorted_zip)
plt.plot(x, y_pred, color='r')
plt.show()
 
Maxim Dmitrievsky:

I don't know, I have a similar example with poly reg. saved from somewhere, almost 1 in 1

and with Kalman and lin. reg I don't get it... some unfinished article

It's always like this, when you need something, you can't find it.) And then it comes out of nowhere.)

Put a code instead of a picture, maybe? For the sake of argument, let it be.

 

For Alex, introdynamics in python.

install version 3.7 64 bit (I don't use anaconda and don't understand why you need it, it's probably for too smart people)

open a command line and type pip install catboost

this will install the catboost and give you a warning about what libs are missing

Another option is to pip install jupyter notebook (pip install jupyter notebook) or jupyter lab

Googling for more details is a good way to find out

 

Yura, you are, as always, desperately stupefying. You are comparing MA, i.e. the number at a particular point in time - the centre of the current probability distribution, with approximating functions :)))

I'd tell you off even more severely, like a child, but since you understand physics at least a little - I won't do that, otherwise the forum has already become a hoard of sellers of embarrassing signals - nothing to read.

Do you know the difference, or not?

 
Alexander_K2:

Yura, you are, as always, desperately stupefying. You are comparing MA, i.e. the number at a particular point in time - the centre of the current probability distribution, with approximating functions :)))

A_K, you are out of touch at all, don't understand what is going on, and mistake your stream of consciousness for reality. Things are not what they seem.)) In the context of the topic, your valuable remark makes no sense or meaning.

If you don't understand something, ask questions, although it's not certain you'll get an answer.

 
Maxim Dmitrievsky:

For Alex, introdynamics in python.

You need version 3.7 64 bit (I don't use anaconda and don't understand why you need it, it's probably for the too smart ones).

Alex, who's he?

Eustace Alex - I do not use anaconda.

Anaconda is useful not for smart but for lazy people)) - All you need (and a lot of extras,jupyter notebook, including) is available in one package. You don't need to do anything else, no strings of commands andpip install, - put it and forget about it.But, for those who are too smart, if you really want, you can use command line.)

 
Yuriy Asaulenko:

Alex is who?

Eustace Alex - I don't use an anaconda.

Anaconda is not for smart guys, it's for those who are lazy)) - You get everything you need (and a lot of unnecessary things,jupyter notebook, including) in one package. You don't need to do anything else, no strings of commands andpip install, - put it and forget about it.There is no need to do anything else, no command line, no install - just set it and forget it. But, for those who are too smart, if you really want, you can use the command line as well.)

well, alex with the chupacabra on his avatar.

I still need to update. Tensor Flow doesn't work yet on 3.7
 
Maxim Dmitrievsky:

Well, Alex with the chupacabra on his avatar.

Update still needs to be done. Tensor Flow doesn't work yet on 3.7

I'm lazy and uninterested. I'm lazy and not lazy and not a lazy person.)

By the way, anaconda has buttons - install and update.) Birdie put, press the button and let it think.)

PS speaking of updating. When upgrading Anaconda part of the packages updated and part rolled back, including Python from version 3.7.2 to 3.7.1.