1
vote
0answers
20 views

sklearn setting learning rate of SGDClassifier vs LogsticRegression

As in sklearn, LogisticRegression(short for LR) has not direct method for solving weighted LR, so i pass to SGDClassifier(SGD). As with my experiment: i generate data follow LR distribution with ...
0
votes
2answers
44 views

Is there a way to implement sample weights in python logistic regression?

I'm using statsmodels for logistic regression analysis in python e.g.: import statsmodels.api as sm import numpy as np x = arange(0,1,0.01) y = np.random.rand(100) y[y<=x] = 1 y[y!=1] = 0 x = ...
2
votes
0answers
23 views

Creating a sklearn.linear_model.LogisticRegression instance from existing coefficients

Can one create such an instance based on existing coefficients which were calculated say in a different implementation (e.g. Java)? I tried creating an instance then setting coef_ and intercept_ ...
1
vote
1answer
29 views

sklearn.linear_model.LogisticRegression returns different coefficients every time although random_state is set

I'm fitting a logistic regression model and am setting the random state to a fixed value. Every time I do a "fit" I get different coefficients, example: ...
1
vote
0answers
36 views

Error with Simple Logistic Regression in Python

import numpy as np import matplotlib.pyplot as plt class Logistic_Regression(object): def __init__(self, input): self.data = np.loadtxt(input, delimiter=',') self.x = ...
-1
votes
1answer
24 views

Python SK Learn: Is it posible to feed several sets of data to “SGDClassifier” from sk learn to update parameters

I'd like to split my data set in to a little chuck due to limitation of my software and feed to Stochastic Gradient Descent (SGD) Logistic-Regression. Is it possible to do this in "SGDClassifier" ...
0
votes
1answer
56 views

How to use scikit-learn to predict the rate of change in a site's hit counts

I want to predict the change in hit counts for a website using the rate of change. For example, if a site's hits double in a day (from 5,000 to 10,000), the rate of change is 2. If the hits go up by a ...
2
votes
0answers
31 views

Implementing a regression function on a multidimensional array

I'm going through an algorithm that does regression on some training data. The training dataset X consists of n samples, where n = 10. Each sample x[i] from X is an array consisting of, say, 4 ...
6
votes
1answer
113 views

What is the inverse of regularization strength in Logistic Regression? How should it affect my code?

I am using sklearn.linear_model.LogisticRegression in scikit learn to run a Logistic Regression. C : float, optional (default=1.0) Inverse of regularization strength; must be a positive float. ...
0
votes
1answer
28 views

Categorical variable in Rpy2 (factor function)

How can I do this in rpy2? mydata is a dataframe and rank is a varaible from 1 to 4 mydata$rank <- factor(mydata$rank)
5
votes
1answer
170 views

Why can't statsmodels reproduce my R logistic regression results?

I'm confused about why my logistic regression models in R and statsmodels do not agree. If I prepare some data in R with # From https://courses.edx.org/c4x/MITx/15.071x/asset/census.csv ...
0
votes
0answers
59 views

Include all binarized dummies of categorical variable in logistic regression (scikit-learn)?

For each categorical (nominal) variable I created a set of binary dummies. Is it OK to throw the whole dummy set into scikit-learn's logistic regression or should I exclude one dummy of each set in ...
0
votes
2answers
138 views

Dummy Variables in Python SKLearn Logistic Regression

I am using logisitic regression in SKLearn to classify data into one of 5 classes. To train the data I have a matrix of observations Y and a matrix of features X. Sometimes it is the case that my ...
2
votes
3answers
78 views

Software for Image classification

Currently I am working for a project to classify a given set of test images into one of the 5 predefined categories. I implemented Logistic Regression with a feature vector of 240 features for each ...
1
vote
2answers
88 views

How to make sure that solution is global minimum while using python scipy.optimize.minimize

I was implementing logistic regression in python. To find theta , I was struggling to decide which is the best algorithm that always guarantees global optima without bothering about initial parameter ...
1
vote
1answer
107 views

Speeding up sklearn logistic regression

I have a model I'm trying to build using LogisticRegression in sklearn that has a couple thousand features and approximately 60,000 samples. I'm trying to fit the model and it's been running for ...
1
vote
1answer
945 views

Features in sklearn logistic regression

I have some problem with adding own features to sklearn.linear_model.LogisticRegression. But anyway lets see some example code: from sklearn.linear_model import LogisticRegression, LinearRegression ...
0
votes
1answer
254 views

Python SKLearn: Logistic Regression Probabilities

I am using the Python SKLearn module to perform logistic regression. I have a dependent variable vector Y (taking values from 1 of M classes) and independent variable matrix X (with N features). My ...
1
vote
1answer
1k views

Logistic regression using python

I want to implement Logisitic regression from scratch in python. Following are the functions in it: sigmoid cost fminunc Evaluating Logistic regression I would like to know, what would be a ...
0
votes
1answer
331 views

How do I plot the decision boundary of a regression using matplotlib?

How do I add a countour map of the results of the logistic regression to my scatterplot? I want colored 0/1 zones, which delineate the decision boundary of the classifier. import pandas as pd import ...
1
vote
1answer
152 views

python transform a string input matrix to 0-1 binary input matrix for logistic regression like R [duplicate]

I'm doing some logistic regression with Python using pandas+numpy+scikit-learn. However in scikit-learn build-in logistic regression model, it doesn't allow a string input, but I'd like to do ...
0
votes
1answer
478 views

GridSearchCV on LogisticRegression in scikit-learn

I am trying to optimize a logistic regression function in scikit-learn by using a cross-validated grid parameter search, but I can't seem to implement it. It says that Logistic Regression does not ...
0
votes
1answer
626 views

Scikit Learn: Logistic Regression model coefficients: Clarification

I need to know how to return the logistic regression coefficients in such a manner that I can generate the predicted probabilities myself. My code looks like this: lr = LogisticRegression() ...