Created
March 10, 2013 15:10
-
-
Save Wizmann/5128933 to your computer and use it in GitHub Desktop.
KDE with ``numpy``, ``scipy`` und ``matplotlib``
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
import sys,re,os | |
import numpy as np | |
from scipy import stats | |
import matplotlib.pylab as plt | |
def draw_kde(grade): | |
gkde = stats.kde.gaussian_kde(grade) | |
ind = np.arange(0.,100.,0.01) | |
plt.plot(ind, gkde(ind), label='Gods\' Grade', color="g") | |
plt.title('Kernel Density Estimation') | |
plt.legend() | |
plt.show() | |
if __name__ == '__main__': | |
with open("grade.txt") as grade_list: | |
grade = [float(line.split("\t")[1]) for line in grade_list] | |
draw_kde(grade) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment