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 can I check feature values for a predict value in sklearn

I am doing a binary classification, predicted values are 0 and 1, is there is any way to get features values for a prediction value. for eg: I have 2 features 'Age' and 'Salary' and target value is 'purchased'. Age Salary Purchased 19 19000 …
1
vote
1 answer

How to get kfold splits for cross validation from scratch in python?

I think I've split my training data in 5 kold, is there a way for me to label/identify each of the 5 splits so I can then send each into my algorithm to calculate their own accuracies? from sklearn.model_selection import KFold kf =…
1
vote
0 answers

LinAlgError: Singular matrix while running logit model

In my dataset aps1, my target variable is class and I have 50 independent features. I'm running the following code to run the model: import numpy as np import statsmodels.api as sm model1= sm.Logit(aps1['class'],aps1.iloc[:,1:51]) This works fine.…
IndigoChild
  • 842
  • 3
  • 11
  • 29
1
vote
2 answers

using the boxTidwell function in the CAR package and getting a bizarre error

I am trying to use the boxTidwell function in the CAR package in r to run a number of tests on continuous data. My data looks something like this: Gender Age X1 X2 Outcome M 20.1 1.23 4.43 1 F 19.5 2.33 3.21 0 M…
user183974
  • 173
  • 9
1
vote
2 answers

log regression code explanation from Coursera's "Reproducible Research" class

while taking Coursera's "Reproducible Research" class, I had trouble understanding the code the instructor used for a logarithmic regression. This code is using data from the kernlab library's spam dataset. This data classifies 4601 e-mails as spam…
mutaween464
  • 253
  • 2
  • 8
1
vote
2 answers

Unexpected behavior in Julia boolean comparison

I'm testing different parametrization of the CDF of the logistic function and comparing the results and the effect on the curve of the different parameters. using Distributions # Vector of x to test the different functions x = collect(0:20) Logis…
Alejo
  • 13
  • 3
1
vote
1 answer

Text Classification with scikit-learn: how to get a new document's representation from a pickle model

I have a document binomial classifier that uses a tf-idf representation of a training set of documents and applies Logistic Regression to it: lr_tfidf = Pipeline([('vect', tfidf),('clf', LogisticRegression(random_state=0))]) lr_tfidf.fit(X_train,…
1
vote
1 answer

Non working Spark example in Scala, LogisticRegressionTrainingSummary

I tried to implement this example for multinomial logistic regression, but it doesn't recognize features that are being used. Probably some version mismatch. This part of code: trainingSummary.falsePositiveRateByLabel.zipWithIndex.foreach { case…
1
vote
1 answer

How to get coefficients of multinomial logistic regression?

I need to calculate coefficients of a multiple logistic regression using sklearn: X = x1 x2 x3 x4 x5 x6 0.300000 0.100000 0.0 0.0000 0.5 0.0 0.000000 0.006000 0.0 0.0000 0.2 0.0 0.010000 …
Markus
  • 3,562
  • 12
  • 48
  • 85
1
vote
0 answers

Any workaround to program incremental SGD algorithm sequentially for logistic regression?

I am trying to program incremental stochastic gradient descent (ISGD) algorithm in logistic regression. Initially, I coded respective logistic regression' loss function and its gradient, also got some idea to proceed rest of workflow. But, I have no…
1
vote
1 answer

Plotting multiple effect plots from logistic regression

I have a number of logistic regression models with different response variables but the same predictor variables. I want to use grid.arrange (or anything else) to make a single figure with all these effect plots that were made with the effects…
person
  • 45
  • 7
1
vote
0 answers

Running in spark MLlib in Databricks , how to interpret the one more weighs in logistic regression

I have 12 feature variables, but why are there 13 weighs shown here for logistic regression in spark MLlib Databricks? How can I interpret it? Following this link it says: "intercept – Intercept computed for this model. (Only used in Binary…
1
vote
0 answers

Logistic regression in SQL

Can someone give me pointers on any resources/implementation ideas for logistic regression on core SQL server. I am aware of R algorithms but looking for SQL implementations.
1
vote
0 answers

Error in if (object$offset) { : argument is of length zero in relaxnet R package

I want to perform a cross validation to select tuning parameter for relaxed lasso model using relaxnet package. Below I have attached a sample code that is closely related to the one from relaxnet vignette but with a two level factor as a response…
1
vote
0 answers

Plotting and ranking logistic regression coefficients in python?

Hi I am a beginner in coding in python and machine learning and I am trying to learn about what goes on under the hood of logistic regression and making it run in python from scratch. I have been tasked with plotting and ranking the…
DN1
  • 234
  • 1
  • 13
  • 38