def QuarticRegression(XTrain, yTrain, XTest, bw):
    K = compute_kernel(XTrain, XTest, bw, 'Quartic')
    Ksum = KDE(XTrain, XTest, bw, 'Quartic')
    y = (K.T.dot(yTrain) / Ksum)
    y[np.isnan(y)] = np.mean(yTrain)
    return np.round(y)
def EpanechnikovRegression(XTrain, yTrain, XTest, bw):
    K = compute_kernel(XTrain, XTest, bw, 'Epanechnikov')
    Ksum = KDE(XTrain, XTest, bw, 'Epanechnikov')
    y = (K.T.dot(yTrain) / Ksum)
    y[np.isnan(y)] = np.mean(yTrain)
    return np.round(y)
Beispiel #3
0
 def df(y0):
     e = KDE(self.endog[:,self.idcs(base)])
     # the derivative index is relative to the given base which is sometimes not the overall base (e.g. base = cond in dcf1)
     idcs1 = np.where([bi in self.idcs(derivative) for bi in self.idcs(base)])[0]
     return np.array(list(map(lambda i: e.dpdf(y0, i), idcs1)))
def BoxCarRegression(XTrain, yTrain, XTest, bw):
    K = compute_kernel(XTrain, XTest, bw, 'boxcar')
    Ksum = KDE(XTrain, XTest, bw, 'boxcar')
    y = (K.T.dot(yTrain) / Ksum)
    y[np.isnan(y)] = np.mean(yTrain)
    return np.round(y)
Beispiel #5
0
 def f(y0):
     e = KDE(self.endog[:,self.idcs(base)])
     return e.pdf(y0)