Questions tagged [linear-regression]
Techniques for analyzing the relationship between one (or more) "dependent" variables and "independent" variables.
755
questions
0
votes
1
answer
41
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
8
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
31
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
47
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 ...
0
votes
0
answers
16
views
Understanding perceptron learning algorithm
I was revisiting perceptron learning algorithm. The wikipedia page gives the algorithm as follows:
Initialize the weights to 0 or a small random value.
For each example $j$ in our training set $D$, ...
0
votes
2
answers
40
views
The ideal function in R for fit fitting n LASSO Regressions on n data sets
As part of a statistical learning research paper I am collaborating on, I am running/fitting two hundred sixty thousand different LASSO Regressions on the same number of different randomly generated ...
1
vote
1
answer
39
views
How to curve fit, Z variable dependent on X and Y?
I'm trying to find the function for this visualization:
I would like to get feedback if I'm taking the right approach. My approach:
These data points are created by a person. They are two ...
0
votes
0
answers
5
views
How to use this data set for spatial regression?
I want to graph how much a customer spends by region and have hotspots for high spending regions. Here is an example of the csv file.
0
votes
1
answer
37
views
Predict coordinates from input of coordinates
I'm a newbie at data science and I want to ask how can I predict a set of coordinates from a set of input coordinates? That is (x1, y1) -> (x2, y2).
To give a ...
0
votes
1
answer
20
views
Linear regression not converging
I'm trying to implement the simplest possible machine learning algorithm which is linear regression. But I'm having trouble because the loss function is not converging. Please can you look at my ...
0
votes
1
answer
35
views
How to run a BE or FS Stepwise Regression on each dataset in a file folder full of datasets using lapply or map (without a loop)
All of the code in this question can be found in my GitHub Repository for this research project on Estimated Exhaustive Regression. Specifically, in the "Both BE & FS script" and "...
0
votes
1
answer
32
views
Day number as a feature in Linear regression
Goal - To train a Linear regression model for climatic studies.
Planned features: - Temperatures, Latitude, Longitude, Day Number (1st February = 32)
Would it be correct to include day number like ...
0
votes
1
answer
19
views
How to isolate a clear relationship from a subset of data with lots of noise and outliers
I am doing an analysis of aircraft data and I want to see how much fuel is burnt on landing. There are 2 main factors aircraft type and landing time (ie. time elapsed)
However there is a cheeky third ...
0
votes
1
answer
16
views
What (in the world) is well-conditioned vs. low rank fat-tail singular profile?
Scikit learn has a make_regression data generator. Can someone explain it to me like I'm 5 what is meant in the help docs by "The input set can either be well ...
0
votes
1
answer
32
views
Normalising data for simple linear regression
Consider a simple linear regression problem where:
X = [1,2,3,4,5,100,200]
Y= [2,4,6,8,10,200,400]
Clearly, the relationship is of the form $y=2x$; While trying ...
0
votes
0
answers
25
views
Is there a difference in result if we apply Polynomial / Kernel Regression on mean of target data, or all data?
Let's say we have some data :
input data X with shape (1, N=100), this will be duplicated 1000 times.
target data Y with shape (S=1000, N=100).
We have 1000 experimental data points, samples.
My ...
2
votes
1
answer
45
views
How to implement linear regression
I am having difficulty achieving the same result as in sklearn while implementing linear regression model from scratch.
After adjusting the learning rate, I obtained an AUC of 0.694 for this binary ...
0
votes
0
answers
17
views
Jorda local projections: different size of shocks lead to different conclusions
I use Jorda local projections and I can't get my head around the following.
If I run a Jorda local projection considering a shock of size 1 (say one standard deviation) on my variable of interest X, ...
0
votes
0
answers
19
views
What's the difference between transforming data (Square-root/log/Square/Cube) and adding Polynomial Terms for better fitting a regression line?
The immediate difference in both the approaches might seem that when we are introducing Polynomial features for Polynomial regression we are also including the original term in our linear equation. ...
0
votes
0
answers
19
views
When a linear regression results in line, hyperplane or a curve?
I was trying to understand the nature of linear regression output.
Some say
"linear" in linear regression applies to coefficients and not to the data points. So $y = b_0 + b_1x$ is linear, ...
0
votes
1
answer
21
views
Create ML model from dataframe with small number of rows
I have a dataframe with 50 rows (one row for each US state), and about 20 columns with different attributes with state related data. I'm looking to build a linear regression model to predict ...
0
votes
1
answer
29
views
How to choose neural network architecture for a relatively small dataset with less than 10 features for regression?
How to go about selecting an architecture for a dataset with 80 datapoints and 9 features for a regression model?
Working on the Desarhnais dataset, with "Effort" as the target variable.
...
0
votes
1
answer
192
views
Linear Regression line not showing in plot
It's a silly problem, I know, but it's getting my nerves. Everything seems fine, but I cannot get the line to show on the plot.
I've put it in a public Google notebook, for your convenience.
t ...
0
votes
0
answers
15
views
How to decide which feature in DataFrame can be deleted (feature selection)?
I'm new to Machine Learning, and I'm working on dataset "Combined Cycle Power Plant over 6 years (2006-2011)", when the power plant was set to work with ...
0
votes
0
answers
41
views
Hello! I am create linear model in python, and have question. It's bad score or good score?
please, take me info, this bad or good?
I am real don't understand....
i'm know, also when
Mean Absolute Deviation (MAD): In [0,∞), the smaller the better
Root Mean Squared Error (RMSE): In [0,∞), the ...
0
votes
0
answers
7
views
Transforming data with a 1/x-like distribution
I am working on a data science course where we are asked to predict from a very limited dataset such that almost all features are ones we make ourselves based on secondary data. I am doing this ...
0
votes
0
answers
16
views
a model to predict a day from other days?
I have the day of the month of 100 purchases made by a customer. Is it reasonable to use linear regression to predict the day of the month of purchase 101? Or what kind of algorithm should I use? How ...
0
votes
0
answers
21
views
How to filter noise from piecewise linear dataset
Assume that a vehicle is moving with a constant speed, and the observed path is given by a set of points
$$(X, Y) = (x_i, y_i)_{i=1}^{N} \in \mathbb{R}^2$$
We know that:
observations are noisy: if $(...
0
votes
0
answers
13
views
How to aggregate effects of time series, VAR and linear regression on the same dataset?
I have the Walmart store data from here
https://www.kaggle.com/competitions/walmart-recruiting-store-sales-forecasting/data
Say I aggregated the data at date level and now want to predict sales.
There ...
0
votes
0
answers
52
views
What are the pros and cons of R2 (coefficient of determination)?
What are the pros and cons of $R^2$ (coefficient of determination) which is an evaluation metric?
2
votes
1
answer
26
views
What is the best way to determine if there is variable interactivity between independent parameters in a prediction model
OK, the best way to describe this is with an example. (admittedly simplified)
I want to predict the speed of drivers on a motorway and I have two input variables
the nationality of the driver
how ...
0
votes
0
answers
38
views
linear regression - at future time points
I have a dataset of customer transactions containing revenue, customer id, region, product category, product id, support team, date of transaction etc. The data ranges from Jan 2017 to Nov 2nd 2022.
...
0
votes
0
answers
43
views
Predict numerical values based on categorical data
I have an idea of creating a Machine Learning Model, but I'm not sure if I'm doing this right. My goal is to predict the prices of mobile devices using a few features like storage size, screen size, ...
0
votes
0
answers
97
views
Can we perform stratify in train_test_split for linear regression model
I wanted to perform stratify method while splitting tran_test_split for linear regression problem.
I know that stratify will perform on classification problems as it excepts 2 or more classes
what to ...
0
votes
0
answers
15
views
Why is ElasticNet performing worst than both Ridge and Lasso?
I am using these three methods on the diabetes dataset from sklearn and I wasn't expecting this result.
This is my code:
...
0
votes
0
answers
19
views
Error in system(cmd, input = filelist, intern = TRUE) : 'zip' not found
I am new to programming, I just learned R. This is the error I'm dealing with Error in system(cmd, input = filelist, intern = TRUE) : 'zip' not found.
This is my code and I am trying to save this file ...
0
votes
1
answer
475
views
ValueError: Found unknown categories ['IR', 'HN', 'MT', 'PH', 'NZ', 'CZ', 'MD'] in column 3 during transform
I am trying to use Linear Regression, to predict salary in USD. I have the following data:
Data:
607 records
Numerical columns: year, salary, salary in USD
Categorical columns: experience, type, ...
0
votes
1
answer
18
views
What does the order of the lm summary coefficients signify?
I have
fit.all <-lm(Sepal.Length ~ .,iris)
summary(fit.all)->fit.all.summary
print(fit.all.summary$coefficients)
What are the coefficients ordered by?
0
votes
0
answers
15
views
how to find values in regression and variance or bias relationship?
We use variance and bias in many places in the regression section. We are trying to drop it in most places etc. But while doing these, as far as I can see, we do not make comparisons with net values. ...
0
votes
0
answers
18
views
Threshold linear regression
When it comes to threshold linear regression, in order to estimate it can we simply divide our dataset according to the threshold rule into 2 datasets and then simply estimate 2 equations with OLS? Or ...
0
votes
2
answers
26
views
Tensorflow - do I need to learn computer vision before linear (timeseries) regression?
I'm a newbie to tensorflow / keras and I am currently working my way through Deep Learning with Python (2nd edition) by Francois Chollet.
I understand the basics of Computer vision and the MNIST ...
0
votes
0
answers
21
views
Why is this an incorrect update of the parameters in the gradient descent algorithm? (Bishop, Pattern Recognition and Machine Learning)
Let's say we are performing a linear regression, with general model $y(x,w) = w_0 + w_1x$. The error function is $E(w) = \frac{1}{2N}\sum_n ((y(x_n,w)-t_n)^2$, for $N$ datapoints ${(x_n,t_n)}$ (...
0
votes
1
answer
124
views
Feature scaling in Linear Regression
I always use Linearregression() class in sklearn library for creating a linear regression model. According to my understanding, we need feature scaling in linear ...
2
votes
1
answer
160
views
Dummy Variable trap in Linear Regression
The dummy variable trap is a common problem with linear regression when dealing with categorical variables, since one hot encoding introduces redundancy, so if we have m categories in our categorical ...
-1
votes
1
answer
19
views
How do the intercept and slope calculated in linear regression relate to the output of lm?
I have been looking at how to calculate coefficients by hand
and the example produces
$Y = 1,383.471380 + 10.62219546 * X$
However the output shown of lm does not show these values anywhere.
How do I ...
2
votes
1
answer
425
views
Predict actual result after model trained with MinMaxScaler LinearRegression
I was doing the modeling on the House Pricing dataset. My target is to get the mse result and predict with the input variable
I have done the modeling, I'm doing the modeling with scaling the data ...
0
votes
1
answer
56
views
Linear regression with large dataset
I have a dataset with 6 categorical variables ( nominal variables), each of which have 10 categories. The dataset include 10 independent variables and 1 dependent variable. There are 500K observations ...
0
votes
1
answer
55
views
Is it necessary to have a perfect correlation when using linear regression?
I am working on predicting BMI against weight, using linear regression.
The scatter plot of the data can be found below.
As you can see in the plot, there seems to be low (or no) correlation between ...
0
votes
0
answers
26
views
Should I get dummies and then look at multicollinearity?
I have data that includes continuous and categorical features. The task is regression and I am looking to remove features that are high correlated with other features (multicollinearity). To do this, ...
0
votes
0
answers
28
views
How does LinearRegression() selects the most significant features in multiple linear regression?
There 5 ways to build a multiple linear regression through selecting the most significant features, examples are : All in , Backward Elimination and Forward Selection. However, in the ...