logistic-regression

What does sklearn “RidgeClassifier” do?

坚强是说给别人听的谎言 提交于 2020-08-01 12:23:21
问题 I'm trying to understand the difference between RidgeClassifier and LogisticRegression in sklearn.linear_model . I couldn't find it in the documentation. I think I understand quite well what the LogisticRegression does.It computes the coefficients and intercept to minimise half of sum of squares of the coefficients + C times the binary cross-entropy loss , where C is the regularisation parameter. I checked against a naive implementation from scratch, and results coincide. Results of

What does sklearn “RidgeClassifier” do?

╄→尐↘猪︶ㄣ 提交于 2020-08-01 12:22:28
问题 I'm trying to understand the difference between RidgeClassifier and LogisticRegression in sklearn.linear_model . I couldn't find it in the documentation. I think I understand quite well what the LogisticRegression does.It computes the coefficients and intercept to minimise half of sum of squares of the coefficients + C times the binary cross-entropy loss , where C is the regularisation parameter. I checked against a naive implementation from scratch, and results coincide. Results of

Statsmodels Anova for logistic regression

会有一股神秘感。 提交于 2020-07-20 07:47:28
问题 I found the statsmodels implementation of the anova testing for linear models to be very useful (http://www.statsmodels.org/dev/generated/statsmodels.stats.anova.anova_lm.html#statsmodels.stats.anova.anova_lm) but I was wondering, since it's not present in the library, how one could approach building the equivalent version for the logistic regression part. formulas : from statsmodels.formula.api import ols, logit import statsmodels.api as sm ols(formula_str, data=data_on_which_to_perform

Error with using mlogit R function: “The two indexes don't define unique observations”

扶醉桌前 提交于 2020-07-10 09:00:08
问题 My dataset look like this ID choice_situation Alternative Attr1 Attr2 Attr3 choice ID_1 1 1 0 0 0 0 ID_1 1 2 1 1 0 1 ID_1 2 1 1 1 0 0 ID_1 2 2 1 1 1 1 ID_1 3 1 2 1 0 1 ID_1 3 2 3 1 0 0 ID_2 1 1 3 0 1 1 ID_2 1 2 0 0 0 0 ID_2 2 1 2 1 1 0 ID_2 2 2 2 1 1 1 ID_2 3 1 0 0 0 1 ID_2 3 2 0 0 1 0 ..... Every time I run the code of mlogit function DCE_data<- mlogit.data(data=dataset, choice = "choice", shape = "long", alt.var = "Alternative", id.var = "ID") #ok model<- mlogit(choice ~ Attr1 + Attr2 +

Getting a subset error I did not get two months ago when running logistic regression (svyglm) on survey data (SPSS dataset)

我怕爱的太早我们不能终老 提交于 2020-06-28 04:00:07
问题 I re-run script that previously worked with no errors about two months ago. I used the haven package to upload an (non-public and proprietary) SPSS dataset and the survey package to analyze complex survey data. Now, however, when I run even a simple logistic regression where both variables are dummies (coded 0 for no and 1 for yes)...something like this... f <- read_sav("~/data.sav") fsd <- svydesign(ids=~1, data=f, weights=~f$weight) model <- svyglm(exclhlth~male,design=fsd,family

Is there an R-package to calculate pseudo R-squared measures for conditional (fixed effects) logistic models using clogit or bife?

坚强是说给别人听的谎言 提交于 2020-06-25 06:33:52
问题 Is there a R-package to calculate pseudo R-squared measures for my model? rcompanion neither supports clogit nor bife (due to missing intercept?). Originally that was one question out of a larger context, which I edited to make it more readable. Thanks in advance for your help! 回答1: Relative to question 5: Definitions for pseudo r-squared values based (mostly) on log likelihood values are given by UCLA IDRE. If you are able to extract the log likelihood from the fitted model and null model,

Is there an R-package to calculate pseudo R-squared measures for conditional (fixed effects) logistic models using clogit or bife?

那年仲夏 提交于 2020-06-25 06:33:14
问题 Is there a R-package to calculate pseudo R-squared measures for my model? rcompanion neither supports clogit nor bife (due to missing intercept?). Originally that was one question out of a larger context, which I edited to make it more readable. Thanks in advance for your help! 回答1: Relative to question 5: Definitions for pseudo r-squared values based (mostly) on log likelihood values are given by UCLA IDRE. If you are able to extract the log likelihood from the fitted model and null model,

Confidence interval of probability prediction from logistic regression statsmodels

◇◆丶佛笑我妖孽 提交于 2020-06-24 03:02:19
问题 I'm trying to recreate a plot from An Introduction to Statistical Learning and I'm having trouble figuring out how to calculate the confidence interval for a probability prediction. Specifically, I'm trying to recreate the right-hand panel of this figure (figure 7.1) which is predicting the probability that wage>250 based on a degree 4 polynomial of age with associated 95% confidence intervals. The wage data is here if anyone cares. I can predict and plot the predicted probabilities fine with

How to calculate logistic regression accuracy

浪尽此生 提交于 2020-06-16 04:45:08
问题 I am a complete beginner in machine learning and coding in python, and I have been tasked with coding logistic regression from scratch to understand what happens under the hood. So far I have coded for the hypothesis function, cost function and gradient descent, and then coded for the logistic regression. However on coding for printing the accuracy I get a low output (0.69) which doesnt change with increasing iterations or changing the learning rate. My question is, is there a problem with my

Interpreting coefficientMatrix, interceptVector and Confusion matrix on multinomial logistic regression

大城市里の小女人 提交于 2020-06-13 08:11:53
问题 Can anyone explain how to interpret coefficientMatrix , interceptVector , Confusion matrix of a multinomial logistic regression . According to Spark documentation: Multiclass classification is supported via multinomial logistic (softmax) regression. In multinomial logistic regression, the algorithm produces K sets of coefficients, or a matrix of dimension K×J where K is the number of outcome classes and J is the number of features. If the algorithm is fit with an intercept term then a length