Questions tagged [logistic-regression]

Logistic regression is a statistical classification model used for making categorical predictions.

Logistic regression is a statistical analysis method used for predicting and understanding categorical dependent variables (e.g., true/false, or multinomial outcomes) based on one or more independent variables (e.g., predictors, features, or attributes). The probabilities describing the possible outcomes of a single trial are modeled as a function of the predictors using a logistic function (as it follows):

enter image description here

A logistic regression model can be represented by:

enter image description here

The logistic regression model has the nice property that the exponentiated regression coefficients can be interpreted as odds ratios associated with a one unit increase in the predictor.

Multinomial logistic regression (i.e., with three or more possible outcomes) are also sometimes called Maximum Entropy (MaxEnt) classifiers in the machine learning literature.


Tag usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

3746 questions
1
vote
1 answer

why my roc curve plot weird

I am trying to write a logistic regression with L1 regularization and implement the roc curve.I use stochastic gradient ascend of log-likelihood as the cost function. But the roc curve I plot is weird. My data set is from…
song
  • 31
  • 1
  • 4
1
vote
0 answers

Getting predictions in Logistic Regression (tf)

I am new to Tensorflow and I still have troubles understanding how it works. I saw some examples but I am still not sure. I am trying to print the predictions and the accuracy. I have this code: def linear_function(x, w, b): y_est =…
Valeria
  • 1,508
  • 4
  • 20
  • 44
1
vote
0 answers

R manually change coefficient of nnet::multinom model object

How do I manually change the coefficient of an R nnet::multinom model object? I tried : S = summary(multi_mod) S$coefficients = coef_hitl But if I check out the multi_mod object, the coefficient is NOT changed. Also, is there a nice Matrix format…
Chenying Gao
  • 310
  • 4
  • 14
1
vote
0 answers

To find if there is any difference between two groups: Logistic regression vs. t test

To find if there is any difference of mean between two group, we use t test as below. I use mtcars dataset. df<-mtcars %>% dplyr::select(hp, vs) t.test(hp~vs, data=df) Welch Two Sample t-test data: hp by vs t = 6.2908, df = 23.561, p-value =…
zesla
  • 11,155
  • 16
  • 82
  • 147
1
vote
1 answer

Machine learning, Do unbalanced non-numeric variable classes matter

If I have a non-numeric variable in my data set that contains many of one class but few of another does this cause the same issues as when the target classes are unbalanced? For example if one of my variables was title and the aim was to identify…
1
vote
1 answer

How to pass nlpr (n parameter logistic regression) to stat_smooth in ggplot?

My data is as follows # A tibble: 24 x 3 time OD600 strain 1 0.0001 0.0001 M12-611020 2 1.0000 0.0880 M12-611020 3 3.0000 0.2110 M12-611020 4 4.0000 0.2780 M12-611020 5 4.5000 0.4040 M12-611020 6 5.0000…
reubenmcg
  • 371
  • 4
  • 18
1
vote
0 answers

Regression Kriging of binomial data in geoRglm R package

I am using binom.krige() function of the R package geoRglm for determining the spatial predictions of a binary (0, 1) response variable with several continuous as well as discrete covariates. Using glm() with binomial logit link function I found…
Asad Ali
  • 25
  • 6
1
vote
2 answers

confusing results with logistic regression in python

I'm doing logistic regression in Python with this example from wikipedia. link to example here's the code I have: from sklearn.linear_model import LogisticRegression lr = LogisticRegression() Z = [[0.5], [0.75], [1.0], [1.25], [1.5], [1.75], [1.75],…
DoctorEvil
  • 453
  • 3
  • 6
  • 18
1
vote
1 answer

Unable to evaluate score using decision_function() in Logistic Regression

I'm doing this Univ. Of Washington assignment where i have to predict the score of sample_test_matrix (last few lines) using decision_function() in LogisticRegression . But the error that i'm getting is ValueError: X has 145 features per…
harshi
  • 343
  • 2
  • 4
  • 10
1
vote
2 answers

Logistic Regression - ValueError: classification metrics can't handle a mix of continuous-multi output and binary targets

I'm a data science noob and am working on the Kaggle Titanic dataset. I'm running a Logistic Regression on it to predict whether passengers in the test data set survived or died. I clean both the training and test data and run the Logistic…
1
vote
1 answer

Why does scikit-learn Logistic Regression works well even feature number is much larger than sample number

Recently, I'm working on some projects and obtain 30 positive samples and 30 negative samples. Each of them has 128 features (128 dimensional). I used "LeaveOneOut" and "sklearn.linear_model.LogisticRegression" to classify these samples and obtained…
Ping Luo
  • 21
  • 2
1
vote
1 answer

Plotting predictions from a logistic regression

I am trying to plot a logistic regression in R. I currently have this code... mylogit<- glm(Breeding.success ~ Dam.Age, family = binomial, data = captive) summary(mylogit) predicted.data<- as.data.frame(predict(mylogit, type="response",…
Amy Iveson
  • 23
  • 4
1
vote
2 answers

scikit-learn - multinomial logistic regression with probabilities as a target variable

I'm implementing a multinomial logistic regression model in Python using scikit-learn. The thing is, however, that I'd like to use probability distribution for classes of my target variable. As an example let's say that this is a 3-classes variable…
1
vote
0 answers

Can MICE pool complete GLM output binary logistic regression?

I am running a logistic regression with a binary outcome variable on data that has been multiply imputed using MICE. It seems straightforward to pool the coefficients of the glm model: imp=mice(nhanes2, print=F) imp$meth fit0=with(data=imp,…
user81715
  • 67
  • 1
  • 1
  • 11
1
vote
2 answers

Stepwise regression error in R

I want to run a stepwise regression in R to choose the best fit model, my code is attached here: full.modelfixed <- glm(died_ed ~ age_1 + gender + race + insurance + injury + ais + blunt_pen + comorbid + iss +min_dist + pop_dens_new…
mandy
  • 483
  • 9
  • 20