In other words, the prediction IˆkNN is a linear function of the time series values that PHA-680632 follow the nearest neighbors time stamps τi. The weights α are function of the distance Ds for the nearest neighbors:equation(17)αi=(1−Ds,imaxDs−minDs)n,i=1,?,kwhere n is an adjustable positive integer parameter. If n = 0 the weights are equal to 1 and all the k nearest neighbors are equally weighted, if n = 1 the k nearest neighbors are linearly weighted, with the closest neighbor with unit weight and the farthest neighbor with 0 weight.
3.2.4. kNN optimization
To obtain the kNN forecast from the algorithm described above several parameters need to be specified:1.the number of nearest neighbors, k∈ 1,2,?,150 .2.The set of features S, i.e., which features are used in the search for the nearest neighbors. The set of selected features can contain the same feature twice but with different lengths. In this context the GHI backward average from 5 min to 30 min, for example, is considered a different variable than the GHI backward average from 5 min to 60 min. The different lengths are considered through the Ni in Eq. (12). It is important to leave this parameter free as Langerhans' cells is likely that some lengths will be more appropriate than others for different forecast horizons.3.The weights ω∈ 1,2,?,10 in the calculation of D in Eq. (13).4.The exponent n∈ 1,2,?,5 for the weights αi in Eq. (17).