All Questions
32 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
...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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,) ...
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 ...
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 ...
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 ...