Questions tagged [linear-regression]

Techniques for analyzing the relationship between one (or more) "dependent" variables and "independent" variables.

Filter by
Sorted by
Tagged with
4
votes
1answer
157 views

How can I determine the accuracy of a hand-drawn line of best fit?

Here's the situation: Users have manually drawn a straight line of best fit through a set of data points. I have the equation (y = mx + c) for this line. I have used least-squares regression to ...
0
votes
0answers
10 views

How are two linear models with features f1 and (C-f1) similar or different?

I am training a linear model. I'm planning to update this model every month. I have two perfectly correlated features such that f1+f2=C, where C is a constant. Since I cannot include both, I will be ...
4
votes
1answer
453 views

Are linear models better when dealing with too many features? If so, why?

I had to build a classification model in order to predict which what would be the user rating by using his/her review. (I was dealing with this dataset: Trip Advisor Hotel Reviews) After some ...
0
votes
0answers
22 views

what are the effect on machine learning regression model if the dataset has two exact same columns

What will be the effect on the Machine learning model if the dataset has two exact same columns(exact 1 correlation). One thing that comes to my mind is that if two columns are exactly the same then ...
0
votes
1answer
11 views

Accessing regression coefficients when using MultiOutputRegressor

I am working on a multioutput (nr. targets: 2) regression task. The original data has a huge dimensionality (p>>n, i.e. there are far more predictors than ...
0
votes
0answers
18 views

What correlation is considered to be big for linear regression predictors?

It is well known that if two linear regression predictors highly correlate, it is bad for our model, but which correlation is considered to be big? Is it 0.5,0.6,0.8,0.9..? I have tried to find out ...
0
votes
1answer
13 views

Binary classification with seperate training and testing datasets [closed]

I have two datasets (train.csv) and (test.csv) revolving around predicting the death outcome for a disease. Both sets include 20 independent variables (age, weight, etc), but only the train.csv ...
2
votes
1answer
15 views

How to predict a discrete dependent variable on a continuous scale using regression

I am trying to find the 'optimal' amount of a certain medicinal cream to be applied to a patient in order to minimize the days the patient has a rash. However, the data for the cream doses are of the ...
1
vote
1answer
31 views

Trouble understanding regression line learned by SGDRegressor

I am working on a demonstration notebook to better understand online (incremental) learning. I read in sklearn documentation that the number of regression models that support online learning via the <...
5
votes
1answer
138 views

Visualizing effect of regularization for linear regression problem

I wanted to put together an example notebook to demonstrate how regularization makes an impact for such a simple model as a simple linear regression. When executing the below script though, I notice ...
0
votes
0answers
13 views

Two variables polynomial fit with Python

I have two numpy arrays (the first is 2D, the second 1D) in the form: $X = [[x_1,y_1],[x_2,y_2],[x_3,y_3],...]$ $Z = [z_1,z_2,z_3,...]$ I would like to fit them as I expect they respect a polynomial ...
1
vote
0answers
16 views

Statsmodel manually set/restore coefficients of model

I was wondering if it is possible to manually restore the coefficients of a given model? That is, given a computed set of coefficients, to reinitialize another statsmodel with those parameter (...
0
votes
1answer
24 views

Difference in statsmodel output vs direct linear algebra with input binary variable

I was wondering why there might be a difference when I run a simple multiple linear regression with statsmodels OLS, vs just doing it directly with numpy. The results are identical for both cases, so ...
1
vote
0answers
34 views

statistical tests for null hypothesis - what if model is non linear?

I am reading the "An Introduction to Statistical Learning" (Gareth James & alii, Springer) as a primer to machine learning. I am reading the part in linear regressors, and learnt there ...
0
votes
1answer
22 views

Why are my ridge regression coefficients completely different from ordinary linear regression coefficients in MATLAB?

I am attempting to implement my own Ridge Regression algorithm and I am trying to achieve similar coefficients found in a MATLAB tutorial on regression. Specifically, on the MATLAB tutorial page you ...
2
votes
0answers
22 views

Return the gradient and y intercept (m, b) to create two lines to best fit the data

I have been working on this task for a few hours now and have been unsuccessful with getting the target result. I have tried using multiple methods of trying to split the dataset using different ...
1
vote
0answers
29 views

Why can't a multi-layer linear neural network fit this linear function data?

I am learning to implement a neural network with gradient descent, and encountered this problem, please. Using the target function ...
0
votes
0answers
37 views

Find $a, b, c$ minimizing MSE

Suppose you are given a "dummy" classifier. It looks like this: $$ y(x) = \begin{cases} a \text{ if } x >= c \\ b \text{ else } \end{cases} $$ Given some data set $\{(y_1, x_1), \dots (...
0
votes
1answer
67 views

Should one log transform discrete numerical variables?

I am working on a Linear Regression problem and one of the assumptions of a Linear Regression model is that the features should be Normally Distributed. Hence to convert my non linear features to ...
1
vote
0answers
11 views

Why the line of Linear Regression is same as deming regression?

This is not a coding question. My doubt is purely mathematical. Say I take three points (1,2) (2,1) and (4,3) A. I calculate the least fit line for linear regression. Simple linear regression(which ...
1
vote
1answer
31 views

Building a linear regression model for every combination vs only one Machine Learning model

So my question is more on the conceptual side. Given a dataset, I want to predict a given continuous variable Y. Now, there are 3 features, 2 categorical and one numerical (integer only). I know that ...
0
votes
0answers
19 views

Is Regression Line an 1-D affine subspace of 2-D vector space?

Background I currently read a book called "Mathematics for Machine Learning" and I read chapter 2 which is about Linear Algebra, especially on subchapter 2.8 which is about Affine Space. The ...
1
vote
0answers
52 views

Linear regression with Pytorch not converging

I am trying to perform a simple linear regression using Pytorch lightning (a network with only one neuron). The network is supposed to learn a simple function: y=-4x...
1
vote
1answer
17 views

Segmented function in R?

Could someone please explain what psi and npsi are? segmented(obj, seg.Z, psi, npsi, fixed.psi=NULL, control = seg.control(), model = TRUE, keep.class=FALSE, ...) ...
2
votes
2answers
29 views

Extracting linear trends from a dataset

Consider a sensor measurement f that varies with both temperature T and the properties of the fluid being measured. The temperature changes through each day and the fluid properties can be assumed to ...
1
vote
1answer
33 views

Fit non-linear customised model

I have a data.frame that have two cols, $x=mz$ and $y=res$. There are about ~2 million rows in the DF. When I plot the graph I get the below. What I'd like to do is ...
1
vote
1answer
21 views

Why are we not checking the significance of the coefficients in Lasso and elastic net models

As far as I know, we don't check the coefficient significance in Lasso and elasticnet models. Is it because insignificant feature coefficients will be driven to zero in these models?. Does that mean ...
0
votes
2answers
37 views

How can we make forecasts from stationary data

I'm confused about the concept of stationarity. Most definitions require the mean and Variance to be constant 'over any interval'. This statement confuses me, if any interval should have the same mean ...
0
votes
0answers
19 views

How to determine elastic net models coefficient significance?

I have a small dataset with just 160 data points. When I tried ordinary linear regression on the data, I could not add more than four features without vif inflating greater than 5 (I made a stepwise ...
3
votes
4answers
392 views

Multicollinearity vs Perfect multicollinearity for Linear regression

I have been trying to understand how multicollinearity within the independent variables would affect the Linear regression model. Wikipedia page suggests that only when there is a "perfect" ...
2
votes
1answer
63 views

Does PCA helps to include all the variables even if there is high collinearity among variables?

I have a dataset that has high collinearity among variables. When I created the linear regression model, I could not include more than five variables ( I eliminated the feature whenever VIF>5). But ...
0
votes
0answers
29 views

What is the best model for predicting delays?

Supposing we need to predict delays based on a previous dataset that contains the history of several, lets say, providers and their delivery delays. The goal is to minimize the loss due to those ...
1
vote
0answers
26 views

Why there is a marked difference in metric scores using linear regression or MLP as readout for echo state network?

I am using a reservoir computing architecture comprising of an echo state network as per the paper Reservoir Computing Approaches for Representation and Classification of Multivariate Time Series ...
0
votes
0answers
9 views

Loss function for normal distribution regression problem

My project involves training an input of random uniformly distributed data using regression (this is my approach) to output random normally distributed data. The issue with formulating the problem is ...
1
vote
1answer
45 views

What's the correct cost function for Linear Regression

As we all know the cost function for linear regression is: Where as when we use Ridge Regression we simply add lambda*slope**2 but there I always seee the below as cost function of linear Regression ...
0
votes
0answers
13 views

data analysis leads to linear regression model: how to proceed with prognosis?

Data analysis of a large dataset of project management data together with working hours led me to a surprisingly simple linear model over the key milestones of all projects. Now I am a bit at loss on ...
1
vote
0answers
27 views

AI algorithm model that outputs a list of unknown length [closed]

I have a dataset with the following x columns: date time is_weekend is_holiday start_intersection end_intersection The output is a list of intersections, that connect start_intersection with ...
1
vote
0answers
21 views

Does the appliance of R-squared to non-linear models depends on how we calculate it?

Does the appliance of R-squared to non-linear models depends on how we calculate it? $R^2 = \frac{SS_{exp}}{SS_{tot}}$ is going to be an inadequate measure for non-linear models since an increase of $...
0
votes
0answers
20 views

average of two models with training set N/2 vs one model with training set N

I'm new to ML and I got a question about training model. Imagine linear regression $Y=\beta^TX+ \epsilon$ and we have training set D (size=N). I have two options: Train model use whole D and we get $\...
2
votes
1answer
92 views

Does gradient descent always find global minimum for specific regression type?

From my understanding, linear regression is used for predicting an output based on an input using a linear equation that is optimally fitted to some input data. We choose the best fitted linear ...
1
vote
2answers
29 views

Multiple Linear Regression for House Price Prediction score is 0.28 [closed]

I am trying to make predictions using this dataset What I have done so far: Dropped the Administrative column Encoded the categorical data using ...
1
vote
0answers
22 views

Implementation of a perceptron

I want to implement a single perceptron for linear regression using the following formulas: the input data for the first case is one column (x(392, 1); y(392, 1)) and for the second case is (x(392, 7)...
1
vote
1answer
25 views

One predictor variable and 3 response variable (categorical and continuous) [closed]

If I have predictor variables which are a mixture of continuous and categorical, and a response variable that is continuous. What approach should I apply? Linear regression, logistic regression or k ...
1
vote
1answer
26 views

The effect of the λ in the Ridge regression

Why by increasing value of λ in Ridge estimator the slope of the line is decreasing? How exactly λ affects to the y = kx + b?
1
vote
0answers
10 views

Error while calculating accuracy and matrix multiplication in tensor flow code for regression [closed]

I was writing a code for linear regression using tensor flow but I was getting errors while calculating matrix multiplication using tensor flow and while calculating accuracy. ...
0
votes
0answers
18 views

Can I retrain my best model on all available data? [duplicate]

I split data on Zillow single-unit properties into train-validation-test 70-15-15 and trained a few different sklearn linear models to predict selling price. I chose the best one based on validation ...
1
vote
0answers
18 views

Group points to reduce data set such that the linear regression stays the same

I have a very long dataset and I'm trying to reduce it by grouping the data in periods of 24 hours. In this way, there will be a single data point that represents that day, but they must yield the ...
0
votes
0answers
9 views

cost function diverging in batch gradient descent

I am trying to implement the gradient descent method in python. I would like the calculation to stop when abs(J-J_new) reaches a certain tolerance level (i.e. it ...
1
vote
1answer
19 views

Approximating weight of individual items from sum of their weight

Problem I have a list of orders, approximation of their total weight and list of items they contain. I need to determine approximate weight of individual items. In other words, I have a few thousand ...

1
2 3 4 5
13