Skip to main content

All Questions

0 votes
1 answer
93 views

Implementation of gradient descent is very inefficient and does not work in all cases

I am supposed to implement gradient descent for linear regression. Here is the implementation: class SimpleLinearRegressionModel(): def __init__(self, x, y, theta, alpha): self.x = x ...
jem do's user avatar
  • 21
0 votes
1 answer
15k views

ValueError: Found input variables with inconsistent numbers of samples: [12925, 517]

from sklearn.linear_model import LinearRegression import numpy as np X9=dataset.iloc[:,[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]].values y9=dataset.iloc[:,29].values #X9=pd....
patrick's user avatar
  • 11
0 votes
1 answer
101 views

What is the issue with is this basic linear regression?

Currently trying to run a very basic linear regression using some test data points on a jupyter notebook. below is my code, and as you can see if you run this the prediction line certainly moves ...
JSOD's user avatar
  • 3
0 votes
1 answer
219 views

Logistic Regression - numpy.float64

I am trying to create Logistic Regression from scratch using the Squared Loss function. However, I am having this error that I can't really figure out. The error is: can't multiply sequence by non-int ...
tquigg96's user avatar
0 votes
1 answer
729 views

Logistic Regression return a matrix

I created a Logistic Regression algorithm with Numpy. The problem is that when I compute it, the weights are a matrix instead of a vector, so it soesn't throw any errors, but when I try to predict ...
Stack's user avatar
  • 1,139
0 votes
0 answers
389 views

Calculating Prediction Intervals

Example Dataframe: new_host split sequence expression FALSE train AQVPYGVS 0.039267878 FALSE train ASVPYGVSI 0.039267878 FALSE train STNLYGSGR 0.261456561 FALSE ...
bioinformatics_student's user avatar
0 votes
1 answer
3k views

How to fix 'X.toarray() to convert to a dense numpy array' error on sklearn fit_transform?

R&D Spend Administration Marketing Spend State Profit 0 165349.20 136897.80 471784.10 New York 192261.83 1 162597.70 151377.59 443898.53 California 191792.06 2 153441.51 ...
Sandeep Pandit's user avatar
1 vote
1 answer
198 views

Polynomial Regression without scikitlearn

Tried doing a polynomial regression. However, for any values of n other than 3, the error increases significantly, the x vs y_hat plot actually starts going downwards. The logs have been taken to get ...
saatweek's user avatar
4 votes
1 answer
3k views

Nonlinear feature transformation in python

In order to fit a linear regression model to some given training data X and labels y, i want to augment my training data X by nonlinear transformations of the given features. Let's say we have the ...
Lukas's user avatar
  • 69
0 votes
1 answer
213 views

Gradient descent derivation for orthogonal linear regression from scratch in Numpy Python

I wanted to derive gradient descent from scratch using the error function for Orthogonal linear regression. So that I could write python code in NumPy. However, I am unsure about the error function in ...
Chinmay Das's user avatar
1 vote
0 answers
128 views

Logistic regression - strange behaviour of the decision boundary when additional parameters are added

I am trying to build a logistic regression model for a dataset consisting of two parameters x1 and x2, but instead of analyzing just the two of them, I have added their squares as well - x12, x22 and ...
Karol Szustakowski's user avatar
0 votes
0 answers
171 views

python numpy : ValueError: shapes (14,) and (404,14) not aligned: 14 (dim 0) != 404 (dim 0)

I'm trying to implement Locally reweighed least square and I'm getting this b = np.array([np.sum(weights.T.dot(y_train.T)), np.sum(weights.T.dot(y_train.T).dot(x_train))]) ValueError: shapes (14,) ...
Pure Evil's user avatar
0 votes
0 answers
187 views

ValueError: shapes (2,) and (10,10) not aligned: 2 (dim 0) != 10 (dim 0)

I keep on getting this error ValueError: shapes (2,) and (10,10) not aligned: 2 (dim 0) != 10 (dim 0) I have tried converting the inputs to matrices and switched around some of the values in the ...
Pranjal Chaitanya's user avatar
6 votes
3 answers
4k views

Closed Form Ridge Regression

I am having trouble understanding the output of my function to implement multiple-ridge regression. I am doing this from scratch in Python for the closed form of the method. This closed form is shown ...
ptent's user avatar
  • 168
0 votes
1 answer
509 views

How to use multiple catagorical input variables of different dimension into random forest regressor model?

I have data which describes an item going through a release process. The item has different variables such as "Product category", "Design_country", "product line" and so on. In total I have 18 ...
Kspr's user avatar
  • 697

15 30 50 per page