Threshold linear regression

Threshold regression means to do regression separately in different segments, as separated by some threshold. Take linear models as example, we have a response variable \(y\) and predictors \(X\), and additionally, we have a discriminator \(q\), which may be derived from \(X\), and set of transition functions \(g_i\). The model... [more]

Converting a DD-WRT router to OpenWRT

I have an old WiFi router (not my gateway, but that doesn’t matter) that used to be running DD-WRT and I am experimenting with the WiFi mesh or 802.11r roaming at home. Unfortunately the DD-WRT version is too old to do either of these – it was a Linux 2.4... [more]

Heat equation and Black-Scholes formula

It is well known for a long time that the quant finance borrowed a lot of results from physics. The notable Feynman-Kac formula is one example. In the case of vanilla European option pricing, the Black-Scholes formula gives the following result: [more]

Copying weight tensors from PyTorch to Tensorflow

Having build the same LSTM network using PyTorch and Tensorflow 2, this is an exercise on how to copy the trained model from one platform to another. While there may be issue arose from the floating point precisions mismatch between the two platforms, I believe the effect is usually not... [more]

Collinearlity, degrees of freedom and LSTM networks

There are many code samples on using LSTM networks for time series prediction. Rather than writing your own LSTM modules and gradient descent computations, usually we will use the off-the-shelf implementations from PyTorch or Tensorflow. Let’s look at a PyTorch model, from data preparation to evaluation: [more]