Cross Validated
2021-06-29 20:06 UTC
Score 22.0
AI-113-20210629-social-media-c34b95d9
Full article
I have no idea if my logistic regression is reasonable or correct. I analyze horse racing as a hobby and have read about logistic regression in pretty much every paper I have read, so I thought I'd give it a shot. I get the basics of it: A linear regression is not suitable for classification problems since a linear regression will produce values above 1 and below 0! Hence, logistic regression fixes this issue. I've scatter plotted my variables and fitted a line to it, which is on the form y = B0+X1*B1 , where X1 is my independent variable (in this case the sortPriority/ postPosition of the horse). I know that the formula for logistic regression is on the form p = 1/(1+e^(-y)) . The scatter looks like this: Blue is linear regression, orange "is" logistic regression and the green marks are my data points. The code I used is as follows: m, b = np.polyfit(sortedDataframe[stuffToEstimate],Binary_runnerResult,1) plt.scatter(sortedDataframe[stuffToEstimate],Binary_runnerResult,marker='+', color = 'green') Where m is the intercept and b is the slope of the fitted line. plt.plot(np.linspace(0,500,1000),[b+m*i for i in np.linspace(0,500,1000)]) plt.plot(np.linspace(0,500,1000),[1/(1+np.e**(-(b+m*i))) for i in np.linspace(0,500,1000)]) Now, this might be a stupid question, but does this even look somewhat reasonable/ correct? In all the tutorials I've watched they all get this really nice S-shape, which makes sense because their datasets "looks cleaner" than mine. This might be because…