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
3answers
38 views

Why would it be bad to fit a linear regression to a binary classification problem?

Let's say that we have a binary classification problem. Why would it be bad to fit a linear regression and then classify given a threshold? The output would be continuos and it could be out of range,...
0
votes
1answer
20 views

Deciding what type of model to use for predicting the bottom decile of student grades

I have a large dataset which includes 36 variables (in %iles) to describe a student, and then the output is the students grades as a %ile. I am trying to predict, using the 36 variables, whether a ...
0
votes
0answers
11 views

Using sklearn's make_pipeline output doesn't match between test dataframe and output dataframe

I have a simple sklearn pipeline defined as below and I create a train_test split to fit and test my model. The R2-score looks ...
0
votes
0answers
14 views

Learning curve and Lambda curve doubt!

Please tell me if my understanding is right or not! I am stuck on this for long! First, Let's consider Linear regression. Now, For this we define a cost function without regularization. After ...
5
votes
1answer
167 views

Why Scikit and statsmodel provide different Coefficient of determination?

First of all, I know there is a similar question, however, I didn't find it so much helpful. My issue is concerning simple Linear regression and the outcome of R-Squared. I founded that results can ...
1
vote
1answer
14 views

How is learning rate calculated in sklearn Lasso regression?

I was applying different regression models to Kaggle Housing dataset for advanced regression. I am planning to test out lasso, ridge and elastic net. However, none of these models have learning rate ...
0
votes
0answers
22 views

How do I predict a future value on a curve that I know will exponentially decay?

I have a generic equation r = e^(-x/s) (red line) given a specific s and I'm also graphing s ...
-2
votes
1answer
24 views

Limitations of Regression in ML?

I've been learning some of the core concepts of ML lately and writing code using the Sklearn library. After some basic practice, I tried my hand at the AirBnb NYC dataset from kaggle (which has around ...
1
vote
1answer
23 views

Why transpose of independent feature matrix is necessary in case of linear regression?

I can follow classical linear regression steps: $Xw=y$ $X^{-1}Xw=X^{-1}y$ $Iw=X^{-1}y$ $w=X^{-1}y$ However, on implementing in Python, I see that instead of simply using ...
0
votes
1answer
33 views

Implementing single variable Linear Regression in python

I'm trying to implement LMS algorithm in python. I have the following code: ...
5
votes
3answers
106 views

Problem with basic understanding of polynomial regression

I have an understanding of simple linear regression. Clear that results in a fitted line like this: However, studying polynomial regression is a bit of a challenge having some questions about the ...
1
vote
2answers
53 views

Linear vs Non linear regression (Basic Beginner)

So my doubt is basically in Linear regression, We try to fit a straight line or a curve for a given training set. Now, I believe whenever the features (independent variable) increases, parameters also ...
2
votes
1answer
28 views

Regularization for intercept parameter

Why is the regularization parameter not applied to the intercept parameter? From what I have read about the cost functions for Linear and Logistic regression, the regularization parameter (λ) is ...
6
votes
2answers
132 views

Confidence interval interpretation in linear regression when errors are not normally distributed

I've read that "If the error distribution is significantly non-normal, confidence intervals may be too wide or too narrow" (source). So, can anyone elaborate on this? When are the confidence intervals ...
0
votes
2answers
29 views

Split data into linear regression

I am looking for a way that could help me create more precise models. Let's say these are real estate prices for different areas. Only in the data I do not have a clear division into these areas I ...
0
votes
0answers
11 views

Does Generalised Additive Models handle Multicollinearity out of the box while building a Regression Model in Python

While Building a Generalised Additive Model for Logistic Regression, will the multicollinearity between the predictor variables are taken care of out of the box by the algorithm or do we need to ...
0
votes
1answer
25 views

Build a Generalised Regression Model Containing Linear and Non Linear Predictor Variables with a Target Variable in Python

Imagine a dataset having five predictor variables and a target variable, through scatter plot I observed three predictor variables having a linear relationship with the target variable and the other ...
0
votes
1answer
77 views

Why linear regression feature coefficients become super large?

Introduction I've implemented linear regression using sklearn and after all calculations I've got results like this: ...
0
votes
3answers
64 views

Apply multivariable linear regression to a dataset in pandas with sklearn

I'm trying to predict the population for states and the country in 2050. My current dataset has values for each state from 1951,1961...2011 in the same table. Here is a sample view: ...
0
votes
2answers
28 views

What to do if one out of 2 one-hot encoding variables have a very high p-value?

I ran an OLS model on a dataset with 2 categorical variables. One of them was gender. The other one had 3 different categories. I used one-hot encoding for it during pre-processing before running my ...
0
votes
1answer
38 views

I am getting very minimal mse values and not sure if it is correct?

Below is the linear regression model I fitted and not sure if I am doing the right way as I am getting neat to 99% accuracy Fitting Simple Linear Regression to the Training set ...
0
votes
0answers
11 views

How to re scale log transformation followed by standard scaling of predicted variables to original scale in python?

I am new to python programming, I was working on Linear regression and followed the below steps Initially took log transformation to convert data to Gaussian distribution Then utilized standard ...
1
vote
0answers
8 views

Linear regression with a fixed intercept and everything is in log

I have a set of values for a surface (in pixels) that becomes bigger over time (exponentially). The surface consists of cells that divide over time. After doing some modelling, I came up with the ...
1
vote
1answer
46 views

Dummy Variable Trap

In my course about machine learning I'm studying multiple linear regression and we talked about dummy variable trap. I have a data set which contains country, height, weight, gender of every person ...
0
votes
0answers
18 views

gradient descent regression in matrices form diverges

I am trying to build fit the best fit for my random distribution. I have done exactly by the formulas in the book shown bellow. I get divergence in the error function. Where did I go wrong? my Matlab ...
0
votes
0answers
81 views

Which of the following is a consequence of Selecting model complexity on test data? (multiple right answers)

Selecting model complexity on test data (choose all that apply): A. Allows you to avoid issues of overfitting to training data B. Provides an overly optimistic assessment of performance of the ...
0
votes
1answer
20 views

What is the scalability of linear regression and decision trees?

Recently I'm studying machine learning algorithms among them linear regression and decision tree so I have a question regarding the scalability of both algorithms. Can anyone provide what is the ...
-1
votes
2answers
44 views

Machine Learning. Need help in Linear Regression

New in Machine Learning. I am very confused about- how I should approach to this kind of Problem. I want to know how can I get (the correct answer) theta-1 and theta-0 without implementing linear ...
0
votes
1answer
22 views

Multivariate Polynomial Feature generation

I don't quite seem to understand the rules used to create the polynomial features when trying to find a polynomial model with Linear Regression in the multivariate setting. Let's say I have a two ...
2
votes
0answers
13 views

Adding high p-value and low R square features in linear regression model to improve result

I am working on a linear regression problem. The features for my analysis have been selected using p-values and domain knowledge. After selecting these features, the performance of $R^2$ and the $...
0
votes
0answers
37 views

Linear and logistic regression output with same neural network

it seems like this should be a very common task, but I have not found anything useful on my research: How can I do linear and logistic regression with the same neural network? By example, what I mean ...
1
vote
1answer
36 views

Find the Weight Values using Linear Regression Analysis in Python

I have the equation below, which is a noise quality metric of an image: If the BIQS is 1, it means the image is clean. Else, if ...
0
votes
0answers
14 views

Timeseries prediction with linear regression?

I'm new in the data science field and I need some guidance on best practices. I have a data set coming from a timeseries where I have the displacement at a point of a structural element and the ...
0
votes
0answers
15 views

Opposite results using statsmodels and seaborn regplot

I use regplot using the following code: sns.regplot(x = "Year", y = "Data_Value", data = NOAA_TMAX_s ); and I obtain the following figure: showing clearly that ...
0
votes
0answers
10 views

Does severe multicollinearity affect solving linear regression by gradient descent?

Since OLS may fail when there is severe/near perfect multicollinearity, how would gradient descent perform in such a scenario? Does it converge at the minima? (My guess is, Cost function of linear ...
5
votes
3answers
106 views

How to normalize data without knowing the min and max values?

I have a Lending club dataset from Kaggle; it contains many different columns: there are for example dummy variables, years, amount of the loan...ect I want to normalize the data in the training and ...
0
votes
0answers
18 views

Building a gradient descent linear regression model from scratch on Python

I am trying to build a liner regression model using batch gradient descent to minimize the cost function. However, I am clearly doing something wrong because when I try to plot my cost history after ...
1
vote
1answer
21 views

I don't understand RidgeCV's fit_intercept, and how to use it for my data

Alright, I have an assignment that makes me calculate weights for a function with different terms. At first, I thought I might just leave the weight for the term $1$ out, and instead use the intercept....
0
votes
0answers
38 views

Workng of LME model used for a set of category variable(s) and a continuous variable?

LME models are being used to analyze the effect of continuos data and category data. Is this model appropriate for checking the effect of two independent variables - one with continuous values and ...
0
votes
0answers
14 views

scaling credit risk scorecard

I need to build a credit risk scorecard using logistic and linear regression. The variables using to predict are all dummies, where each dummy is a bin of some variable. Let's say the variable age, I ...
1
vote
0answers
84 views

Linear regression : ValueError: operands could not be broadcast together with shapes (3,) (1338,)

I try to use linear regression for insurance data . But had error on the when try to call a function with features parameter. Here is my code: ...
0
votes
0answers
20 views

Specifying priors in rstanarm for hierarchical model

We are given the model $$ \begin{align*} y_{ij} & \sim \mathsf{Normal}(\alpha_j + \beta x_i, \sigma^2)\\ \alpha_j & \sim \mathsf{Normal}(\gamma_0 + \gamma_1 u_j, \tau^2) \end{align*} $$ with ...
3
votes
3answers
65 views

Difference between Ridge and Linear Regression

From what I have understood, the Ridge Regression is just having the loss function for an optimization problem with the addition of the regularization term (L2 Norm in the case of Ridge). However I am ...
0
votes
1answer
30 views

Change date in linear regression model [closed]

Im trying to run a linear regression model with Years as the x variable and temperature on the y variable but I keep getting errors. I manage to run a regression model using the below code and also ...
0
votes
1answer
35 views

Covariance matrix in linear regression

I have read about linear regression and interpreting OLS results i.e coefficients, t-value, p-value. But unable to find any material related to covariance matrix in linear regression. I was reading ...
3
votes
1answer
67 views

Linear regression assumptions

I have read that we make the following assumption for linear regression: 1. Linearity (correct functional form) 2. Constant error variance (homoskedasticity) 3. Independent error terms (no ...
4
votes
1answer
214 views

How to solve the gradient descent on a linear classification problem?

I have a problem which i have attached as an image. Problem is in image attached what I understand error function is given by: $e(y, \hat y)=0$ if $y \cdot a(x-b) \ge 1$ or $e(y, \hat y) = 1-y\cdot ...
0
votes
0answers
16 views

Linear Mixed Model vs Variable Interaction

I am studying relationship between 'Y' and two continuous vars(X1, X2) + one categorical var (C). I think the categorical variable not only influence 'Y', but also changes coefficients of continuous ...
-1
votes
1answer
38 views

Linear Regression to predict a growing variable with time

Can we use Multiple Linear Regression to predict a dependent variable that is growing exponentially with time?

1
2 3 4 5
10