@@ -0,0 +1,1233 @@
+from scipy.stats import binom%0Aimport pandas as pd%0Aimport numpy%0A%0Adef newton(num_theta,sampleEntry,sampleHospital):%0A    theta = numpy.zeros(num_theta)%0A    for _ in range(100):%0A        theta = df(theta,sampleEntry,sampleHospital)%0A        %0Adef kernel(x,x2):%0A    numpy.exp(-(x-x2)**2/2*h**2)%0A    %0Adef df(thetas,sampleEntry,sampleHospital):%0A    sum_basis_result = numpy.zeros(len(thetas))%0A    for x in sampleEntry:%0A        basis_result = %5B%5D%0A        for idx in range(len(thetas)):%0A            basis_result.append(kernel(x,sample%5Bidx%5D))%0A        sum_basis_result += basis_result%0A    sum_basis_result /= len(thetas)%0A    %0A    %0A    sum_basis_result2 = numpy.zeros(len(thetas))%0A    for x in sampleHospital:%0A        basis_result = %5B%5D%0A        for idx in range(len(thetas)):%0A            basis_result.append(kernel(x,sample%5Bidx%5D))%0A        sum_basis_result2 += basis_result / (thetas * basis_result)%0A    sum_basis_result2 /= len(thetas)%0A    %0A    %0A    return sum_basis_result - sum_basis_result2%0A%0Adef main():%0A    x0 = 0.0    #%E6%9C%80%E5%88%9D%E3%81%AEx%E3%81%AE%E5%80%A4%0A    num = %5Bx0%5D%0A    newton(x0, num)%0A    print num%0A    %0Asample_entry = %5B1%5D * 10 + %5B0%5D * 1000%0Asample_hospital = %5B1%5D * 10 + %5B0%5D * 1000%0A%0Asample = pd.DataFrame(%7B%22entry%22:sample_entry,%22hospital%22:sample_hospital%7D)%0A%0Aprint sample%0A

add dre.py