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
1answer
18 views

Why does feature scaling improve the convergence speed for gradient descent?

From this article, it says: We can speed up gradient descent by scaling. This is because θ will descend quickly on small ranges and slowly on large ranges, and so will oscillate inefficiently down ...
0
votes
2answers
19 views

How to restrict the values of predicted variable to be positive?

I am using Python Linear Regression to predict the weekly orders for a food deliver company. But some of my orders are coming out as negative. Is there any way to restrict the predicted values to be ...
2
votes
0answers
21 views

Why do you need to use group lasso with categorical variables?

From what I've read you should you use group lasso to either discard the dummy encoded variables (of the category) or use all of them. If you use normal lasso then some of the variables in the group ...
0
votes
1answer
17 views

Coefficients of Linear regression for minimizing MSE

(I asked this in mathematics site, but nobody responded, it seems the whole problem is more related to data science than math.) In a regression problem, loss function is: $$L(a,b) = {\sum_{i=1}^n (y^...
-3
votes
0answers
17 views

Problem statement suggestions for “Analysis of Flipkart Data”, an online shopping site problem

We are performing the analysis of data of an online shopping site. Please refer to the dataset mentioned in this link The fields of the dataset are: We have been asked to do the following: Perform ...
0
votes
0answers
32 views

Given $x_1,…,x_n$, predict $y$ without being able to train on $y$

Say we have some large training data (a time series) of a few thousand rows, i.e. $$X_1=\{x_{1,1},\ldots,x_{1,n}\} \in\mathbb{R}^n, \quad y_1\in\mathbb{R}$$ $$\quad\quad \vdots$$ $$X_m=\{x_{m,1},\...
0
votes
1answer
37 views

Include time as a variable in regression model

I am currently working on a regression problem which requires me to predict the costs of a fixed asset. I have used several variables to do so and derived a predicted cost. However, my superior has ...
0
votes
1answer
14 views

How do I fix mis-rendered matplotlib?

How do I correct my data or format it so that it is presentable, and fix my graphs? Dataset is 345551 rows × 7 columns. I am using numpy, pandas, seaborn and matplot lib. It seems that my pricing ...
0
votes
1answer
18 views

Is it possible to build a regression model for predicting movie gross using sections on their wikipedia pages?

I got this as an assignment from a company recruiter and I've successfully scraped a dataset of about 650 movies with their 'Plot', 'Music' and 'Marketing' sections and gross. I've tried tfidf and ...
2
votes
1answer
25 views

How to cluster/identify points away from a regression line

For many vine plots, I have NDVI and Leaf Area values for each vine. I already know that NDVI and LA has a strong positive correlation as you can see in this picture. But as you can see too, there ...
0
votes
1answer
24 views

How to interpretate multiple histograms corresponding to each feature in multiple linear regression for relationship?

Used matplotlib to plot the histograms for each feature in Boston dataset available in scikitlearn library. How to interpretate the histograms to determine the correlation or significance of that ...
4
votes
3answers
101 views

Reward negative derivative on linear regression

I'm actually new to Data Science and I'm trying to make a simple linear regression with only one feature X ( which I added the feature log(X) before adding a polynomial features) on a motley dataset ...
3
votes
2answers
60 views

Is it valid to shuffle time-series data for a prediction task?

I have a time-series dataset that records some participants' daily features from wearable sensors and their daily mood status. The goal is to use one day's daily features and predict the next day's ...
0
votes
1answer
21 views

Adjusted R-squared is too high (=1) in Linear Model

I built a Linear model which has an adjusted r-squared value of 1. I understand that this is a near perfect number. Upon further investigation, I found that one of the 96 independent variables in the ...
0
votes
0answers
19 views

How to get the weights of a linear model by solving normal equation?

In chapter 6.1 of the book Deep Learning, the author tries to learn the XOR function by using a linear model (on page 168). Linear Model: $f(\mathbf{x};\mathbf{w},b)=\mathbf{x}^T\mathbf{w}+b$ MSE ...
0
votes
0answers
12 views

Machine Learning Algorithm for 'Performance Rating' to Employees

Which Machine Learning Algorithm should i use for Assigning 'Performance Rating' to each Employee based on his LeaveDaysCount and LeaveExtensionPeriod(If Extended).
0
votes
1answer
18 views

I have hourly data of a metric for 15 days, Can i predict the outcome values for same metric for the next 15 days?

I have tried a linear regression model for the same data, Since the regression line is continuous i'm not sure if it works to predict the outcome values for next 15 days, or for a given period of time!...
2
votes
0answers
7 views

Least squares with non-negative eigen values

I am trying to use least squares to solve a problem of the form $u = - K v$ where u and v are vectors of size 3, and K is a 3X3 matrix. Where I want to estimate K, given u and v. I have multiple ...
0
votes
0answers
33 views

Beginner's question

I am a beginner in ML, and I have data that look like a "cross" shape as follow: It seems 2 regression lines are overlapped Would you have any ideas for how to fit or predict y axis with x axis ?
1
vote
2answers
105 views

Why is r squared lowered when adding polynomial features?

I am trying to find a best fit line f(x) = ? for a random set of x,y coordinates. Linear Regression with polynomial features works well for around 10 different ...
0
votes
0answers
14 views

Reproduce Linear Regression Classification Masking Graph of ESL

I would like to reproduce the following graph from the Elements of Statistical Learning Chapter 4 Linear Methods for Classification. It shows the classification masking problem if using linear ...
0
votes
1answer
20 views

Different significant variables but same Adjusted R-squared value

I performed a multiple linear regression on 64 variables with 3 different models: Performed Multiple Linear Regression on all 64 variables Perform Feature Selection with Random Forest and then ...
0
votes
2answers
45 views

A substitute formula for MSE

I don't understand where this formula for Mean Squared Error is coming from. How do we arrive at: $$MSE = \frac{1}{m}||y' - y||_2^2$$ from: $$MSE = \frac{1}{m}\cdot\sum_i(y'_{i} - y_{i})^2$$ (The ...
3
votes
2answers
24 views

Weighted Sum with restricted weights

Given a value $y$ and some values $x_1, ..., x_n$. How do I find weights $w_1, ... w_n$ so that the $error = y - w_1*x_1 + ... w_n*x_n$ is minimal, where the weights have to sum up to 1 or a different ...
0
votes
2answers
23 views

Changing categorical data to binary data is not reflected on the dataset

I am working through the Titanic competition. This is my code so far: ...
2
votes
0answers
22 views

Target Variable Encoding for Time Series Change point detction

I am working on a time series data for which I intend to impliment machine learning model for detecting change point in time series data. This data is recorded fom machinary and we have to predict ...
0
votes
3answers
47 views

Define difference between feature selection and feature reduction [duplicate]

What is the difference between feature selection and feature reduction? When do we use feature selection and what happens when we don't use it? How is this different than feature reduction?
0
votes
1answer
30 views

Linear regression with white Gaussian noise

I am new to machine learning , so this question may sound fundamental. My task is to estimate the parameter vector of the equation with the least squares method: $y = \theta_0 + \theta_1x + \theta_2x^...
3
votes
2answers
45 views

Is there a difference between np.matrix(np.array([0,0])) and np.matrix([0,0])?

I was reading this code, for implemnting linear regression from scratch: ...
4
votes
1answer
76 views

Why does least squares linear regression perform so bad when switching from 2D to 3D line?

The vector of coefficients that minimize least squares can be found like so: beta = ((X'X)^-1)*X'y Theoretically this result is true for any number of variables (...
1
vote
1answer
16 views

Sensorfusion: Generate virtual sensor based on analysis of sensorsdata

I have a steam engine which is equipped with the following sensors: temperature sensor in the boiler room temperature sensor in the heating room pressure sensor in the boiler room rotations-per-...
3
votes
1answer
36 views

Elements of Statistical Learning - question on p. 12

I am starting to work through Elements of Statistical Learning, and right off the bat I am coming across things that I don't understand. I would be grateful for any help from this community. Please ...
0
votes
2answers
43 views

Reducing MAE or RMSE of linear regression

I'm trying to guess a home price, at final I intend to figure out a formula by using linear regression. As you can see over the url, I have 1480 data with 45 features in which ...
1
vote
2answers
81 views

How to import statsmodels module to use OLS class?

I am trying multiple Regression ...
1
vote
1answer
42 views

After plotting my predicted values against the true label values, I didnt quite get the answer I was looking for

I downloaded data on wine quality and tried to run a regression model to predict the quality, However I did not receive the plot I was expecting. The mean absolute error for the wine quality was ...
0
votes
1answer
35 views

When I try to predict with my model I get an Attribute error

After I've created my model using keras sequential, I tried to start predicting on a small sample to see if it would work however I get this error and I have no idea why. error : AttributeError ...
1
vote
1answer
22 views

Why does my linear regression model converge to a non-zero gradient value?

I have a basic 2D Linear Regression model coded out (using gradient descent), yet it doesn't seem to work as well as it should. What I expect is that m and ...
0
votes
3answers
51 views

How can Clustering (Unsupervised Learning) be used to improve the accuracy of Linear Regression model (Supervised Learning)

I came through this questions and I failed to find the right answer for it. How can Clustering (Unsupervised Learning) be used to improve the accuracy of Linear Regression model (Supervised Learning)?...
0
votes
1answer
43 views

Football match prediction using regression

I am trying to predict goal difference of football matches in keras using a single layer Neural Network. I used mse as metrics and its a low value aroung 0.05 but some predictions has huge difference. ...
0
votes
1answer
28 views

R - newdata has X rows but variables have X rows

I have a dataset dimensions 1142obs in 454 variables. I've used 'caret' to separate into training and testing datasets. training =858 obs of 99 var testing =284obs of 99 var I make a linear ...
1
vote
1answer
80 views

Predicting house price using linear regression

I'm trying to predict a house price using linear regression method. I gather the real data from a real estate website. I have some features and two numerical value in which the price is the target ...
0
votes
1answer
23 views

Neural net without hidden layers should be a simple linear model: why do I get so different results?

I’m reading „Elements of Statistical Learning“ where Hastie et al. describe in Section 11.3 on neural nets (p. 394), that (in short) if there are no hidden layers in a neural net (so without non-...
0
votes
3answers
42 views

How to approach this data set for linear regression?

I am new to data science and am currently working on a data science project and have to answer a few questions about the following data set with 18k data points: https://www.kaggle.com/karangadiya/...
0
votes
0answers
16 views

if a time series is not stationary at a weekly level, is it also not stationary at quarterly level?

I have time series of sales of many products on weekly level for 2 years. I am interested in forecasting the sales on quarterly (4-months) level for every product. I also have some exogenous ...
3
votes
1answer
79 views

statsmodels ols does not include all categorical values

I am doing an ordinary least squares regression (in python with statsmodels) using a categorical variable as a predictor. There are 5 values that the categorical variable can have. However, after ...
1
vote
0answers
19 views

Orange 3 - How can a String feature behave as a coefficient?

I'm studying machine learning with data. I have a table including features and a target variable which is the price as in the following. When I want to figure out the coefficients to obtain linear ...
1
vote
1answer
21 views

How is the linear regression cost function evolved?

A couple of weeks ago I joined the Standford University machine learning course on Coursera. In that course, they directly gave the cost function formula without telling how this formula was evolved. ...
1
vote
1answer
21 views

Is linear regression suitable for these data?

I have a data set predicting a continuous variable, $Y$. I have $15$ to $20$ potential feature variables most of which are categorical, some of which are ordinal or categorical. These have been ...
1
vote
1answer
70 views

Simple linear regression in PyTorch

I am performing simple linear regression using PyTorch but my model is not able to properly fit over the training data. please look at the code to find the mistake. Dataset is here ...
0
votes
1answer
31 views

finding optimal solution $w$ and classification accuracy

Suppose you are given $6$ one-dimensional points: $3$ with negative labels $x_1 = −1$, $x_2 = 0$, $x_3 = 1$ and $3$ with positive labels $x_4 = −3$, $x_5 = −2$, $x_6 = 3$. In this question, we first ...