# Tag Info

## New answers tagged logistic-regression

0

Yes, You can use the same model. Just change the number of classes. That's it. It will produce probabilities for each class. use the probabilities to extract the class index with max probability and that will be the class for the input. Let's dig a little bit deeper. Let's say you need to predict 2 classes (0, 1),then SGDClassifier produces class directly ...

0

You are using (stochastic) gradient descent. For that to work properly, the learning rate (step size) must be set correctly. I assume that the error lies there. Instead, you could try logistic regression via IRLS (see its definition), compare also IRLS vs GD Or for the input you tested, you just found a bad local optimum.

0

Logistic regression is a classification method, so it will predict whether two documents are similar or not (or more exactly, it will give you a probability that the documents are similar). In summary, it is a machine learning model that is trained by presenting it with examples of document pairs and a label that is one if the documents are similar and 0 if ...

0

The thresholds don't matter; what matters are the (FPR, TRP) values at those thresholds, as they are points on the curve. Sort them by FPR ascending. For this to work out, you'll want to include the points (0,0) and (1,1) in your list, corresponding to thresholds 1 and 0. You can use a trapezoidal approximation, as each successive pair of points defines a ...

3

Scikit-learn has compose.ColumnTransformer which allows different columns or column subsets of the input to be transformed separately and the features generated by each transformer will be concatenated to form a single feature space. This is useful for heterogeneous or columnar data, to combine several feature extraction mechanisms or transformations into a ...

1

To complete @BenjiAlbert answer, in case of imbalanced dataset, it is also recommended to use stratified k-fold to preserve the relative class frequencies in each fold. You can find more details in the sklearn user guide here.

4

If you're referring to the fact that your dataset is small: You should use k-fold cross validation. This will let you evaluate your model on all 279 instances If you're referring to the class imbalance being 31:202 in train and 8:48 in test: Use AUROC and PRC to eliminate bias in thresholding Also see MCC

1

I think in case of such unsymmetric data, where the output is outnumbered by one of the classes. Recall would be a good choice of measure than accuracy. The recall gives us the percentage of the relevant class actually predicted by the model.

1

You will have to use a mix of text processing and one hot encoding. Text column should not be treated as one-hot encoded since it will try to create one new variable for every unique sentence in the dataset, which will be a lot (and not very helpful from learning). Text vectorizer will summarize text column based on type of words/tokens that appear in it. So ...

1

Oh, I think I've finally got it. It's just an averaging problem: for each fold in your k-fold cross-validation, you get perfect auROC, but at the default threshold of 0.5 your hard classifiers (for each fold) sometimes have $FPR=0$ and $TPR<1$, but some other times $FPR>0$ and $TPR=1$. Then averaging you are able to get both \$\operatorname{mean}(FPR)&...

Top 50 recent answers are included