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

How to simulate a dataset with a binary target in proportions determined 'a-priori'?

Can someone tell me what is the best way to simulate a dataset with a binary target? I understand the way in which a dataset can be simulated but what I'm looking for is to determine 'a-priori' the proportion of each class. What I thought was to…
c0chi
  • 11
  • 3
1
vote
1 answer

Logistic regression cost change turns constant

After just a few iterations of gradient descent, the cost function change turns constant which is most definitely how it should not perform: The initial result of the gradient descent function seems correct, as does the result of the cost function…
1
vote
1 answer

R logistic regression and marginal effects - how to exclude NA values in categorical independent variable

I am a beginner with R. I am using glm to conduct logistic regression and then using the 'margins' package to calculate marginal effects but I don't seem to be able to exclude the missing values in my categorical independent variable. I have tried…
user9950376
1
vote
1 answer

coefficient from logistic regression to write function in python

I just completed logistic regression. The data can be downloaded from below link: pleas click this link to download the data Below is the code to logistic regression. from sklearn.linear_model import LogisticRegression from sklearn.model_selection…
1
vote
1 answer

Multiclass classification error metrics in Apache Spark

Is it possible to find the error metrics(precision and recall) in a multiclass classification problem in Apache Spark. I am using Logistic Regression from Spark's MlLib to build my model and want to evaluate my model using the error metrics.
1
vote
1 answer

Extract Probability and SE from Logistic Regression

I have a dataset of choices on a task (either 1 or 0) given a variable x. To use mtcars as an example #binomial_smooth() from https://ggplot2.tidyverse.org/reference/geom_smooth.html binomial_smooth <- function(...) { geom_smooth(method = "glm",…
Robert Hickman
  • 869
  • 1
  • 6
  • 22
1
vote
1 answer

FTRL optimizer in tensorflow seems not work well

Tried to training LR model on a large scale dataset via tensorflow with FTRL optimizer for a ctr task. tensorflow/sklearn auc and training/evaluation auc are OK. But performance in product is not good. I've tried to lower down the distributed level,…
mia ich
  • 55
  • 8
1
vote
1 answer

python - multi class logistic regression to predict season

I want to complete my logistic regresson algorithm which predicts the annual season based on the store name and purchase category (see below for sample data, and note the label encoding. Store name is any typical string while categories, tops, is…
1
vote
0 answers

Plotting categorical variable in logistic regression random effect GLMM

first a bit of background to my question: I have been working with a fairly large data set of animals escaping from holding enclosures (2000+ observations across 6 sites, with ~20 categorical/continuous variables) and have run a logistic regression…
1
vote
0 answers

Logistic Regression classifier in Keras

I am training 2000 Logistic Regression classifiers using keras. The inputs for each classifier are: for training: vectors: 8250X50, labels:8250 for validation:2750X50, labels:2750 for testing:3000X50, labels:3000 for every classifier, I save the…
Abrar
  • 621
  • 1
  • 9
  • 17
1
vote
1 answer

Variable importance in Caret

I am using the Caret package in R for training logistic regression model for a binary classification problem. I have been able to get the results, accuracy, etc., but I also want the importance of the variables (in decreasing order of importance). I…
Layale
  • 153
  • 1
  • 9
1
vote
1 answer

Interpreting coefficientMatrix, interceptVector and Confusion matrix on multinomial logistic regression

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.…
1
vote
1 answer

bivariate Probit/logit R : how to find ALL coefficients and marginal effects with the "zeligverse" package

I am running a bivariate logit model in R with the zeligverse package.I want to calculate the impact of my independant variables on P(Y1=1), P(Y2=1), P(Y1=1,Y2=0), P(Y1=1,Y2=1), P(Y1=0,Y2=1), P(Y1=0,Y2=0), P(Y1=1|Y2=0) and all the other…
1
vote
2 answers

Scikit-learn's logistic regression is performing poorer than self-written logistic regression in Python

I have written my code for logistic regression in python and compared its results with Scikit-learn's logistic regression. Later is performing worse on a simple one dimensional sample data as showcased below: My logistic import pandas as pd import…
1
vote
1 answer

TypeError: 'Data argument can't be an iterator...'

Im trying to use the zip function to bring the column names together and the np.transpose function to bring together the coefficients of the log_model I created. My code: # Create LogisticRegression model object log_model = LogisticRegression() #…