The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Logistic Regression with p_values

Logistic Regression with p_values

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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