Questions tagged [linear-regression]
Techniques for analyzing the relationship between one (or more) "dependent" variables and "independent" variables.
763
questions
0
votes
1
answer
20
views
Linear regression shows b_0 negative while it is a positive quantity
In linear regression, x is weight and y is price; none of the x and y can be negative. The linear regression line with b_0=-57.9 shows a negative y for x<=10 approximately. This signifies that more ...
0
votes
0
answers
23
views
Target variable is discrete ranging from 1 to 14, with each value having same proportion in the dataset, ML models fail miserably
I have a dataset of shape (55314,23). The target variable is league_rank. There are exactly 3951 leagues in this dataset, with each club having a ranking from 1 to 14. The variable is discrete, and ...
0
votes
0
answers
19
views
Logistics or linear regression for a regression task involving outputs between 0 and 1
Problem
Consider a regression task of mapping inputs $X$ to outputs $y$ where $y \in [0,1]$.
Two linear models that we can use to model this input-output relationships are logistic regression $f_\...
0
votes
0
answers
13
views
Autoregressive forecasting with distinct models problem
I got $n$ features - $f$ (used as an input as well as a target). Since I'm using linear regression and want to avoid situation in which weights of a model fit not only for $fi$ but for all of $f$ (...
0
votes
1
answer
42
views
Why linear kernel regression is equivalent to plain linear regression?
I am trying to understand either intuitively/geometricaly and/or mathematicaly why the followings are equivalent:
Classic Ordinay Least Squares linear regression
Linear-kernelized Ordinary Least ...
0
votes
0
answers
14
views
Can reducing information improve regression prediction?
Variable A is either 0 or 1. It is 0 if the sum of variables a + b + c + d … is less than some constant threshold, and is 1 if the sum of variables a + b + c + d … is greater than some constant ...
0
votes
0
answers
2
views
With infinite observations, would the weights resulting from ridge regression be the same as simple linear regression?
As the number of observations approaches infinity, do the weights of a linear regression approach the weights of a linear regression with L2 penalty?
0
votes
1
answer
40
views
Workflow when making a machine learning model
I'm new to data science, and kinda confused with the workflow and steps to make a model. Before learning the math and concepts behind the algorithms like SVM, linear regressions, etc, I would just ...
1
vote
1
answer
64
views
Linear Regression and Logistic Regression
I'm a beginner, and I'm wondering whether a logistic regression in a nut-shell is just normalizing a linear regression? Correct me if I'm wrong, but I came to this conclusion because the predicted ...
0
votes
0
answers
8
views
Using nearest neighbor in RANSAC
I found many resources online talking about nearest neighbor concept in RANSAC. For example, figure 2 of this paper, this article and this repo talk about nearest neighbor in the context of RANSAC. ...
0
votes
2
answers
84
views
Why is it difficult to use a linear regression model for the classification problems?
Why is it difficult to use a linear regression model for the classification problems?
0
votes
0
answers
15
views
Should I use an intercept even if my regression model's r-squared value reduces by a lot?
I'm using Python to create a good linear regression model and am having trouble getting good results for my r-squared value.
A quick rundown of what the data is:
– Sales: This dependent variable ...
0
votes
0
answers
20
views
How to properly linearize data (if possible)
I was assigned the task of linearizing some of my data, which exhibits a non-linear appearance. When using the distfit library, it indicated that my data's distribution is closest to a gamma function.
...
0
votes
0
answers
19
views
Calculating the solution of OLS efficiently when adding one feature at a time
We know that the analytical solution for an OLS problem is $𝛽̂ =(𝐗^T𝐗)^{-1}𝐗^𝑇𝐲$. I am looking for an efficient algorithm to solve for $𝛽̂$ when I add one feature at a time. More specifically, ...
0
votes
0
answers
42
views
One-Hot encoded variables dominates importance among other variables
I am currently training some machine learning models to predict the 28-day compressive strength of cement, a continuous real-valued variable. The available dataset comprises samples from three ...
0
votes
0
answers
40
views
Data Cleanup for Regression
I have a simple dataset of 1 output and 1 input and want to fit a linear regression to the dataset.
The data has a certain level of noise to it (potentially driven by another input, which I will ...
0
votes
1
answer
18
views
What are some Models/Methods to reduce noise using environmental data?
I have a set of pressure datasets from a mechanical device that frequently moves around the country. I also have several sets of environmental data (Altitude, ambient temperature etc.) from those ...
2
votes
2
answers
375
views
Parameter estimation in linear regression
Another test Q I couldn't answer -
We have marks of students belonging to 3 sections - A,B,C and two genders - M & F. Which regression model will not be able to estimate all the parameters?
1 ) ...
0
votes
1
answer
30
views
What Model to Choose for a NN with a Very Wide Output Layer?
The input of my neural network consists of 20 features, whereas the output consists of 20,000 of them (predicting a "quantum classical shadow" based on a few parameters: the rotation angle ...
0
votes
1
answer
19
views
ValueError: operands could not be broadcast together with shapes (13159,3) (13159,)
I am trying to predict the target variable and finding the difference from actual variable using polynomial regression. However predicted variable is an array of 3 dimension with the shape as (13159,3)...
0
votes
0
answers
21
views
A hypercube with side length 1 in d dimensions is defined to be the set of points
The Question: A hypercube with side length 1 in d dimensions is defined to be the set of points (x1, x2, ..., xd) such that for all j = 1, 2, ..., d. The boundary of the hypercube is defined to be ...
0
votes
0
answers
16
views
Mean Absolute Error vs Mean Squared Error
why MAE is not used widely unlike MSE?
In what scenarios you would prefer to use one over the other. Explain mathematically too.
I was asked in an interview. I referred MSE vs MAE in linear regression
...
0
votes
1
answer
60
views
Linear Model With Highly Correlated Attributes Producing Inconsistent Weights
I know that having correlated attributes violates the linear model assumption of independent attributes, and I'm not interested in creating a more sophisticated model to tease apart the dependent ...
0
votes
0
answers
53
views
Can I decompose SHAP interaction values like a linear regression?
I had a question regarding the shap interaction matrix.
Suppose I have 500 samples with 2 features. Then my interaction matrix becomes (500,2,2).
I want to calculate the SHAP values of each feature ...
1
vote
1
answer
49
views
Why Cost function is differentiable?
I've a very basic question about cost functions. I'm studying gradient descent and there we're using partial differentiation of features "Theta". But isn't the cost function an absolute ...
0
votes
2
answers
38
views
Does LinearRegression uses Gradient Descent for finding slope and y-intercept of the best fit line?
I know that Gradient Descent is an optimization algorithm used for optimizing the cost of the loss function.
Does Linear Regression model of the sklearn package use ...
0
votes
0
answers
17
views
Sentiment extraction with hugging face ready to use model
I have a set of reviews for which I need to extract their sentiments and use those sentiments as an independent variable in an econometric model. I used one of the ready-to-use models of hugging face ...
2
votes
2
answers
142
views
Why do residuals of linear regression model need to be normally distributed?
When evaluating the output from a linear/ridge regression model, I have taken the residuals between the predicted and test data. This gives me a normal distribution when I plot this data as a ...
0
votes
0
answers
21
views
what's the difference between using 1/2n and 1/n in cost function in Linear Regression? [duplicate]
Sometimes people use 1/2n in cost function, but we know that another name for cost function is Mean Squared Error. But for MSE, 1/n is justifiable than 1/2n, so is there any term that we call when we ...
0
votes
0
answers
17
views
How do you appropriately measure the real mean squared error of a box cox transformed linear regression model?
My understanding is that it can make sense to transform the outcomes of a linear regression model to make them more normally distributed. That's because it could 1) help me find more linear ...
0
votes
1
answer
56
views
Is it ok to normalize data using minmaxscalar on dependent variable?
I'm trying to make a sales prediction using the column X = item_amount and y = item_price_total, I'm confused whether it's okay to normalize data on the dependent variable using minmaxscalar?
With the ...
1
vote
1
answer
195
views
Why COST FUNCTION AND MSE IS CALLED THE SAME?
Why are the cost function and mean squared errors called the same thing? WHEN THE COST FUNCTION IS 1/2M AND THE MSE IS 1/N. AND M=N
0
votes
1
answer
36
views
Why we need solver in LogisticRegression?
Why we need a solver like bfgs in LogisticRegression unlike LinearRegression? Don't we have a close form like LinearRegression?
2
votes
1
answer
18
views
Why would the result change so much for a linear regression with or without a constant?
I was running a Linear Regression with Wooldridge dataset named GPA2, which is found on Python library named wooldridge.
I tried two linear regressions. The first:
...
0
votes
1
answer
26
views
Help me identify the type of plot and the relationship between the dependent variables
Question: I am not sure how to describe the sample graph attached. Can you please help me identify the type of plot and how to statistically measure the relationship between the dependent variable (Y-...
0
votes
0
answers
20
views
Interaction plot
I have some questions about the interaction plot. I tried to make it on my own but I am wrong in my approach and I would like to know how to construct this. I have made a log linear regression with ...
0
votes
0
answers
31
views
Marketing Mix modeling and synergy terms
I am working on marketing mix models and I would like to know more about the way to include and compute synergy in marketing mix model? I know the existence of one software that uses this kind of ...
0
votes
1
answer
83
views
regularized LLS, trying to compute by hand the optimal weights yields wrong results
given the following dataset $S = \{(0,1),(1,1),(1,2)\}$ and the regularized problem
$$\sum_{i=1}^3 (y_i - w_1 x_i - w_0)^2 + \lambda w_1^2 \quad \lambda = 1 $$ i was tasked with finding the optimal $...
0
votes
2
answers
86
views
Is it possible to overfit a simple single variable linear regression model?
I searched this question and the answer I got was about a general regression model, rather than a single variable, linear regression model. If you increase the number of variables, you could fit a ...
0
votes
1
answer
27
views
What can I do do address a regression with systematic bias towards the middle?
I’ve created a linear regression but my predicted output is usually too low for true high values and too high for true low values. I’ve tried introducing a pipeline where I use polynomial features, ...
0
votes
0
answers
24
views
Where do I find dataset for rectangular patch antenna?
I am doing a project in my college, and for that I need a dataset containing the length, width , height along with return loss for different frequency of operation of the rectangular patch antenna. ...
0
votes
0
answers
7
views
What should be the default value for missing ordinal variable
I want to rerank items based on shipping timelines. But I get shipping info from upstream service only when it is less than 4 days. We don't show user when the shipping timeline is more than 4 days. I ...
1
vote
2
answers
36
views
Gradient vector starts to increase at some point, gradient descent from scratch
I have a simple linear function y = w0 + w1 * x, where w0 and w1 are weights,
And I'm trying to implement a gradient descent for it. I wrote the function and tested in on the data(a dataset of two ...
0
votes
1
answer
36
views
using forecast values from a univariate model as Input to linear regression?
I have weekly time series data for the last 2 years with variables "week", "marketing_spend", "web_traffic", and "revenue" ...
0
votes
0
answers
13
views
My linear regression doesn't work when i try to calculate theta1
I want to create my own linear regression. But my formula of the coefficient theta1 doesn't work i have big values :
...
0
votes
1
answer
180
views
Regression with time series data
I want to predict temperature when time (datetime type, hourly data for five months) and humidity is given. Before starting in python, I created a regression model in excel. But instead of predicting ...
0
votes
1
answer
57
views
Testing RANSAC regression model
I am going to build the model (e.g. multiple linear regression) to predict the appartment cost in my city. First I have to find outliers in training data. For this task RANSAC regression algorithm ...
0
votes
0
answers
20
views
Polynomial Regression coefficient extraction after data normalisation for Mini-Batch SGD
I've written python function that uses a stochastic mini-batch algorithm to compute the optimal polynomial coefficients for a given degree $m$, however this involved normalising the data where
$$
x' = ...
0
votes
0
answers
91
views
ValueError: shapes (584,15) and (146,30) not aligned: 15 (dim 1) != 146 (dim 0)
ValueError: shapes (584,15) and (146,30) not aligned: 15 (dim 1) != 146 (dim 0)
y_test = df_test.pop('cnt')
X_test = df_test
X_test_lm_4 = sm.add_constant(X_test)
0
votes
2
answers
81
views
Which intrinsically explainable model has the highest performance?
Explainable AI can be achieved through intrinsically explainable models, like logistic and linear regression, or post-hoc explanations, like SHAP.
I want to use an intrinsically explainable model on ...