Trusted, Automoderated users
398
edits
Line 73: | Line 73: | ||
<code> | <code> | ||
from numpy import exp | from numpy import exp | ||
def rhode(x,b): return x*(b-1)/(b-x) | def rhode(x,b): return x*(b-1)/(b-x) | ||
def chotikapanich(x,b): return (exp(b*x)-1)/(exp(b)-1) | def chotikapanich(x,b): return (exp(b*x)-1)/(exp(b)-1) | ||
def pareto(x,b): return 1-(1-x)**(1-1/b) | def pareto(x,b): return 1-(1-x)**(1-1/b) | ||
import matplotlib.pyplot as plt | |||
from scipy.optimize import curve_fit | import matplotlib.pyplot as plt | ||
from numpy import array | from scipy.optimize import curve_fit | ||
xdata = array([0,0.5,0.9,0.95,0.99,1]) | from numpy import array | ||
ydata = array([0,0.043,0.42,0.589,0.836,1]) | |||
def demo(func): | xdata = array([0,0.5,0.9,0.95,0.99,1]) | ||
ydata = array([0,0.043,0.42,0.589,0.836,1]) | |||
def demo(func): | |||
plt.plot(xdata, ydata, 'b-', label='data') | |||
popt, pcov = curve_fit(func, xdata, ydata, bounds=(0, 1000)) | |||
plt.plot(xdata, func(xdata, *popt), 'r-', | |||
label='fit: b=%5.3f' % tuple(popt)) | |||
plt.xlabel('x') | |||
demo(rhode) | plt.ylabel('y') | ||
demo(chotikapanich) | plt.legend() | ||
demo(pareto) | plt.show() | ||
demo(rhode) | |||
demo(chotikapanich) | |||
demo(pareto) | |||
</code> | </code> | ||
Also extending this to the Tinder Distribution Study, 5.952 C-index works better than 1.119 as Rhode's coefficient, as Rhode's often underpredict the power of the top 20% of men. | Also extending this to the Tinder Distribution Study, 5.952 C-index works better than 1.119 as Rhode's coefficient, as Rhode's often underpredict the power of the top 20% of men. |