Last answered:

14 Apr 2020

Posted on:

12 Apr 2020

0

Logistic Regression with p_values

I'm sorry for this again, but here's the code which I exactly copied from the video:

def fit(self, X, y):
self.model.fit(X,y)
denom = (2.0 * (1.0 + np.cosh(self.model.decision_function(X))))
denom = np.tile(denom, (X.shape[1],1)).T
F_ij = np.dot((X / denom).T,X)
Cramer_Rao = np.linalg.inv(F_ij)
sigma_estimates = np.sqrt(np.diagonal(Cramer_Rao))
z_scores = self.model.coef_[0] / sigma_estimates
p_values = [stat.norm.sf(abs(X)) * 2 for x in z_scores]
self.coef_ = self.model.coef_
self.intercept_ = self.model.intercept_
self.p_values = p_values

Now the problem with this is when I'm assigning reg.p_values to a variable, the variable seems to be a humongous array of length 94, each containing 200000 values and then again these 200000 values contain 94 each.

Also the values are repeating.

Here's the link null

1 answers ( 0 marked as helpful)
Instructor
Posted on:

14 Apr 2020

0
Hi Pranit, I see what you mean. That's rather strange, could you please also show a screenshot of your code a bit before that (so I can see how you define the class and the regression)? Best,
Iliya

Submit an answer