Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [linear-regression]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
58 views

Mean Absolute Error from Scratch in NumPy

I recently tried implementing MAE from scratch in NumPy. The loss value and the slope seem to be equivalent to what Scikit-learn outputs, but for some reason the intercept value seems to converge to ...
vxnuaj's user avatar
  • 11
1 vote
0 answers
34 views

Are there any general theoretical results about the behavior of data in the neighborhood of a single data point?

I know from calculus that any relatively well-behaved function $y=f(x)$ can be approximated by a linear function $y=ax+b$ within a sufficiently small neighborhood around each point of an independent ...
Vladislav Gladkikh's user avatar
0 votes
0 answers
11 views

Should you seasonally decompose TS data before linear regression?

I want to apply the U-MIDAS method which is basically Least Square regression to a cross sectioned time series. Do I need to seasonally decompose my X and Y and should I test for unit root? Some of ...
J_Bake's user avatar
  • 1
0 votes
1 answer
23 views

Using a very very small learning rate to not diverge?

i just started with machine learning and today i tried implementing the gradient descent algorithm for linear regression. If i use a bigger value for alpha(the learning rate) the absolute value of w ...
Foch29's user avatar
  • 1
1 vote
1 answer
29 views

Linear regression with confidence interval

I am running a multivariate linear regression on noisy data, where the amount of error for each measurement is known (or at least estimated). It works reasonably well with weighted linear regression ...
Brad's user avatar
  • 111
0 votes
1 answer
14 views

Data splitting for OLS regression

This is what I have done :: divided my dataset into training and testing sets--> got significant features via. feature selection using sequential feature selector ( MLxtend) on the training set--&...
pomelo's user avatar
  • 1
4 votes
2 answers
123 views

What type of technique can be used to solve this question?

Apology for the ambiguous title, I do not know the term. I have data of some products which a few variables: origin, weight, brand. For example: Product A = "China, 100g, Brand X" Product ...
lpounng's user avatar
  • 1,094
2 votes
0 answers
37 views

Correlation between predictions vs correlation between targets

In a multi-target model framework - where a separate model is estimated for each target - how can one take into account for correlations between targets during the training process ? For example say I ...
Kreol's user avatar
  • 121
0 votes
0 answers
7 views

The best order for analysis steps in building econometric model with time series linear regression

I am working on a project whose goal is to build a linear regression model for a time series dataset. I was provided with a blueprint of all required analysis steps. This led me to wonder what is the ...
Brzoskwinia's user avatar
0 votes
0 answers
22 views

Machine learning model that takes multiple records as input to help predict the last

I want to create a ML model that is able to forecast the yield from a farm. My data source gives me data about the inspections from the field, but that is too much info to fit in 1 record, so there ...
Milan N's user avatar
0 votes
0 answers
22 views

ML Methods For Modelling Latent Variables

I have some time series predictor variables, $\{\mathbf{X}_t\} = \{\mathbf{X}_0, \ldots, \mathbf{X}_n\}$, and some other time series data $\{\mathbf{Z}_t\} = \{\mathbf{Z}_0, \ldots, \mathbf{Z}_n\}$. ...
baked goods's user avatar
0 votes
0 answers
17 views

5-fold cross validation in R: getting error Age variable different lengths

I am tasked to do a 5-fold cross validation for my R grad course with pga golf data. I continually get an error for a certain variable, Age, saying different lengths. Here is the error code: ...
Heather S.'s user avatar
1 vote
1 answer
51 views

Minimize $\sum_i||Y_i-AX_i||^2$

I have N data vectors $X_i$ and N target vectors $Y_i$ where $i$ indexes the sample. I would like to learn a linear map $A$ between the data and the target i.e find the matrix $A$ that minimize $$\...
Nichola's user avatar
  • 113
0 votes
0 answers
39 views

Multiplying by Diagonal Matrix On Top of Standard Linear Regression

In minimizing $$min_x||Ax-b||$$ where $A$ is overdetermined, one could use least squares method. However, if there is another diagonal matrix $d$ which has $k$ unique entries along the diagonal with $...
Trevor Arashiro's user avatar
0 votes
1 answer
37 views

Can Linear Models infer Product Sum operation of Features to predict Target?

In a dataset of 9 columns: $X_1-X_8, y$. $y = X_1 * X_5 + X_2 * X_6 + X_3 * X_7 + X_4 * X_8$ Can any form of linear model (anything but SVM, NN, Random Forest, XGBoost, etc.) predict $y$?
Emad Ezzeldin's user avatar
1 vote
1 answer
109 views

pos_label=1 is not a valid label. Should be one of [2,4]

I am trying to retrieve my precision score but I am getting an error as follows: pos_label=1 is not a valid label. It should be one of [2 ,4] And here is the code ...
Hanh's user avatar
  • 13
0 votes
0 answers
17 views

Why do we have multi-target linear regression model? Is it solely because of the overwhelming number of target variables?

As the title stated: Why do we have multi-target linear regression model (a linear regression model that predicts several targets at once with a unique set of parameters)? Is it solely because of the ...
MathematicsBeginner's user avatar
0 votes
0 answers
26 views

Using simple RNN to identify a simple dynamic linear system

I have been trying to identify a simple linear second order system (e.g. a pendulum or a mass-spring system), by simulating it in Python using backwards-euler method and then feeding the step changes ...
APasagic's user avatar
0 votes
1 answer
67 views

Effect on regression coefficients by multiplying a constant to a feature

I was solving one quiz question on Coursera and I found an interesting question. If you double the value of a given feature (i.e. a specific column of the feature matrix), what happens to the least-...
teddcp's user avatar
  • 165
2 votes
1 answer
163 views

Model performance impact on social discrimination?

I am currently working on a project where the data concerns people and the dataset contain personal data with sensitive attributes. (typically: age, sex, handicap, race). Now it seems there are mainly ...
Lucas Morin's user avatar
  • 2,244
0 votes
1 answer
66 views

Use prediction after using get_dummies in pandas?

I found similar question on this topic but no answer was helpful. I had a data frame with a categorical column in it with 5 different values. I used get_dummies and used linear regression for ...
Ali.A's user avatar
  • 71
0 votes
1 answer
24 views

Are my regression metrics value correct?

So im using a dataset for Wine Prediction where im using Linear Regression model to predict the prices. These are the steps i'm using: ...
Rushabh Kayadra's user avatar
0 votes
1 answer
52 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 ...
PS Nayak's user avatar
  • 173
0 votes
0 answers
31 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 ...
Little L's user avatar
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_\...
AXCLRoseUp's user avatar
0 votes
0 answers
14 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$ (...
kkkk0's user avatar
  • 1
0 votes
1 answer
112 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 ...
mocquin's user avatar
  • 101
0 votes
0 answers
16 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 ...
BigMistake's user avatar
1 vote
0 answers
32 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?
BigMistake's user avatar
0 votes
1 answer
107 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 ...
Justin Jonany's user avatar
1 vote
1 answer
75 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 ...
Justin Jonany's user avatar
0 votes
0 answers
12 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. ...
RajS's user avatar
  • 103
0 votes
2 answers
453 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?
user avatar
0 votes
0 answers
18 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 ...
Python Student's user avatar
0 votes
0 answers
42 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. ...
Guilherme Raibolt's user avatar
0 votes
0 answers
24 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, ...
Ali s.k's user avatar
  • 101
1 vote
0 answers
45 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 ...
Felipe's user avatar
  • 21
0 votes
0 answers
52 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 ...
felix_the_cat's user avatar
0 votes
1 answer
20 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 ...
PressureQuery's user avatar
2 votes
2 answers
674 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 ) ...
a_jelly_fish's user avatar
0 votes
1 answer
35 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 ...
avpol's user avatar
  • 21
0 votes
1 answer
22 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)...
Hariprasad Rao's user avatar
0 votes
0 answers
63 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 ...
SilianRail's user avatar
0 votes
0 answers
25 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 ...
Payal Bhatia's user avatar
0 votes
1 answer
81 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 ...
Brett L's user avatar
0 votes
0 answers
91 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 ...
cwanderroycbooks's user avatar
1 vote
1 answer
76 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 ...
MLENGG's user avatar
  • 11
0 votes
2 answers
70 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 ...
mainak mukherjee's user avatar
0 votes
0 answers
22 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 ...
m sh's user avatar
  • 3
2 votes
2 answers
524 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 ...
amy_hislop's user avatar

1
2 3 4 5
…
16