Questions tagged [logistic-regression]

Refers generally to statistical procedures that utilize the logistic function, most commonly various forms of logistic regression

Filter by
Sorted by
Tagged with
28 votes
4 answers
45k views

Scikit-learn: Getting SGDClassifier to predict as well as a Logistic Regression

A way to train a Logistic Regression is by using stochastic gradient descent, which scikit-learn offers an interface to. What I would like to do is take a scikit-learn's SGDClassifier and have it ...
user avatar
  • 655
27 votes
3 answers
108k views

How to get p-value and confident interval in LogisticRegression with sklearn?

I am building a multinomial logistic regression with sklearn (LogisticRegression). But after it finishes, how can I get a p-value and confident interval of my model? It only appears that sklearn only ...
user avatar
  • 371
24 votes
2 answers
17k views

Text categorization: combining different kind of features

The problem I am tackling is categorizing short texts into multiple classes. My current approach is to use tf-idf weighted term frequencies and learn a simple linear classifier (logistic regression). ...
user avatar
  • 341
22 votes
3 answers
36k views

Python implementation of cost function in logistic regression: why dot multiplication in one expression but element-wise multiplication in another

I have a very basic question which relates to Python, numpy and multiplication of matrices in the setting of logistic regression. First, let me apologise for not using math notation. I am confused ...
user avatar
21 votes
3 answers
9k views

Linear regression with non-symmetric cost function?

I want to predict some value $Y(x)$ and I am trying to get some prediction $\hat Y(x)$ that optimizes between being as low as possible, but still being larger than $Y(x)$. In other words: $$\text{cost}...
user avatar
20 votes
1 answer
4k views

What does it mean to "share parameters between features and classes"

When reading this paper there is a line which says "linear classifiers do not share parameters among features and classes." What is the meaning of this statement? Does it mean that linear ...
user avatar
19 votes
4 answers
11k views

Is logistic regression actually a regression algorithm?

The usual definition of regression (as far as I am aware) is predicting a continuous output variable from a given set of input variables. Logistic regression is a binary classification algorithm, so ...
user avatar
  • 476
19 votes
5 answers
28k views

Choose binary classification algorithm

I have a binary classification problem: Approximately 1000 samples in training set 10 attributes, including binary, numeric and categorical Which algorithm is the best choice for this type of ...
user avatar
  • 5,214
16 votes
4 answers
47k views

Should I use a decision tree or logistic regression for classification?

I am working on a classification problem. I have a dataset containing equal numbers of categorical variables and continuous variables. How do I decide which technique to use, between a decision tree ...
user avatar
  • 707
16 votes
2 answers
6k views

Binary classification model for unbalanced data

I have a dataset with the following specifications: Training dataset with 193,176 samples with 2,821 positives Test Dataset with 82,887 samples with 673 positives There are 10 features. I want to ...
user avatar
  • 3,785
15 votes
2 answers
18k views

Does scikit-learn use regularization by default?

I just fitted a logistic curve to some fake data. I made the data essentially a step function. data = -------------++++++++++++++ But when I look at the fitted ...
user avatar
13 votes
1 answer
7k views

What is the difference in xgboost binary:logistic and reg:logistic

What is the difference in R in xgboost between binary:logistic and reg:logistic? Is it only in evaluation metric? If yes, how does RMSE on binary classification compare to error rate? Is the ...
user avatar
12 votes
2 answers
3k views

The differences between SVM and Logistic Regression

I am reading about SVM and I've faced to the point that non-kernelized SVMs are nothing more than linear separators. Therefore, ...
user avatar
  • 5,654
12 votes
1 answer
19k views

How do I implement the sigmoid function in Octave? [closed]

so given that the sigmoid function is defined as hθ(x) = g(θ^(T)x), how can I implement this funcion in Octave given that g = zeros(size(z)) ?
user avatar
11 votes
2 answers
11k views

How to perform Logistic Regression with a large number of features?

I have a dataset with 330 samples and 27 features for each sample, with a binary class problem for Logistic Regression. According to the "rule if ten" I need at least 10 events for each feature to be ...
user avatar
11 votes
1 answer
2k views

What's the relationship between an SVM and hinge loss?

My colleague and I are trying to wrap our heads around the difference between logistic regression and an SVM. Clearly they are optimizing different objective functions. Is an SVM as simple as saying ...
user avatar
  • 986
10 votes
4 answers
2k views

Learning ordinal regression in R?

I'm working on a project and need resources to get me up to speed. The dataset is around 35000 observations on 30 or so variables. About half the variables are categorical with some having many ...
user avatar
  • 101
10 votes
4 answers
2k views

Is this a good practice of feature engineering?

I have a practical question about feature engineering... say I want to predict house prices by using logistic regression and used a bunch of features including zip code. Then by checking the feature ...
user avatar
9 votes
2 answers
1k views

Why continuous features are more important than categorical features in decision tree models?

I have both categorical and continuous features in my prediction model and want to select (and rank) most important features. I have converted all categorical variables into dummy variables using one ...
user avatar
9 votes
3 answers
23k views

How to plot logistic regression decision boundary?

I am running logistic regression on a small dataset which looks like this: After implementing gradient descent and the cost function, I am getting a 100% accuracy in the prediction stage, However I ...
user avatar
  • 281
9 votes
1 answer
19k views

What is the difference between SGD classifier and the Logisitc regression?

To my understanding, the SGD classifier, and Logistic regression seems similar. An SGD classifier with loss = 'log' implements Logistic regression and loss = 'hinge' implements Linear SVM. I also ...
user avatar
9 votes
3 answers
7k views

What cost function and penalty are suitable for imbalanced datasets?

For an imbalanced data set, is it better to choose an L1 or L2 regularization? Is there a cost function more suitable for imbalanced datasets to improve the model score (...
user avatar
  • 91
9 votes
3 answers
2k views

Loss Function for Probability Regression

I am trying to predict a probability with a neural network, but having trouble figuring out which loss function is best. Cross entropy was my first thought, but other resources always talk about it in ...
user avatar
  • 191
7 votes
2 answers
19k views

Trying to understand Logistic Regression Implementation

I'm currently using the following code as a starting point to deepen my understanding of regularized logistic regression. As a first pass I'm just trying to do a binary classification on part of the ...
user avatar
  • 73
7 votes
4 answers
8k views

Bad classification performance of logistic regression on imbalanced data in testing as compared to training

I am trying to fit a logistic regression model to an imbalanced dataset (0.5/99.5) with high dimensionality(about 15k). I used random forest to select top 200 important features. Observations are ...
user avatar
  • 131
7 votes
2 answers
362 views

Understanding regularization

I'm currently trying to understand regularization for logistic regression. So far, I'm not quite sure whether I really got it. Basically, the problem is that when we add an additional features to a ...
user avatar
  • 1,233
7 votes
1 answer
109 views

Tensorflow - logistic regression -oneHot Encoder - Transformed array of different size for both train and test

...
user avatar
7 votes
1 answer
4k views

Why does logistic regression in Spark and R return different models for the same data?

I've compared the logistic regression models on R (glm) and on Spark (LogisticRegressionWithLBFGS) on a dataset of 390 obs. of ...
user avatar
  • 113
7 votes
2 answers
743 views

Coursera ML - Does the choice of optimization algorithm affect the accuracy of multiclass logistic regression?

I recently completed exercise 3 of Andrew Ng's Machine Learning on Coursera using Python. When initially completing parts 1.4 to 1.4.1 of the exercise, I ran into difficulties ensuring that my ...
user avatar
  • 123
7 votes
2 answers
6k views

Regression model to predict probability of rare event

I have a dataset with around 900.000 records, around 1000 of which are marked as positive (the studied event occurred). The probability of the event occurring is always low (i.e. < 0.1), and I ...
user avatar
  • 71
7 votes
2 answers
184 views

Concatenating embedding and hand-designed features for logistic regression

An interviewer told me that we cannot concatenate an embedding from a neural network (such as a pre-trained image representation) and hand designed features (such as image metadata) for use in a ...
user avatar
7 votes
1 answer
5k views

sklearn: SGDClassifier yields lower accuracy than LogisticRegression

I'm participating in the kaggle Iceberg Classifier Challenge, where the idea is to classify whether an object present in a radar image is an iceberg or a ship. I am currently trying to implement ...
user avatar
  • 191
7 votes
3 answers
238 views

Understanding Classifier performance on text data

I am working on a multi-label text classification problem(Total target labels 90). The data distribution has a long tail and class imbalance and around 1900k records. Currently, I am working on a ...
user avatar
  • 129
6 votes
2 answers
3k views

Logistic regression on biased data

I am currently working on a dataset to predict customer attrition based on past data and transactions of the customers. There are 2,40,000 customers in total out of which around 1,77,000 customers ...
user avatar
  • 155
6 votes
2 answers
2k views

Voting combined results from different classifiers gave bad accuracy

I used following classifiers along with their accuracies: Random forest - 85 % SVM - 78 % Adaboost - 82% Logistic regression - 80% When I used voting from above classifiers for final classification, ...
user avatar
  • 367
6 votes
1 answer
9k views

How to determine threshold in Sigmoid function

Context: I picked up data-set from here and tried to run Logistic Regression on it. Since I am not very much aware of MATLAB, I converted "Strings" to "Numbers" with my own using "NUMBERS" software. ...
user avatar
6 votes
1 answer
954 views

Should I standardize first or generate polynomials first?

Recently I am dealing a classification problem with some algorithms, say logistic regression. When I preprocess my data, I standardize all my features and then generate polynomial features based on ...
user avatar
  • 189
5 votes
2 answers
13k views

Learning rate in logistic regression with sklearn

In sklearn, for logistic regression, you can define the penalty, the regularization rate and other variables. Is there a way to set the learning rate?
user avatar
  • 1,851
5 votes
1 answer
8k views

Best or recommended R package for logit and probit regression

Could somebody please recommend a good R package for doing logit and probit regression? I have tried to find an answer by searching on Google but all the links I find go into lengthy explanations ...
user avatar
5 votes
3 answers
8k views

When to use Random Forest

I understand Random Forest models can be used both for classification and regression situations. Is there a more specific criteria to determine where a random forest model would perform better than ...
user avatar
5 votes
1 answer
5k views

How does binary cross entropy work?

Let's say I'm trying to classify some data with logistic regression. Before passing the summed data to the logistic function (normalized in range $[0,1]$), weights must be optimized for desirable ...
user avatar
  • 389
5 votes
2 answers
890 views

Logistic regression with high cardinality categorical variable

I have a logistic regression model where I care about predictive power solely over comprehensibility. I'm interested in predicting win rates in a video game. There are 133 characters. Each team picks ...
user avatar
  • 153
5 votes
3 answers
4k views

Stochastic gradient descent in logistic regression

I am very new to machine learning and in my first project have stumbled across a lot of issues which I really want to get through. I'm using logistic regression with R's ...
user avatar
5 votes
3 answers
454 views

Which machine (or deep) learning methods could suit my text classification problem?

I am long-time engineer with almost zero machine learning experience, who is trying to determine a good starting point to solve my problem (hopefully using machine learning). The problem (I'll keep ...
user avatar
5 votes
2 answers
334 views

How to adjust cofounders in Logistic regression?

I have a binary classification problem where I apply logistic regression. I have a set of features that are found significant. But I understand that Logistic regression doesn't consider feature ...
user avatar
  • 2,163
5 votes
1 answer
232 views

Good explanation for why regularisation works

I am trying to understand regularisation for logistic regression currently, but I am not sure I get it. I understand the issue of overfitting when there are relatively too many features, and I get ...
user avatar
  • 165
5 votes
2 answers
181 views

Confused AUC ROC score

I am working on binary classification problem, I try to evaluate the performance of some classification algorithms (LR,Decission Tree , Random forest ...). I am using a cross validation technique (to ...
user avatar
  • 103
5 votes
1 answer
524 views

How are ANN's, RNN's related to logistic regression and CRF's?

This question is about placing the classes of neural networks in perspective to other models. In "An Introduction to Conditional Random Fields" by Sutton and McCallum, the following figure is ...
user avatar
  • 209
5 votes
1 answer
2k views

Modeling uncertainty from Logistic Regression

Logistic regression is a part in a simulation pipeline that I use for some scenario analysis. The dataset that this is based on is not small but relatively noisy, and only one explanatory variable/...
user avatar
4 votes
2 answers
3k views

My data is highly overlapping, but when I apply logistic regression, it is giving an impressive accuracy of 79%. Why?

Logistic regression is supposed to work well only on data that is linearly separable. As we can see in the pair plot, the data points heavily overlap. The logistic regression model is in fact showing ...
user avatar
  • 239

1
2 3 4 5
13