I'm trying to understand how does the KernelDensity class in scikit-learn work. Consider the following two cases which build a kernel from two different arrays (a). I'm wondering why the result of scoring on the array b in both cases is the same? Shouldn't a kernel from 10 same points be different from that from 2 points? The one from the 10 points should indicate more density. So, why the final scoring result is the same in both cases?
*) casecase A:
a = np.array([[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]])
kde = KernelDensity(bandwidth=0.1)
kde.fit(a)
b = np.array([[1]])
log_dens = kde.score_samples(b)
print('Probability is: {}'.format(np.exp(log_dens)))
Probability is: [3.9894228]
*) casecase B:
a = np.array([[1],[1]])
kde = KernelDensity(bandwidth=0.1)
kde.fit(a)
b = np.array([[1]])
log_dens = kde.score_samples(b)
print('Probability is: {}'.format(np.exp(log_dens)))
Probability is: [3.9894228]