Neural networks: linear regression, stacked and bent

On this page
  1. One unit is a weighted sum, then a bend
  2. Without the bend, the stack is one straight line
  3. Fitting: walk the weights downhill on the squared error
  4. A network with room to spare learns the noise too
  5. Three brakes: a weight penalty, stopping early, dropout
  6. When a network is the wrong tool
  7. Check yourself
  8. Traps
  9. The code
  10. Summary
  11. References

A neural networkA model that takes a set of input variables and builds a nonlinear function of them to predict the answer. sounds like a new kind of model, with neurons and layers and its own vocabulary. Underneath, its pieces are ones this blog has already used. Each unit of a layer is the weighted sum from linear regression, followed by one fixed function that bends it. The network’s output is one more linear regressionA simple method that predicts a numeric answer by assuming a straight-line relationship between the inputs and the answer., fitted on those bent values. That small step, the bend, is the whole difference between a network and a straight line, and this post is about what it buys and what it costs.

The running example is the one from the linear regression post: predict next month’s volatilityHow much an asset's price spikes and dips; most often measured as the standard deviation of its per-period returns. (how much a price will swing over the next 20 trading days, in % a year) for SPY, NVDA, GS, XOM and GLD, from seven featuresAn input variable a model uses to make its prediction; also called a predictor or an independent variable. computed from prices up to today. Training uses 2020 to 2022, the year 2023 is held out to choose settings, and 2024 to October 2025 is the test, used once at the end. Every model is scored by its RMSEThe square root of the mean squared error. (root mean squared error, the typical size of a miss, in the same points of % a year as the target; see Scoring a model).

One unit is a weighted sum, then a bend

ISLP builds a single-layer network in two steps (section 10.1). First, each of KK hidden unitsOne unit inside a neural network: a weighted sum of its inputs, passed through an activation function. Its value is never observed in the data. takes its own weighted sum of the pp features and passes it through an activation functionA nonlinear function inside a neural network that is chosen in advance, not learned., “a nonlinear activation function that is specified in advance”:

h, what hidden unit k outputs

hk=g(wk0+wk1x1+⋯+wkpxp)\key{h_k} = g\left(w_{k0} + w_{k1} x_1 + \dots + w_{kp} x_p\right)

Here x1x_1 to xpx_p are the features of one row, wk1w_{k1} to wkpw_{kp} are unit kk‘s weights, wk0w_{k0} is its bias (a constant added to the sum, so the unit can shift where it bends), and gg is the activation. The modern default is the ReLUAn activation function that keeps a positive number and turns a negative one into zero. (rectified linear unit), which keeps a positive number and turns a negative one into zero (ISLP equation 10.5):

g(z)=max⁡(0,z)g(z) = \max(0, z)

Second, the output is a weighted sum of the hidden units’ values (ISLP equation 10.3), “a linear regressionA prediction problem whose answer is a number; when the answer is a category it is classification instead. model in the KK activations”:

ŷ, the network's prediction

y^=β0+β1h1+⋯+βKhK\key{\hat{y}} = \beta_0 + \beta_1 h_1 + \dots + \beta_K h_K

So each hidden unit builds a new feature from the old ones, and the output layer is ordinary linear regression on the new features. The difference from adding features by hand is that the network learns how to build them: the ww‘s are fitted together with the β\beta‘s. Bishop and Bishop describe the same design as basis functions that “themselves have learnable parameters” (section 6.2). A network with more than one hidden layer feeds the first layer’s outputs into a second layer of the same kind, and so on; that is the stacking in the title.

Features

seven numbers

for one ticker and day

Weighted sums

one per hidden unit,

each with its own weights

Bend

ReLU: a negative

sum becomes 0

Output

a weighted sum

of the bent values

Without the bend, the stack is one straight line

Take the activation away and a network of any depth is linear regression with extra steps. ISLP: “without it the model f(X)f(X) in (10.1) would collapse into a simple linear model in X1,…,XpX_1, \dots, X_p” (section 10.1). The algebra is two lines. With g(z)=zg(z) = z, put each unit’s sum into the output and collect the terms by feature:

y^=β0+∑kβk(wk0+∑jwkjxj)\key{\hat{y}} = \beta_0 + \textstyle\sum_k \beta_k \left(w_{k0} + \sum_j w_{kj} x_j\right) y^=(β0+∑kβkwk0)+∑j(∑kβkwkj)xj\key{\hat{y}} = \left(\beta_0 + \textstyle\sum_k \beta_k w_{k0}\right) + \textstyle\sum_j \left(\sum_k \beta_k w_{kj}\right) x_j

The first bracket is one number, an interceptThe constant term in a linear model: together with the slope it is one of the model's coefficients.. The second is one number per feature, a slope. That is the form of linear regression, whatever KK is. Murphy shows the same for LL layers: the weight matrices multiply out to one matrix (PML1 equation 13.10), and Bishop and Bishop add that “we can always find an equivalent network without hidden units” (section 6.2.3).

A small case shows both behaviours on the same weights. One input xx, two hidden units with sums 2x+12x + 1 and −x+3-x + 3, and an output that adds half of each. Table 1 runs four values of xx through it, once with no bend and once with ReLU.

Table 1. One input, two hidden units, output = half of each unit’s value, added
xxUnit 1: 2x+12x + 1Unit 2: −x+3-x + 3Output, no bendOutput, ReLU
0132.02.0
2513.03.0
49−14.04.5
613−35.06.5

With no bend the output is 0.5x+20.5x + 2 at every xx: one straight line, rising 0.5 per step of xx. With ReLU, unit 2 is switched off once its sum goes negative (above x=3x = 3), so from there the output rises 1.0 per step instead of 0.5. The line has a kink at x=3x = 3. Many units, each with its kink in a different place, can join up into a curve; Murphy notes that a network with one hidden layer is a “universal function approximator”, able to model “any suitably smooth function, given enough hidden units” (PML1 section 13.2.5). Being able to draw a curve is not the same as finding the right one from a few thousand noisy rows, which is the rest of this post.

Figure 1, panel 1, shows a bend on the real data, with one input, this month’s volatility, and a network of 8 ReLU units. The network rises more steeply than the line up to about 43% and then flattens. On the test years the line misses by 12.83 points and the network by 12.18. Both do better than the seven-feature models in Tables 2 and 4: more inputs are not automatically better.

The real data says the same. Table 2 fits a network with two hidden layers of 32 units and no bend (scikit-learn’s activation="identity") from five different random starting weights.

Table 2. Typical miss on next month’s volatility, test years 2024 to October 2025
ModelTypical miss, test (points)
Guess the training average every time18.36
Linear regression, seven features12.92
Network 32-32, no bend, five random starts12.92 to 12.94

Guessing the training average misses next month’s volatility by 18.36 points of % a year on a typical test day. Linear regression cuts that to 12.92\risk{12.92}. The network without a bend has 1,345 weights instead of 8, and lands on the same 12.92\risk{12.92} to 12.94\risk{12.94}: the extra weights only re-describe the same straight line.

Fitting: walk the weights downhill on the squared error

A network is fitted the same way for any number of layers: choose the weights that make the squared error on the training rowsThe observed examples a method learns from: they are used to teach it how to make its estimate. small (ISLP equation 10.25, with all the weights collected in one list θ\theta):

R, the training error to make smally, the actual next-month volatilityŷ, the network's prediction

R(θ)=12∑i(yi−y^i)2\risk{R(\theta)} = \tfrac{1}{2} \textstyle\sum_i \left(\good{y_i} - \key{\hat{y}_i}\right)^2

Linear regression has a formula for its best weights. A network does not: the bend makes this error a bumpy surface with many low points (ISLP calls it “nonconvex”, section 10.7). So the fit is gradient descentFitting by repeated small steps in the direction that lowers the error fastest, recomputing that direction after every step.: start from random weights, work out which way each weight should move to lower the error (the gradient), take a small step that way, repeat (ISLP equation 10.27, ρ\rho is the step size, called the learning rateThe number that sets how big each update step is.):

θ←θ−ρ ∇R(θ)\theta \leftarrow \theta - \rho \, \nabla \risk{R(\theta)}

BackpropagationThe way a neural network's fitting works out, by the chain rule, how much each parameter contributed to the error. is how the gradient is computed: the chain rule of calculus, applied from the output back to the first layer, so each weight gets its share of the miss (ISLP section 10.7.1). In practice each step uses a small random batch of rows rather than all of them (stochastic gradient descent, section 10.7.2); scikit-learn’s default batch is 200 rows, so one epochOne complete pass through the whole training set during fitting., a full pass through the 3,680 training rows, is 19 steps.

Two things follow that linear regression never had. The answer depends on the random start: the same network, fitted from five starts, gives five different models. And the fit has to be told when to stop, because the training error can keep falling long after the model has stopped learning anything that carries over to new days.

A network with room to spare learns the noise too

Figure 1, panel 2, fits a network with two hidden layers of 256 units each and a negligible weight penalty, one epoch at a time, and scores it after every epoch on the training years and on the validation year. The network has 68,097 weights and biases, for 3,680 training rows.

{"panels":[{"x0":52.28,"x1":565.2,"y0":29.16,"y1":223.28,"title":"1. One input, 2020 to 2022: the network bends where the line cannot","xlabel":"This month's volatility (% a year)","ylabel":"Next month's volatility (% a year)","xlog":false},{"x0":52.28,"x1":565.2,"y0":311.96,"y1":506.08,"title":"2. A 256-256 network: training error keeps falling, validation error turns up","xlabel":"Epoch (passes through the training rows)","ylabel":"Typical miss, RMSE (points of % a year)","xlog":false}],"series":[{"panel":0,"label":"linear regression","color":"var(--chart-blue, #3b6ea5)","kind":"line","x":[6.4914,6.93171,7.37202,7.81233,8.25264,8.69294,9.13325,9.57356,10.0139,10.4542,10.8945,11.3348,11.7751,12.2154,12.6557,13.096,13.5363,13.9766,14.417,14.8573,15.2976,15.7379,16.1782,16.6185,17.0588,17.4991,17.9394,18.3797,18.82,19.2604,19.7007,20.141,20.5813,21.0216,21.4619,21.9022,22.3425,22.7828,23.2231,23.6634,24.1037,24.5441,24.9844,25.4247,25.865,26.3053,26.7456,27.1859,27.6262,28.0665,28.5068,28.9471,29.3875,29.8278,30.2681,30.7084,31.1487,31.589,32.0293,32.4696,32.9099,33.3502,33.7905,34.2308,34.6712,35.1115,35.5518,35.9921,36.4324,36.8727,37.313,37.7533,38.1936,38.6339,39.0742,39.5146,39.9549,40.3952,40.8355,41.2758,41.7161,42.1564,42.5967,43.037,43.4773,43.9176,44.3579,44.7983,45.2386,45.6789,46.1192,46.5595,46.9998,47.4401,47.8804,48.3207,48.761,49.2013,49.6417,50.082,50.5223,50.9626,51.4029,51.8432,52.2835,52.7238,53.1641,53.6044,54.0447,54.485,54.9254,55.3657,55.806,56.2463,56.6866,57.1269,57.5672,58.0075,58.4478,58.8881,59.3284,59.7688,60.2091,60.6494,61.0897,61.53,61.9703,62.4106,62.8509,63.2912,63.7315,64.1718,64.6121,65.0525,65.4928,65.9331,66.3734,66.8137,67.254,67.6943,68.1346,68.5749,69.0152,69.4555,69.8959,70.3362,70.7765,71.2168,71.6571,72.0974,72.5377,72.978,73.4183,73.8586,74.2989,74.7392,75.1796,75.6199,76.0602,76.5005,76.9408,77.3811,77.8214,78.2617,78.702,79.1423,79.5826,80.023,80.4633,80.9036,81.3439,81.7842,82.2245,82.6648,83.1051,83.5454,83.9857,84.426,84.8663,85.3067,85.747,86.1873,86.6276,87.0679,87.5082,87.9485,88.3888,88.8291,89.2694,89.7097,90.1501,90.5904,91.0307,91.471,91.9113,92.3516,92.7919,93.2322,93.6725,94.1128,94.5531,94.9934,95.4338,95.8741,96.3144,96.7547,97.195,97.6353,98.0756,98.5159,98.9562,99.3965,99.8368,100.277,100.717,101.158,101.598,102.038,102.479,102.919,103.359,103.8,104.24,104.68,105.121,105.561,106.001,106.441,106.882,107.322,107.762,108.203,108.643,109.083,109.524,109.964,110.404,110.845,111.285,111.725,112.165,112.606,113.046,113.486,113.927,114.367,114.807,115.248,115.688,116.128,116.569,117.009,117.449,117.889,118.33,118.77,119.21,119.651,120.091,120.531,120.972,121.412,121.852,122.293,122.733,123.173,123.614,124.054,124.494,124.934,125.375,125.815,126.255,126.696,127.136,127.576,128.017,128.457,128.897,129.338,129.778,130.218,130.658,131.099,131.539,131.979,132.42,132.86,133.3,133.741,134.181,134.621,135.062,135.502,135.942,136.382,136.823,137.263,137.703,138.144],"y":[15.6568,15.9407,16.2247,16.5086,16.7925,17.0764,17.3603,17.6442,17.9281,18.212,18.4959,18.7799,19.0638,19.3477,19.6316,19.9155,20.1994,20.4833,20.7672,21.0511,21.3351,21.619,21.9029,22.1868,22.4707,22.7546,23.0385,23.3224,23.6063,23.8903,24.1742,24.4581,24.742,25.0259,25.3098,25.5937,25.8776,26.1615,26.4455,26.7294,27.0133,27.2972,27.5811,27.865,28.1489,28.4328,28.7167,29.0007,29.2846,29.5685,29.8524,30.1363,30.4202,30.7041,30.988,31.272,31.5559,31.8398,32.1237,32.4076,32.6915,32.9754,33.2593,33.5432,33.8272,34.1111,34.395,34.6789,34.9628,35.2467,35.5306,35.8145,36.0984,36.3824,36.6663,36.9502,37.2341,37.518,37.8019,38.0858,38.3697,38.6536,38.9376,39.2215,39.5054,39.7893,40.0732,40.3571,40.641,40.9249,41.2088,41.4928,41.7767,42.0606,42.3445,42.6284,42.9123,43.1962,43.4801,43.764,44.048,44.3319,44.6158,44.8997,45.1836,45.4675,45.7514,46.0353,46.3193,46.6032,46.8871,47.171,47.4549,47.7388,48.0227,48.3066,48.5905,48.8745,49.1584,49.4423,49.7262,50.0101,50.294,50.5779,50.8618,51.1457,51.4297,51.7136,51.9975,52.2814,52.5653,52.8492,53.1331,53.417,53.7009,53.9849,54.2688,54.5527,54.8366,55.1205,55.4044,55.6883,55.9722,56.2561,56.5401,56.824,57.1079,57.3918,57.6757,57.9596,58.2435,58.5274,58.8113,59.0953,59.3792,59.6631,59.947,60.2309,60.5148,60.7987,61.0826,61.3665,61.6505,61.9344,62.2183,62.5022,62.7861,63.07,63.3539,63.6378,63.9218,64.2057,64.4896,64.7735,65.0574,65.3413,65.6252,65.9091,66.193,66.477,66.7609,67.0448,67.3287,67.6126,67.8965,68.1804,68.4643,68.7482,69.0322,69.3161,69.6,69.8839,70.1678,70.4517,70.7356,71.0195,71.3034,71.5874,71.8713,72.1552,72.4391,72.723,73.0069,73.2908,73.5747,73.8586,74.1426,74.4265,74.7104,74.9943,75.2782,75.5621,75.846,76.1299,76.4138,76.6978,76.9817,77.2656,77.5495,77.8334,78.1173,78.4012,78.6851,78.9691,79.253,79.5369,79.8208,80.1047,80.3886,80.6725,80.9564,81.2403,81.5243,81.8082,82.0921,82.376,82.6599,82.9438,83.2277,83.5116,83.7955,84.0795,84.3634,84.6473,84.9312,85.2151,85.499,85.7829,86.0668,86.3507,86.6347,86.9186,87.2025,87.4864,87.7703,88.0542,88.3381,88.622,88.9059,89.1899,89.4738,89.7577,90.0416,90.3255,90.6094,90.8933,91.1772,91.4611,91.7451,92.029,92.3129,92.5968,92.8807,93.1646,93.4485,93.7324,94.0163,94.3003,94.5842,94.8681,95.152,95.4359,95.7198,96.0037,96.2876,96.5716,96.8555,97.1394,97.4233,97.7072,97.9911,98.275,98.5589,98.8428,99.1268,99.4107,99.6946,99.9785,100.262,100.546],"sx":[75.6,77.16,78.72,80.28,81.83,83.39,84.95,86.51,88.07,89.63,91.19,92.75,94.31,95.87,97.43,98.99,100.55,102.11,103.67,105.23,106.79,108.35,109.91,111.47,113.02,114.58,116.14,117.7,119.26,120.82,122.38,123.94,125.5,127.06,128.62,130.18,131.74,133.3,134.86,136.42,137.98,139.54,141.1,142.66,144.21,145.77,147.33,148.89,150.45,152.01,153.57,155.13,156.69,158.25,159.81,161.37,162.93,164.49,166.05,167.61,169.17,170.73,172.29,173.84,175.4,176.96,178.52,180.08,181.64,183.2,184.76,186.32,187.88,189.44,191.0,192.56,194.12,195.68,197.24,198.8,200.36,201.92,203.48,205.03,206.59,208.15,209.71,211.27,212.83,214.39,215.95,217.51,219.07,220.63,222.19,223.75,225.31,226.87,228.43,229.99,231.55,233.11,234.67,236.22,237.78,239.34,240.9,242.46,244.02,245.58,247.14,248.7,250.26,251.82,253.38,254.94,256.5,258.06,259.62,261.18,262.74,264.3,265.86,267.41,268.97,270.53,272.09,273.65,275.21,276.77,278.33,279.89,281.45,283.01,284.57,286.13,287.69,289.25,290.81,292.37,293.93,295.49,297.04,298.6,300.16,301.72,303.28,304.84,306.4,307.96,309.52,311.08,312.64,314.2,315.76,317.32,318.88,320.44,322.0,323.56,325.12,326.68,328.23,329.79,331.35,332.91,334.47,336.03,337.59,339.15,340.71,342.27,343.83,345.39,346.95,348.51,350.07,351.63,353.19,354.75,356.31,357.87,359.42,360.98,362.54,364.1,365.66,367.22,368.78,370.34,371.9,373.46,375.02,376.58,378.14,379.7,381.26,382.82,384.38,385.94,387.5,389.06,390.61,392.17,393.73,395.29,396.85,398.41,399.97,401.53,403.09,404.65,406.21,407.77,409.33,410.89,412.45,414.01,415.57,417.13,418.69,420.25,421.8,423.36,424.92,426.48,428.04,429.6,431.16,432.72,434.28,435.84,437.4,438.96,440.52,442.08,443.64,445.2,446.76,448.32,449.88,451.43,452.99,454.55,456.11,457.67,459.23,460.79,462.35,463.91,465.47,467.03,468.59,470.15,471.71,473.27,474.83,476.39,477.95,479.51,481.07,482.62,484.18,485.74,487.3,488.86,490.42,491.98,493.54,495.1,496.66,498.22,499.78,501.34,502.9,504.46,506.02,507.58,509.14,510.7,512.26,513.81,515.37,516.93,518.49,520.05,521.61,523.17,524.73,526.29,527.85,529.41,530.97,532.53,534.09,535.65,537.21,538.77,540.33,541.89],"sy":[202.17,201.79,201.41,201.03,200.65,200.27,199.88,199.5,199.12,198.74,198.36,197.98,197.6,197.22,196.84,196.46,196.08,195.7,195.32,194.94,194.56,194.18,193.8,193.42,193.03,192.65,192.27,191.89,191.51,191.13,190.75,190.37,189.99,189.61,189.23,188.85,188.47,188.09,187.71,187.33,186.95,186.56,186.18,185.8,185.42,185.04,184.66,184.28,183.9,183.52,183.14,182.76,182.38,182.0,181.62,181.24,180.86,180.48,180.1,179.71,179.33,178.95,178.57,178.19,177.81,177.43,177.05,176.67,176.29,175.91,175.53,175.15,174.77,174.39,174.01,173.63,173.25,172.86,172.48,172.1,171.72,171.34,170.96,170.58,170.2,169.82,169.44,169.06,168.68,168.3,167.92,167.54,167.16,166.78,166.39,166.01,165.63,165.25,164.87,164.49,164.11,163.73,163.35,162.97,162.59,162.21,161.83,161.45,161.07,160.69,160.31,159.93,159.54,159.16,158.78,158.4,158.02,157.64,157.26,156.88,156.5,156.12,155.74,155.36,154.98,154.6,154.22,153.84,153.46,153.07,152.69,152.31,151.93,151.55,151.17,150.79,150.41,150.03,149.65,149.27,148.89,148.51,148.13,147.75,147.37,146.99,146.61,146.22,145.84,145.46,145.08,144.7,144.32,143.94,143.56,143.18,142.8,142.42,142.04,141.66,141.28,140.9,140.52,140.14,139.76,139.37,138.99,138.61,138.23,137.85,137.47,137.09,136.71,136.33,135.95,135.57,135.19,134.81,134.43,134.05,133.67,133.29,132.9,132.52,132.14,131.76,131.38,131.0,130.62,130.24,129.86,129.48,129.1,128.72,128.34,127.96,127.58,127.2,126.82,126.44,126.05,125.67,125.29,124.91,124.53,124.15,123.77,123.39,123.01,122.63,122.25,121.87,121.49,121.11,120.73,120.35,119.97,119.58,119.2,118.82,118.44,118.06,117.68,117.3,116.92,116.54,116.16,115.78,115.4,115.02,114.64,114.26,113.88,113.5,113.12,112.73,112.35,111.97,111.59,111.21,110.83,110.45,110.07,109.69,109.31,108.93,108.55,108.17,107.79,107.41,107.03,106.65,106.27,105.88,105.5,105.12,104.74,104.36,103.98,103.6,103.22,102.84,102.46,102.08,101.7,101.32,100.94,100.56,100.18,99.8,99.41,99.03,98.65,98.27,97.89,97.51,97.13,96.75,96.37,95.99,95.61,95.23,94.85,94.47,94.09,93.71,93.33,92.95,92.56,92.18,91.8,91.42,91.04,90.66,90.28,89.9,89.52,89.14,88.76,88.38]},{"panel":0,"label":"network, 8 ReLU units","color":"var(--chart-maroon, #b6262c)","kind":"line","x":[6.4914,6.93171,7.37202,7.81233,8.25264,8.69294,9.13325,9.57356,10.0139,10.4542,10.8945,11.3348,11.7751,12.2154,12.6557,13.096,13.5363,13.9766,14.417,14.8573,15.2976,15.7379,16.1782,16.6185,17.0588,17.4991,17.9394,18.3797,18.82,19.2604,19.7007,20.141,20.5813,21.0216,21.4619,21.9022,22.3425,22.7828,23.2231,23.6634,24.1037,24.5441,24.9844,25.4247,25.865,26.3053,26.7456,27.1859,27.6262,28.0665,28.5068,28.9471,29.3875,29.8278,30.2681,30.7084,31.1487,31.589,32.0293,32.4696,32.9099,33.3502,33.7905,34.2308,34.6712,35.1115,35.5518,35.9921,36.4324,36.8727,37.313,37.7533,38.1936,38.6339,39.0742,39.5146,39.9549,40.3952,40.8355,41.2758,41.7161,42.1564,42.5967,43.037,43.4773,43.9176,44.3579,44.7983,45.2386,45.6789,46.1192,46.5595,46.9998,47.4401,47.8804,48.3207,48.761,49.2013,49.6417,50.082,50.5223,50.9626,51.4029,51.8432,52.2835,52.7238,53.1641,53.6044,54.0447,54.485,54.9254,55.3657,55.806,56.2463,56.6866,57.1269,57.5672,58.0075,58.4478,58.8881,59.3284,59.7688,60.2091,60.6494,61.0897,61.53,61.9703,62.4106,62.8509,63.2912,63.7315,64.1718,64.6121,65.0525,65.4928,65.9331,66.3734,66.8137,67.254,67.6943,68.1346,68.5749,69.0152,69.4555,69.8959,70.3362,70.7765,71.2168,71.6571,72.0974,72.5377,72.978,73.4183,73.8586,74.2989,74.7392,75.1796,75.6199,76.0602,76.5005,76.9408,77.3811,77.8214,78.2617,78.702,79.1423,79.5826,80.023,80.4633,80.9036,81.3439,81.7842,82.2245,82.6648,83.1051,83.5454,83.9857,84.426,84.8663,85.3067,85.747,86.1873,86.6276,87.0679,87.5082,87.9485,88.3888,88.8291,89.2694,89.7097,90.1501,90.5904,91.0307,91.471,91.9113,92.3516,92.7919,93.2322,93.6725,94.1128,94.5531,94.9934,95.4338,95.8741,96.3144,96.7547,97.195,97.6353,98.0756,98.5159,98.9562,99.3965,99.8368,100.277,100.717,101.158,101.598,102.038,102.479,102.919,103.359,103.8,104.24,104.68,105.121,105.561,106.001,106.441,106.882,107.322,107.762,108.203,108.643,109.083,109.524,109.964,110.404,110.845,111.285,111.725,112.165,112.606,113.046,113.486,113.927,114.367,114.807,115.248,115.688,116.128,116.569,117.009,117.449,117.889,118.33,118.77,119.21,119.651,120.091,120.531,120.972,121.412,121.852,122.293,122.733,123.173,123.614,124.054,124.494,124.934,125.375,125.815,126.255,126.696,127.136,127.576,128.017,128.457,128.897,129.338,129.778,130.218,130.658,131.099,131.539,131.979,132.42,132.86,133.3,133.741,134.181,134.621,135.062,135.502,135.942,136.382,136.823,137.263,137.703,138.144],"y":[10.4457,10.8582,11.2706,11.6831,12.0956,12.508,12.9205,13.333,13.7454,14.1579,14.5703,14.9828,15.3953,15.8077,16.2202,16.6327,17.0451,17.4576,17.8701,18.2825,18.695,19.1074,19.5199,19.9324,20.3448,20.7573,21.1698,21.5822,21.9947,22.4072,22.8196,23.2321,23.6445,24.057,24.4695,24.8819,25.2944,25.7069,26.1193,26.5318,26.9443,27.3567,27.7692,28.1816,28.5941,29.0066,29.419,29.8315,30.244,30.6564,31.0689,31.4814,31.8938,32.3063,32.7187,33.1312,33.5437,33.9561,34.3686,34.7811,35.1935,35.606,36.0185,36.4309,36.8434,37.2558,37.6683,38.0808,38.4932,38.9057,39.3182,39.7306,40.1431,40.5556,40.968,41.3805,41.7929,42.2054,42.6179,43.0303,43.4428,43.8553,44.2677,44.6802,45.0927,45.4814,45.6501,45.8188,45.9875,46.1562,46.3249,46.4936,46.6623,46.831,46.9997,47.1684,47.3371,47.5058,47.6745,47.8432,48.0119,48.1806,48.3493,48.518,48.6867,48.8554,49.0241,49.1928,49.3615,49.5302,49.6989,49.8676,50.0363,50.205,50.3737,50.5424,50.7111,50.8798,51.0485,51.2172,51.3859,51.5546,51.7233,51.892,52.0607,52.2294,52.3981,52.5668,52.7355,52.9042,53.0729,53.2416,53.4103,53.579,53.7477,53.9164,54.0851,54.2538,54.4225,54.5912,54.7599,54.9286,55.0973,55.266,55.4347,55.6034,55.7721,55.9408,56.1096,56.2783,56.447,56.6157,56.7844,56.9531,57.1218,57.2905,57.4592,57.6279,57.7966,57.9653,58.134,58.3027,58.4714,58.6401,58.8088,58.9775,59.1462,59.3149,59.4836,59.6523,59.821,59.9897,60.1584,60.3271,60.4958,60.6645,60.8332,61.0019,61.1706,61.3393,61.508,61.6767,61.8454,62.0141,62.1828,62.3515,62.5202,62.6889,62.8576,63.0263,63.195,63.3637,63.5324,63.7011,63.8698,64.0385,64.2072,64.3759,64.5446,64.7133,64.882,65.0507,65.2194,65.3881,65.5568,65.7255,65.8942,66.0629,66.2316,66.4003,66.569,66.7377,66.9064,67.0751,67.2438,67.4125,67.5812,67.7499,67.9187,68.0874,68.2561,68.4248,68.5935,68.7622,68.9309,69.0996,69.2683,69.437,69.6057,69.7744,69.9431,70.1118,70.2805,70.4492,70.6179,70.7866,70.9553,71.124,71.2927,71.4614,71.6301,71.7988,71.9675,72.1362,72.3049,72.4736,72.6423,72.811,72.9797,73.1484,73.3171,73.4858,73.6545,73.8232,73.9919,74.1606,74.3293,74.498,74.6667,74.8354,75.0041,75.1728,75.3415,75.5102,75.6789,75.8476,76.0163,76.185,76.3537,76.5224,76.6911,76.8598,77.0285,77.1972,77.3659,77.5346,77.7033,77.872,78.0407,78.2094,78.3781,78.5468,78.7155,78.8842,79.0529,79.2216,79.3903,79.559,79.7278,79.8965,80.0652,80.2339,80.4026,80.5713,80.74,80.9087,81.0774,81.2603,81.4668,81.6733],"sx":[75.6,77.16,78.72,80.28,81.83,83.39,84.95,86.51,88.07,89.63,91.19,92.75,94.31,95.87,97.43,98.99,100.55,102.11,103.67,105.23,106.79,108.35,109.91,111.47,113.02,114.58,116.14,117.7,119.26,120.82,122.38,123.94,125.5,127.06,128.62,130.18,131.74,133.3,134.86,136.42,137.98,139.54,141.1,142.66,144.21,145.77,147.33,148.89,150.45,152.01,153.57,155.13,156.69,158.25,159.81,161.37,162.93,164.49,166.05,167.61,169.17,170.73,172.29,173.84,175.4,176.96,178.52,180.08,181.64,183.2,184.76,186.32,187.88,189.44,191.0,192.56,194.12,195.68,197.24,198.8,200.36,201.92,203.48,205.03,206.59,208.15,209.71,211.27,212.83,214.39,215.95,217.51,219.07,220.63,222.19,223.75,225.31,226.87,228.43,229.99,231.55,233.11,234.67,236.22,237.78,239.34,240.9,242.46,244.02,245.58,247.14,248.7,250.26,251.82,253.38,254.94,256.5,258.06,259.62,261.18,262.74,264.3,265.86,267.41,268.97,270.53,272.09,273.65,275.21,276.77,278.33,279.89,281.45,283.01,284.57,286.13,287.69,289.25,290.81,292.37,293.93,295.49,297.04,298.6,300.16,301.72,303.28,304.84,306.4,307.96,309.52,311.08,312.64,314.2,315.76,317.32,318.88,320.44,322.0,323.56,325.12,326.68,328.23,329.79,331.35,332.91,334.47,336.03,337.59,339.15,340.71,342.27,343.83,345.39,346.95,348.51,350.07,351.63,353.19,354.75,356.31,357.87,359.42,360.98,362.54,364.1,365.66,367.22,368.78,370.34,371.9,373.46,375.02,376.58,378.14,379.7,381.26,382.82,384.38,385.94,387.5,389.06,390.61,392.17,393.73,395.29,396.85,398.41,399.97,401.53,403.09,404.65,406.21,407.77,409.33,410.89,412.45,414.01,415.57,417.13,418.69,420.25,421.8,423.36,424.92,426.48,428.04,429.6,431.16,432.72,434.28,435.84,437.4,438.96,440.52,442.08,443.64,445.2,446.76,448.32,449.88,451.43,452.99,454.55,456.11,457.67,459.23,460.79,462.35,463.91,465.47,467.03,468.59,470.15,471.71,473.27,474.83,476.39,477.95,479.51,481.07,482.62,484.18,485.74,487.3,488.86,490.42,491.98,493.54,495.1,496.66,498.22,499.78,501.34,502.9,504.46,506.02,507.58,509.14,510.7,512.26,513.81,515.37,516.93,518.49,520.05,521.61,523.17,524.73,526.29,527.85,529.41,530.97,532.53,534.09,535.65,537.21,538.77,540.33,541.89],"sy":[209.15,208.6,208.05,207.49,206.94,206.39,205.84,205.28,204.73,204.18,203.62,203.07,202.52,201.97,201.41,200.86,200.31,199.75,199.2,198.65,198.1,197.54,196.99,196.44,195.88,195.33,194.78,194.23,193.67,193.12,192.57,192.01,191.46,190.91,190.36,189.8,189.25,188.7,188.14,187.59,187.04,186.49,185.93,185.38,184.83,184.27,183.72,183.17,182.61,182.06,181.51,180.96,180.4,179.85,179.3,178.74,178.19,177.64,177.09,176.53,175.98,175.43,174.87,174.32,173.77,173.22,172.66,172.11,171.56,171.0,170.45,169.9,169.35,168.79,168.24,167.69,167.13,166.58,166.03,165.48,164.92,164.37,163.82,163.26,162.71,162.19,161.96,161.74,161.51,161.29,161.06,160.83,160.61,160.38,160.15,159.93,159.7,159.48,159.25,159.02,158.8,158.57,158.35,158.12,157.89,157.67,157.44,157.22,156.99,156.76,156.54,156.31,156.08,155.86,155.63,155.41,155.18,154.95,154.73,154.5,154.28,154.05,153.82,153.6,153.37,153.14,152.92,152.69,152.47,152.24,152.01,151.79,151.56,151.34,151.11,150.88,150.66,150.43,150.2,149.98,149.75,149.53,149.3,149.07,148.85,148.62,148.4,148.17,147.94,147.72,147.49,147.27,147.04,146.81,146.59,146.36,146.13,145.91,145.68,145.46,145.23,145.0,144.78,144.55,144.33,144.1,143.87,143.65,143.42,143.19,142.97,142.74,142.52,142.29,142.06,141.84,141.61,141.39,141.16,140.93,140.71,140.48,140.25,140.03,139.8,139.58,139.35,139.12,138.9,138.67,138.45,138.22,137.99,137.77,137.54,137.32,137.09,136.86,136.64,136.41,136.18,135.96,135.73,135.51,135.28,135.05,134.83,134.6,134.38,134.15,133.92,133.7,133.47,133.24,133.02,132.79,132.57,132.34,132.11,131.89,131.66,131.44,131.21,130.98,130.76,130.53,130.3,130.08,129.85,129.63,129.4,129.17,128.95,128.72,128.5,128.27,128.04,127.82,127.59,127.37,127.14,126.91,126.69,126.46,126.23,126.01,125.78,125.56,125.33,125.1,124.88,124.65,124.43,124.2,123.97,123.75,123.52,123.29,123.07,122.84,122.62,122.39,122.16,121.94,121.71,121.49,121.26,121.03,120.81,120.58,120.35,120.13,119.9,119.68,119.45,119.22,119.0,118.77,118.55,118.32,118.09,117.87,117.64,117.42,117.19,116.96,116.74,116.51,116.28,116.06,115.83,115.61,115.38,115.15,114.93,114.7,114.48,114.23,113.95,113.68]},{"panel":1,"label":"training years, 2020 to 2022","color":"var(--chart-blue, #3b6ea5)","kind":"line","x":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0,50.0,51.0,52.0,53.0,54.0,55.0,56.0,57.0,58.0,59.0,60.0,61.0,62.0,63.0,64.0,65.0,66.0,67.0,68.0,69.0,70.0,71.0,72.0,73.0,74.0,75.0,76.0,77.0,78.0,79.0,80.0,81.0,82.0,83.0,84.0,85.0,86.0,87.0,88.0,89.0,90.0,91.0,92.0,93.0,94.0,95.0,96.0,97.0,98.0,99.0,100.0,101.0,102.0,103.0,104.0,105.0,106.0,107.0,108.0,109.0,110.0,111.0,112.0,113.0,114.0,115.0,116.0,117.0,118.0,119.0,120.0,121.0,122.0,123.0,124.0,125.0,126.0,127.0,128.0,129.0,130.0,131.0,132.0,133.0,134.0,135.0,136.0,137.0,138.0,139.0,140.0,141.0,142.0,143.0,144.0,145.0,146.0,147.0,148.0,149.0,150.0,151.0,152.0,153.0,154.0,155.0,156.0,157.0,158.0,159.0,160.0,161.0,162.0,163.0,164.0,165.0,166.0,167.0,168.0,169.0,170.0,171.0,172.0,173.0,174.0,175.0,176.0,177.0,178.0,179.0,180.0,181.0,182.0,183.0,184.0,185.0,186.0,187.0,188.0,189.0,190.0,191.0,192.0,193.0,194.0,195.0,196.0,197.0,198.0,199.0,200.0,201.0,202.0,203.0,204.0,205.0,206.0,207.0,208.0,209.0,210.0,211.0,212.0,213.0,214.0,215.0,216.0,217.0,218.0,219.0,220.0,221.0,222.0,223.0,224.0,225.0,226.0,227.0,228.0,229.0,230.0,231.0,232.0,233.0,234.0,235.0,236.0,237.0,238.0,239.0,240.0,241.0,242.0,243.0,244.0,245.0,246.0,247.0,248.0,249.0,250.0,251.0,252.0,253.0,254.0,255.0,256.0,257.0,258.0,259.0,260.0,261.0,262.0,263.0,264.0,265.0,266.0,267.0,268.0,269.0,270.0,271.0,272.0,273.0,274.0,275.0,276.0,277.0,278.0,279.0,280.0,281.0,282.0,283.0,284.0,285.0,286.0,287.0,288.0,289.0,290.0,291.0,292.0,293.0,294.0,295.0,296.0,297.0,298.0,299.0,300.0],"y":[31.4785,19.0505,17.0518,16.103,15.6239,15.3201,15.0967,14.9342,14.8133,14.7191,14.6414,14.5724,14.5074,14.444,14.3819,14.3211,14.2629,14.2071,14.1565,14.1123,14.0748,14.0429,14.0153,13.9902,13.9671,13.9453,13.924,13.9035,13.8842,13.8657,13.8478,13.8308,13.8146,13.7995,13.7847,13.7704,13.7567,13.7441,13.7315,13.7194,13.7083,13.6977,13.6877,13.6781,13.6686,13.659,13.6498,13.6407,13.6318,13.6229,13.6143,13.6056,13.5973,13.5891,13.5806,13.5723,13.5639,13.5554,13.547,13.539,13.5313,13.5235,13.5161,13.5089,13.5016,13.4943,13.487,13.4793,13.4721,13.4648,13.4577,13.4503,13.4434,13.4356,13.4285,13.421,13.4139,13.4067,13.4001,13.3925,13.3857,13.3782,13.3707,13.3634,13.356,13.3483,13.34,13.333,13.325,13.3179,13.3096,13.302,13.2947,13.2879,13.2786,13.2717,13.2646,13.2561,13.2488,13.242,13.2332,13.2264,13.2184,13.2107,13.203,13.1943,13.1862,13.1781,13.1699,13.1612,13.1529,13.1449,13.1358,13.1277,13.1183,13.1107,13.1024,13.0939,13.0848,13.0747,13.0649,13.0572,13.0477,13.038,13.029,13.0186,13.0106,13.0012,12.9924,12.985,12.9754,12.9662,12.9591,12.9482,12.9416,12.9316,12.9216,12.9145,12.904,12.8961,12.8863,12.8789,12.8717,12.8635,12.8543,12.8463,12.8378,12.829,12.8204,12.8124,12.8029,12.7944,12.7875,12.777,12.7712,12.7619,12.7547,12.7459,12.7389,12.7309,12.7221,12.7145,12.7063,12.6985,12.6888,12.6819,12.673,12.6664,12.6564,12.6495,12.6416,12.6352,12.6267,12.6187,12.6105,12.6022,12.5947,12.5868,12.5779,12.5702,12.5628,12.5554,12.5477,12.5387,12.5308,12.5234,12.515,12.5067,12.4999,12.4896,12.4818,12.4752,12.466,12.4573,12.451,12.4424,12.4346,12.426,12.4167,12.4094,12.4007,12.3916,12.3841,12.3731,12.3665,12.3568,12.3485,12.3405,12.3321,12.3248,12.3154,12.307,12.2988,12.2921,12.2835,12.2754,12.2671,12.2587,12.2506,12.2408,12.2319,12.223,12.216,12.2071,12.1987,12.1891,12.1818,12.1725,12.1655,12.157,12.1482,12.1405,12.1329,12.1266,12.117,12.1103,12.1007,12.0942,12.0856,12.0783,12.0709,12.0619,12.0537,12.0465,12.0379,12.0292,12.0208,12.0119,12.0045,11.9953,11.9889,11.9793,11.9717,11.9633,11.9562,11.9479,11.9402,11.9324,11.9247,11.9166,11.9094,11.9007,11.8928,11.8853,11.8785,11.8706,11.8632,11.8539,11.8465,11.8396,11.8312,11.8224,11.8152,11.8081,11.8001,11.7938,11.7874,11.7803,11.7736,11.7649,11.7589,11.7516,11.7459,11.7386,11.7312,11.7256,11.7164,11.7114,11.7031,11.6972,11.6893,11.684,11.6756,11.6694,11.6636,11.6546,11.6489,11.6438,11.6353,11.6286],"sx":[75.6,77.16,78.72,80.28,81.83,83.39,84.95,86.51,88.07,89.63,91.19,92.75,94.31,95.87,97.43,98.99,100.55,102.11,103.67,105.23,106.79,108.35,109.91,111.47,113.02,114.58,116.14,117.7,119.26,120.82,122.38,123.94,125.5,127.06,128.62,130.18,131.74,133.3,134.86,136.42,137.98,139.54,141.1,142.66,144.21,145.77,147.33,148.89,150.45,152.01,153.57,155.13,156.69,158.25,159.81,161.37,162.93,164.49,166.05,167.61,169.17,170.73,172.29,173.84,175.4,176.96,178.52,180.08,181.64,183.2,184.76,186.32,187.88,189.44,191.0,192.56,194.12,195.68,197.24,198.8,200.36,201.92,203.48,205.03,206.59,208.15,209.71,211.27,212.83,214.39,215.95,217.51,219.07,220.63,222.19,223.75,225.31,226.87,228.43,229.99,231.55,233.11,234.67,236.22,237.78,239.34,240.9,242.46,244.02,245.58,247.14,248.7,250.26,251.82,253.38,254.94,256.5,258.06,259.62,261.18,262.74,264.3,265.86,267.41,268.97,270.53,272.09,273.65,275.21,276.77,278.33,279.89,281.45,283.01,284.57,286.13,287.69,289.25,290.81,292.37,293.93,295.49,297.04,298.6,300.16,301.72,303.28,304.84,306.4,307.96,309.52,311.08,312.64,314.2,315.76,317.32,318.88,320.44,322.0,323.56,325.12,326.68,328.23,329.79,331.35,332.91,334.47,336.03,337.59,339.15,340.71,342.27,343.83,345.39,346.95,348.51,350.07,351.63,353.19,354.75,356.31,357.87,359.42,360.98,362.54,364.1,365.66,367.22,368.78,370.34,371.9,373.46,375.02,376.58,378.14,379.7,381.26,382.82,384.38,385.94,387.5,389.06,390.61,392.17,393.73,395.29,396.85,398.41,399.97,401.53,403.09,404.65,406.21,407.77,409.33,410.89,412.45,414.01,415.57,417.13,418.69,420.25,421.8,423.36,424.92,426.48,428.04,429.6,431.16,432.72,434.28,435.84,437.4,438.96,440.52,442.08,443.64,445.2,446.76,448.32,449.88,451.43,452.99,454.55,456.11,457.67,459.23,460.79,462.35,463.91,465.47,467.03,468.59,470.15,471.71,473.27,474.83,476.39,477.95,479.51,481.07,482.62,484.18,485.74,487.3,488.86,490.42,491.98,493.54,495.1,496.66,498.22,499.78,501.34,502.9,504.46,506.02,507.58,509.14,510.7,512.26,513.81,515.37,516.93,518.49,520.05,521.61,523.17,524.73,526.29,527.85,529.41,530.97,532.53,534.09,535.65,537.21,538.77,540.33,541.89],"sy":[320.78,431.27,449.04,457.48,461.73,464.44,466.42,467.87,468.94,469.78,470.47,471.08,471.66,472.22,472.78,473.32,473.83,474.33,474.78,475.17,475.51,475.79,476.04,476.26,476.46,476.66,476.85,477.03,477.2,477.37,477.52,477.68,477.82,477.95,478.09,478.21,478.33,478.45,478.56,478.67,478.76,478.86,478.95,479.03,479.12,479.2,479.28,479.37,479.44,479.52,479.6,479.68,479.75,479.82,479.9,479.97,480.05,480.12,480.2,480.27,480.34,480.41,480.47,480.54,480.6,480.67,480.73,480.8,480.86,480.93,480.99,481.06,481.12,481.19,481.25,481.32,481.38,481.45,481.5,481.57,481.63,481.7,481.77,481.83,481.9,481.97,482.04,482.1,482.17,482.24,482.31,482.38,482.44,482.5,482.58,482.65,482.71,482.79,482.85,482.91,482.99,483.05,483.12,483.19,483.26,483.33,483.41,483.48,483.55,483.63,483.7,483.77,483.85,483.93,484.01,484.08,484.15,484.23,484.31,484.4,484.48,484.55,484.64,484.72,484.8,484.9,484.97,485.05,485.13,485.2,485.28,485.36,485.43,485.52,485.58,485.67,485.76,485.82,485.92,485.99,486.07,486.14,486.2,486.28,486.36,486.43,486.5,486.58,486.66,486.73,486.81,486.89,486.95,487.04,487.1,487.18,487.24,487.32,487.38,487.45,487.53,487.6,487.67,487.74,487.83,487.89,487.97,488.03,488.12,488.18,488.25,488.31,488.38,488.45,488.52,488.6,488.66,488.73,488.81,488.88,488.95,489.01,489.08,489.16,489.23,489.3,489.37,489.45,489.51,489.6,489.67,489.73,489.81,489.89,489.94,490.02,490.09,490.16,490.25,490.31,490.39,490.47,490.54,490.64,490.69,490.78,490.85,490.92,491.0,491.06,491.15,491.22,491.3,491.36,491.43,491.5,491.58,491.65,491.72,491.81,491.89,491.97,492.03,492.11,492.19,492.27,492.34,492.42,492.48,492.56,492.63,492.7,492.77,492.83,492.91,492.97,493.06,493.11,493.19,493.26,493.32,493.4,493.47,493.54,493.62,493.69,493.77,493.85,493.91,493.99,494.05,494.14,494.2,494.28,494.34,494.42,494.48,494.55,494.62,494.69,494.76,494.84,494.9,494.97,495.03,495.1,495.17,495.25,495.32,495.38,495.45,495.53,495.59,495.66,495.73,495.79,495.84,495.91,495.97,496.04,496.1,496.16,496.21,496.28,496.34,496.39,496.47,496.52,496.59,496.64,496.71,496.76,496.84,496.89,496.94,497.02,497.07,497.12,497.19,497.25]},{"panel":1,"label":"validation year, 2023","color":"var(--chart-maroon, #b6262c)","kind":"line","x":[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0,50.0,51.0,52.0,53.0,54.0,55.0,56.0,57.0,58.0,59.0,60.0,61.0,62.0,63.0,64.0,65.0,66.0,67.0,68.0,69.0,70.0,71.0,72.0,73.0,74.0,75.0,76.0,77.0,78.0,79.0,80.0,81.0,82.0,83.0,84.0,85.0,86.0,87.0,88.0,89.0,90.0,91.0,92.0,93.0,94.0,95.0,96.0,97.0,98.0,99.0,100.0,101.0,102.0,103.0,104.0,105.0,106.0,107.0,108.0,109.0,110.0,111.0,112.0,113.0,114.0,115.0,116.0,117.0,118.0,119.0,120.0,121.0,122.0,123.0,124.0,125.0,126.0,127.0,128.0,129.0,130.0,131.0,132.0,133.0,134.0,135.0,136.0,137.0,138.0,139.0,140.0,141.0,142.0,143.0,144.0,145.0,146.0,147.0,148.0,149.0,150.0,151.0,152.0,153.0,154.0,155.0,156.0,157.0,158.0,159.0,160.0,161.0,162.0,163.0,164.0,165.0,166.0,167.0,168.0,169.0,170.0,171.0,172.0,173.0,174.0,175.0,176.0,177.0,178.0,179.0,180.0,181.0,182.0,183.0,184.0,185.0,186.0,187.0,188.0,189.0,190.0,191.0,192.0,193.0,194.0,195.0,196.0,197.0,198.0,199.0,200.0,201.0,202.0,203.0,204.0,205.0,206.0,207.0,208.0,209.0,210.0,211.0,212.0,213.0,214.0,215.0,216.0,217.0,218.0,219.0,220.0,221.0,222.0,223.0,224.0,225.0,226.0,227.0,228.0,229.0,230.0,231.0,232.0,233.0,234.0,235.0,236.0,237.0,238.0,239.0,240.0,241.0,242.0,243.0,244.0,245.0,246.0,247.0,248.0,249.0,250.0,251.0,252.0,253.0,254.0,255.0,256.0,257.0,258.0,259.0,260.0,261.0,262.0,263.0,264.0,265.0,266.0,267.0,268.0,269.0,270.0,271.0,272.0,273.0,274.0,275.0,276.0,277.0,278.0,279.0,280.0,281.0,282.0,283.0,284.0,285.0,286.0,287.0,288.0,289.0,290.0,291.0,292.0,293.0,294.0,295.0,296.0,297.0,298.0,299.0,300.0],"y":[22.3676,14.9008,15.9904,14.398,14.411,14.0531,13.7832,13.5666,13.3752,13.2199,13.082,12.9587,12.8402,12.7227,12.6092,12.4973,12.3911,12.2947,12.2097,12.1346,12.0723,12.0207,11.9829,11.9569,11.9346,11.921,11.9114,11.8956,11.8895,11.8836,11.8796,11.8793,11.8777,11.871,11.8755,11.8747,11.8749,11.8721,11.8667,11.8659,11.8644,11.8597,11.8602,11.8555,11.8504,11.8535,11.8494,11.8477,11.8428,11.8389,11.8356,11.8317,11.8274,11.8205,11.8162,11.8104,11.8085,11.8025,11.7996,11.7965,11.7904,11.7911,11.7876,11.7834,11.7801,11.774,11.7658,11.7619,11.7572,11.7549,11.7507,11.7437,11.7422,11.7373,11.731,11.7254,11.7227,11.7206,11.7198,11.7156,11.7136,11.7137,11.7105,11.7081,11.708,11.7125,11.7116,11.71,11.7105,11.7091,11.7111,11.708,11.7075,11.705,11.7108,11.7075,11.7121,11.7075,11.7113,11.7122,11.718,11.72,11.7251,11.7244,11.7264,11.7332,11.7342,11.7373,11.7415,11.7413,11.743,11.7498,11.747,11.753,11.7559,11.754,11.7646,11.7615,11.7655,11.7662,11.7668,11.7721,11.7783,11.7797,11.7838,11.7875,11.7927,11.7939,11.7983,11.8002,11.8086,11.8086,11.81,11.8166,11.8164,11.8204,11.8248,11.8243,11.831,11.8326,11.835,11.8438,11.8457,11.8571,11.8584,11.8582,11.8635,11.8707,11.8753,11.8827,11.8836,11.8926,11.897,11.9026,11.9111,11.9118,11.9169,11.9261,11.9353,11.9407,11.9441,11.9499,11.9542,11.9639,11.9676,11.9655,11.9745,11.982,11.985,11.987,11.9949,12.0015,12.0076,12.0135,12.0146,12.0167,12.027,12.0284,12.0329,12.0342,12.0403,12.0462,12.0518,12.06,12.0629,12.0707,12.0747,12.0826,12.0835,12.0916,12.0958,12.0981,12.1049,12.1029,12.117,12.1199,12.1226,12.1265,12.134,12.1333,12.141,12.146,12.1448,12.1626,12.1619,12.1551,12.1629,12.1632,12.1695,12.1684,12.177,12.1744,12.1789,12.1858,12.1862,12.1857,12.1939,12.2003,12.1947,12.1967,12.1988,12.1999,12.2029,12.2089,12.2054,12.2092,12.2128,12.2137,12.2198,12.2242,12.2165,12.2292,12.2257,12.2322,12.2306,12.2397,12.2376,12.2395,12.2384,12.2463,12.2524,12.2479,12.2544,12.256,12.2633,12.2577,12.2595,12.2613,12.2617,12.2721,12.271,12.2662,12.2752,12.2769,12.2765,12.278,12.2807,12.2776,12.282,12.2831,12.2835,12.2857,12.2832,12.287,12.2898,12.2938,12.2915,12.2865,12.3,12.2892,12.2936,12.2915,12.2958,12.2972,12.292,12.2953,12.2962,12.3065,12.3016,12.3085,12.3109,12.3094,12.3143,12.3172,12.3121,12.319,12.3159,12.3307,12.3169,12.3268,12.3214,12.3274,12.3333,12.3237,12.3373,12.3343,12.3345,12.3399,12.3411,12.3362],"sx":[75.6,77.16,78.72,80.28,81.83,83.39,84.95,86.51,88.07,89.63,91.19,92.75,94.31,95.87,97.43,98.99,100.55,102.11,103.67,105.23,106.79,108.35,109.91,111.47,113.02,114.58,116.14,117.7,119.26,120.82,122.38,123.94,125.5,127.06,128.62,130.18,131.74,133.3,134.86,136.42,137.98,139.54,141.1,142.66,144.21,145.77,147.33,148.89,150.45,152.01,153.57,155.13,156.69,158.25,159.81,161.37,162.93,164.49,166.05,167.61,169.17,170.73,172.29,173.84,175.4,176.96,178.52,180.08,181.64,183.2,184.76,186.32,187.88,189.44,191.0,192.56,194.12,195.68,197.24,198.8,200.36,201.92,203.48,205.03,206.59,208.15,209.71,211.27,212.83,214.39,215.95,217.51,219.07,220.63,222.19,223.75,225.31,226.87,228.43,229.99,231.55,233.11,234.67,236.22,237.78,239.34,240.9,242.46,244.02,245.58,247.14,248.7,250.26,251.82,253.38,254.94,256.5,258.06,259.62,261.18,262.74,264.3,265.86,267.41,268.97,270.53,272.09,273.65,275.21,276.77,278.33,279.89,281.45,283.01,284.57,286.13,287.69,289.25,290.81,292.37,293.93,295.49,297.04,298.6,300.16,301.72,303.28,304.84,306.4,307.96,309.52,311.08,312.64,314.2,315.76,317.32,318.88,320.44,322.0,323.56,325.12,326.68,328.23,329.79,331.35,332.91,334.47,336.03,337.59,339.15,340.71,342.27,343.83,345.39,346.95,348.51,350.07,351.63,353.19,354.75,356.31,357.87,359.42,360.98,362.54,364.1,365.66,367.22,368.78,370.34,371.9,373.46,375.02,376.58,378.14,379.7,381.26,382.82,384.38,385.94,387.5,389.06,390.61,392.17,393.73,395.29,396.85,398.41,399.97,401.53,403.09,404.65,406.21,407.77,409.33,410.89,412.45,414.01,415.57,417.13,418.69,420.25,421.8,423.36,424.92,426.48,428.04,429.6,431.16,432.72,434.28,435.84,437.4,438.96,440.52,442.08,443.64,445.2,446.76,448.32,449.88,451.43,452.99,454.55,456.11,457.67,459.23,460.79,462.35,463.91,465.47,467.03,468.59,470.15,471.71,473.27,474.83,476.39,477.95,479.51,481.07,482.62,484.18,485.74,487.3,488.86,490.42,491.98,493.54,495.1,496.66,498.22,499.78,501.34,502.9,504.46,506.02,507.58,509.14,510.7,512.26,513.81,515.37,516.93,518.49,520.05,521.61,523.17,524.73,526.29,527.85,529.41,530.97,532.53,534.09,535.65,537.21,538.77,540.33,541.89],"sy":[401.78,468.16,458.48,472.63,472.52,475.7,478.1,480.02,481.73,483.11,484.33,485.43,486.48,487.53,488.54,489.53,490.47,491.33,492.09,492.76,493.31,493.77,494.1,494.34,494.53,494.65,494.74,494.88,494.93,494.99,495.02,495.02,495.04,495.1,495.06,495.07,495.06,495.09,495.14,495.14,495.16,495.2,495.2,495.24,495.28,495.25,495.29,495.31,495.35,495.38,495.41,495.45,495.49,495.55,495.59,495.64,495.65,495.71,495.73,495.76,495.82,495.81,495.84,495.88,495.91,495.96,496.03,496.07,496.11,496.13,496.17,496.23,496.24,496.29,496.34,496.39,496.42,496.44,496.44,496.48,496.5,496.5,496.53,496.55,496.55,496.51,496.52,496.53,496.53,496.54,496.52,496.55,496.55,496.57,496.52,496.55,496.51,496.55,496.52,496.51,496.46,496.44,496.4,496.4,496.38,496.32,496.31,496.29,496.25,496.25,496.24,496.18,496.2,496.15,496.12,496.14,496.05,496.07,496.04,496.03,496.03,495.98,495.92,495.91,495.87,495.84,495.8,495.78,495.75,495.73,495.65,495.65,495.64,495.58,495.58,495.55,495.51,495.51,495.45,495.44,495.42,495.34,495.32,495.22,495.21,495.21,495.17,495.1,495.06,495.0,494.99,494.91,494.87,494.82,494.74,494.74,494.69,494.61,494.53,494.48,494.45,494.4,494.36,494.27,494.24,494.26,494.18,494.11,494.09,494.07,494.0,493.94,493.88,493.83,493.82,493.8,493.71,493.7,493.66,493.65,493.59,493.54,493.49,493.42,493.39,493.32,493.29,493.22,493.21,493.14,493.1,493.08,493.02,493.04,492.91,492.89,492.86,492.83,492.76,492.77,492.7,492.65,492.67,492.51,492.51,492.57,492.5,492.5,492.45,492.46,492.38,492.4,492.36,492.3,492.3,492.3,492.23,492.17,492.22,492.2,492.18,492.17,492.15,492.09,492.13,492.09,492.06,492.05,492.0,491.96,492.03,491.91,491.95,491.89,491.9,491.82,491.84,491.82,491.83,491.76,491.71,491.75,491.69,491.68,491.61,491.66,491.65,491.63,491.63,491.53,491.54,491.59,491.51,491.49,491.49,491.48,491.46,491.48,491.44,491.44,491.43,491.41,491.43,491.4,491.38,491.34,491.36,491.41,491.29,491.38,491.34,491.36,491.32,491.31,491.36,491.33,491.32,491.23,491.27,491.21,491.19,491.2,491.16,491.13,491.18,491.12,491.14,491.01,491.14,491.05,491.1,491.04,490.99,491.07,490.95,490.98,490.98,490.93,490.92,490.96]}]} 2026-11-27T02:37:43.818709 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ 0 20 40 60 80 100 120 140 This month's volatility (% a year) 0 20 40 60 80 100 120 140 Next month's volatility (% a year) 1. One input, 2020 to 2022: the network bends where the line cannot linear regression network, 8 ReLU units 0 50 100 150 200 250 300 Epoch (passes through the training rows) 12.5 15.0 17.5 20.0 22.5 25.0 27.5 30.0 Typical miss, RMSE (points of % a year) 2. A 256-256 network: training error keeps falling, validation error turns up training years, 2020 to 2022 validation year, 2023
Figure 1. A bent line on one input, and training against validation error epoch by epoch

Table 3 reads off a few epochs.

Table 3. The 256-256 network, typical miss after each epoch (points)
EpochTraining years, 2020 to 2022Validation year, 2023
131.4822.37
1014.7213.22
9413.2911.70
30011.6312.34

After epoch 94 the training error keeps falling, from 13.29 to 11.63, while the validation error rises, from 11.70 to 12.34. From that point on, every step makes the model fit 2020 to 2022 better and 2023 worse: it is learning the particular days, not the pattern. That is overfittingWhen a flexible model follows the noise in its training data too closely, so its predictions on new data are poor., and in a network it shows up over time, during a single fit, not only across model sizes.

The training error ends below linear regression’s (11.63 against 14.98 on the same rows). That number says how well the network remembers the training rows. Only the validation and test rows say how well it predicts.

Three brakes: a weight penalty, stopping early, dropout

All three appear in the books as standard parts of fitting a network, not extras.

  • Weight penalty (ridgeLeast squares with a penalty that shrinks the coefficients towards zero; a tuning parameter sets how strong the shrinking is., or weight decayA penalty on the sum of squared weights, added to the training error, which pulls weights towards zero unless the data supports them.). Add λ∑jθj2\lambda \sum_j \theta_j^2 to the training error, so large weights cost something (ISLP equation 10.31). Bishop and Bishop: it “encourages weight values to decay towards zero, unless supported by the data”, and the size of λ\lambda sets “the effective model complexity” (section 9.2).
  • Early stoppingStop training at the point where the error on validation data is lowest, before the model starts to overfit.. Watch the validation error and keep the weights from its lowest point, epoch 94 in Table 3. Bishop and Bishop show it behaves like a weight penalty (section 9.3.1).
  • DropoutA form of regularisation for neural networks: while fitting, randomly remove a fraction of the units in a layer.. During training, switch off a random share of units for each row, so no unit can rely on a particular partner (ISLP section 10.7.3, Murphy section 13.5.4). scikit-learn’s network has no dropout; the post uses the first two.

Table 4 fits the 256-256 network at four penalty strengths, five random starts each. The strength is scikit-learn’s alpha, which it divides by the number of rows before adding.

Table 4. The 256-256 ReLU network by penalty strength, mean of five random starts (points)
Penalty, alphaTraining yearsValidation yearTest yearsTest, range of five starts
0.0001 (almost none)11.6112.2412.8912.53 to 13.25
1012.4711.6212.3612.13 to 12.67
10013.8111.7012.1912.09 to 12.47
100014.9612.2512.9712.88 to 13.00
Linear regression, for comparison14.9812.2012.92

With almost no penalty the network fits the training years best (11.61) and tests no better than linear regression on average (12.89 against 12.92), with a spread of 0.72 points between its best and worst start. A heavy penalty (1000) takes back the freedom the bend gave: the training miss rises to 14.96, linear regression’s level, and the test miss goes back to the line’s too. In between, the network beats the line.

The validation year picks λ=10\lambda = 10 (lowest validation miss, 11.62), and on the test years that network misses by 12.36\risk{12.36} on average, below linear regression’s 12.92\risk{12.92} in all five starts. The penalty of 100 would have tested slightly better (12.19), but choosing it would mean choosing on the test years, and the test number would then no longer be a test.

The bend helps here, a little, and only with a brake. The penalised network cuts the typical miss by 0.56 points, from 12.92 to 12.36. Linear regression had already cut it by 5.44 points from guessing the average. The unpenalised network, with 68,097 weights, did not beat the line at all.

When a network is the wrong tool

ISLP asks this directly (section 10.6). On a table of 263 baseball players and 19 features, a network with 1,345 parameters scored a test R2R^2 of 0.54 against linear regression’s 0.56, after “a fair bit of time fiddling with the configuration parameters”. Their conclusion is the rule “when faced with several methods that give roughly equivalent performance, pick the simplest”, and they expect deep learningThe branch of machine learning built on neural networks. to be “an attractive choice when the sample size of the training set is extremely large, and when interpretability of the model is not a high priority”.

The volatility data sits near that line. It is tabular (seven numbers per row, each with its own meaning), and the training set is 3,680 rows. Those rows are fewer than they look: six of the seven features, and the target, are computed over windows of several days, so neighbouring days share most of their data. The network won by 0.56 points; to get there it needed a validation year, a search over four penalties and five random starts each, twenty fits to choose one. The linear model’s eight numbers can be read off one by one; the network’s 68,097 cannot.

Try the line first, and let the network earn its place on held-out data. Networks have had their big successes where the input has a structure, such as pixels next to each other or words in order (ISLP section 10.6), with designs built for that structure (Murphy, PML1 section 13.1). A table of features is not that case. And a smaller miss on volatility is a better forecast, not a better trade: the network minimises squared error, which is not what a portfolio is paid for.

Check yourself

A network has three hidden layers of 100 units each and no activation function. What can it represent that linear regression on the same features cannot?

Nothing. Without the bend, each layer’s output is a weighted sum of the one before, and weighted sums of weighted sums multiply out to one intercept and one slope per feature. On the volatility data a 32-32 network without a bend scored 12.92 to 12.94 against linear regression’s 12.92.

The 256-256 network's training error keeps falling after epoch 94. Why stop there?

Because the validation error was lowest there, 11.70, and rose to 12.34 by epoch 300. From epoch 94 the network was fitting the particular days of 2020 to 2022 rather than a pattern that carried over to 2023. Early stopping keeps the weights from the validation minimum.

A penalty of 100 tested better than the chosen 10 (12.19 against 12.36). Why report 12.36?

The penalty was chosen on the validation year, where 10 was best. Picking 100 because it tested better would use the test years to make a choice, and then the test number would no longer measure how the model does on data it has not influenced.

Traps

Table 5. Common mistakes with neural networks
People thinkActually
More layers make a more powerful modelonly with an activation between them; without it, any depth is one linear regression
A lower training error means a better networkthe unpenalised 256-256 network had the lowest training error and tested no better than the line
One fit shows how good the network isfive random starts of the same network tested 0.72 points apart
Networks always beat linear modelson this table of features the gain was 0.56 points, and only with a penalty chosen on held-out data
The test set can choose the settingsthen it is a second validation set, and the reported score is optimistic

The code

The snippet fits linear regression, a network without a bend and a ReLU network on three of the features, for all five tickers. It is shorter than the post’s script: it trains on 2020 to 2023 with no validation year and a fixed penalty, so its numbers are close to, not equal to, the tables.

Table 6. What the snippet’s variables hold
VariableHolds
pxadjusted closes, one column per ticker
rdaily returns, one column per ticker
Xthree features per ticker and day: 5- and 20-day volatility (% a year) and the 20-day return
ythe target: the volatility of the next 20 daily returns (% a year)
train, testrows before 2024, and rows from 2024 on
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.neural_network import MLPRegressor
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

url = "https://raw.githubusercontent.com/ankurtrapasiya/examples/main/data/prices.csv"
px = pd.read_csv(url, index_col="date", parse_dates=True)
r = px.pct_change()
A = np.sqrt(252) * 100                      # daily standard deviation -> % a year

rows = []
for t in px.columns:                        # one row per ticker and day
    rows.append(pd.DataFrame({
        "vol_5d": r[t].rolling(5).std() * A,
        "vol_20d": r[t].rolling(20).std() * A,
        "ret_20d": px[t] / px[t].shift(20) - 1,
        # target: the standard deviation of the NEXT 20 daily returns
        "next_vol": r[t][::-1].rolling(20).std()[::-1].shift(-1) * A,
    }).dropna())
df = pd.concat(rows)
X, y = df[["vol_5d", "vol_20d", "ret_20d"]], df["next_vol"]
train, test = df.index < "2024-01-01", df.index >= "2024-01-01"

def net(activation):
    # scale the features first: a network's gradient steps assume inputs of similar size
    return make_pipeline(StandardScaler(), MLPRegressor(hidden_layer_sizes=(256, 256),
                         activation=activation, alpha=10, max_iter=500, random_state=0))

models = {"linear regression": LinearRegression(),
          "network, no bend": net("identity"),
          "network, ReLU": net("relu")}
for name, m in models.items():
    m.fit(X[train], y[train])
    miss = np.sqrt(np.mean((y[test] - m.predict(X[test])) ** 2))
    print(f"{name:<18} typical miss on 2024-25: {miss:.2f} points")

It prints a typical test miss of 12.79 for linear regression, 12.76 for the network without a bend, and 12.00 for the ReLU network: the same pattern as Tables 2 and 4. Change random_state=0 to another number and the ReLU line moves; the other two barely do.

The script behind the real numbers

The tables and the chart come from examples/neural-networks-linear-regression-stacked-and-bent/neural_net.py, which runs on the blog’s five tickers. To run it yourself, clone the examples repo: its README has a three-command Docker setup, or run uv run neural-networks-linear-regression-stacked-and-bent/neural_net.py.

Summary

Table 7. The ideas, one line each
IdeaWhat it saysOn the volatility data
A hidden unita weighted sum of the features, then a fixed bendReLU keeps a positive sum and sets a negative one to 0
The output layerlinear regression on the hidden units’ valuesthe network builds its own features and fits a line on them
No bend, no gainstacked weighted sums multiply out to one32-32 with no bend: 12.92 to 12.94, the line: 12.92
Fittinggradient descent on squared error, from a random startfive starts of one network tested 0.72 points apart
Overfitting over timetraining error falls while validation error turns upvalidation lowest at epoch 94, then 11.70 to 12.34
Brakesweight penalty, early stopping, dropoutpenalty 10, chosen on 2023: 12.36 against the line’s 12.92
Wrong toolsmall tables of features rarely repay a networka 0.56-point gain for 68,097 weights instead of 8

References

  • James, Witten, Hastie, Tibshirani and Taylor, An Introduction to Statistical Learning, with Applications in Python (Springer, 2023), chapter 10: the single-layer network and its activations (section 10.1, equations 10.1 to 10.5), the collapse without a nonlinearity (section 10.1), when to use deep learning and the baseball comparison (section 10.6, Table 10.2), fitting by gradient descent and backpropagation (sections 10.7 and 10.7.1, equations 10.25 and 10.27), minibatches, the ridge penalty and early stopping (section 10.7.2, equation 10.31), dropout (section 10.7.3)
  • Christopher M. Bishop and Hugh Bishop, Deep Learning: Foundations and Concepts (Springer, 2024): hidden units as learnable basis functions (section 6.2), the equivalent network without hidden units when activations are linear (section 6.2.3), weight decay (section 9.2), early stopping (section 9.3.1)
  • Kevin P. Murphy, Probabilistic Machine Learning: An Introduction (MIT Press, 2022), chapter 13: tabular data against unstructured data (section 13.1), linear activations reducing to a linear model (section 13.2.3, equation 13.10), the universal approximator (section 13.2.5), early stopping, weight decay and dropout (sections 13.5.1, 13.5.2, 13.5.4)
  • scikit-learn, MLPRegressor: the alpha penalty divided by the number of rows, and the default batch of 200 rows
Tagged machine-learning, neural-networks← Home