linear-regression Questions
3
Solved
I have been trying to use the scikit-learn library to solve this problem. Roughly:
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
# Make or ...
Giraffe asked 10/10 at 17:32
0
Optimized linear regression over multiple timeseries and expanding time window in a Pandas dataframe
I have a dataframe holding multiple timeseries and I want to fit a line on each one and return the slope and intercept, and I want to do it in an expanding way: so first compute the intercept at th...
Toadeater asked 8/7 at 16:50
5
Solved
I have some more or less linear data of the form:
x = [0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 2.0, 4.0, 6.0, 8.0, 10.0, 20.0, 40.0, 60.0, 80.0]
y = [0.50505332505407008, 1.1207373784533172, 2.19818447190200...
Natation asked 3/4, 2012 at 9:45
3
Solved
I'm not seeing what is wrong with my code for regularized linear regression. Unregularized I have simply this, which I'm reasonably certain is correct:
import numpy as np
def get_model(features, ...
Machination asked 15/12, 2014 at 3:26
2
Solved
rich.main3 is a linear model in R. I understand the rest of the elements of the list but I don't get what qraux is. The documentation states that it is
a vector of length ncol(x) which contains...
Halo asked 3/8, 2016 at 10:34
2
I am learning gradient descent for calculating coefficients. Below is what I am doing:
#!/usr/bin/Python
import numpy as np
# m denotes the number of examples here, not the number of features...
Callboard asked 25/6, 2014 at 14:24
2
Solved
Seems like a basic question, but I need to use feature scaling (take each feature value, subtract the mean then divide by the standard deviation) in my implementation of linear regression with grad...
Limpet asked 16/1, 2014 at 17:33
9
Solved
While practicing Simple Linear Regression Model I got this error,
I think there is something wrong with my data set.
Here is my data set:
Here is independent variable X:
Here is dependent varia...
Episodic asked 3/7, 2018 at 8:40
5
Solved
I fit a linear regression model on 75% of my data set that includes ~11000 observations and 143 variables:
gl.fit <- lm(y[1:ceiling(length(y)*(3/4))] ~ ., data= x[1:ceiling(length(y)*(3/4)),]) ...
Sherlock asked 5/9, 2014 at 17:33
3
I have a question. When I import 'variance_inflation_factor ' from 'statsmodels.stats.outliers_influence', I get ' module 'numpy' has no attribute 'MachAr'' error, what is the reason?
I once execut...
Hermie asked 7/2, 2023 at 9:17
6
Solved
def gradient(X_norm,y,theta,alpha,m,n,num_it):
temp=np.array(np.zeros_like(theta,float))
for i in range(0,num_it):
h=np.dot(X_norm,theta)
#temp[j]=theta[j]-(alpha/m)*( np.sum( (h-y)*X_norm[:,j]...
Burstone asked 22/7, 2013 at 9:55
3
Solved
Please forgive my ignorance. All I'm trying to do is add a squared term to my regression without going through the trouble of defining a new column in my dataframe. I'm using statsmodels.formula.ap...
Coverup asked 19/5, 2020 at 19:45
5
Solved
With scipy.stats.linregress I am performing a simple linear regression on some sets of highly correlated x,y experimental data, and initially visually inspecting each x,y scatter plot for outliers....
Knitwear asked 19/4, 2012 at 15:14
7
I tried a simple example like:
data = sqlContext.read.format("csv").option("header", "true").option("inferSchema", "true").load("/databricks-datasets/samples/population-vs-price/data_geo.csv")
da...
Technology asked 18/8, 2016 at 10:57
2
Solved
I am setting up a predictive analytics pipeline on some data, and I am in the process of model selection. My target variable is skewed, so I would like to log-transform it in order to increase the ...
Announce asked 25/4, 2019 at 23:15
2
I've been googling fervently and cannot find an answer.
How do I calculate the f-statistic using sklearn? Do I really have to compute it by hand, given the formula:
(where 𝑁 is the number of o...
Gause asked 22/10, 2019 at 5:4
1
How can multivariate linear regression be adapted to do multivariate polynomial regression in Javascript? This means that the input X is a 2-D array, predicting a y target that is a 1-D array.
The...
Raincoat asked 4/11, 2018 at 21:38
1
I encountered RuntimeWarning when using Ridge().fit(X_train, y_train) on a dataset where X_train.shape = (9440, 1900)
/Users/username/micromamba/envs/data-science/lib/python3.11/site-packages/sklea...
Minna asked 21/6, 2023 at 22:35
2
Solved
Problem Statement:
I have some nice data in a pandas dataframe. I'd like to run simple linear regression on it:
Using statsmodels, I perform my regression. Now, how do I get my plot? I've tried st...
Eucharis asked 15/2, 2017 at 23:20
3
I am running the following (truncated) code using glmnet in R
# do a lot of things to create the design matrix called x.design
> glmnet(x.design, y, thresh=1e-11)
where x.design is a n x p d...
Valonia asked 18/2, 2019 at 21:46
2
Solved
I want to compute AIC for linear models to compare their complexity. I did it as follows:
regr = linear_model.LinearRegression()
regr.fit(X, y)
aic_intercept_slope = aic(y, regr.coef_[0] * X.as_m...
Projectionist asked 11/7, 2017 at 11:58
2
Solved
When using seaborn barplot, I can specify an alpha to make the bars semi-translucent. However, when I try this with seaborn regplot, I get an error saying this is an unexpected argument.
I read the...
Creep asked 8/10, 2015 at 3:1
6
Solved
When using sklearn.cross_decomposition.PLSRegression:
import numpy as np
import sklearn.cross_decomposition
pls2 = sklearn.cross_decomposition.PLSRegression()
xx = np.random.random((5,5))
yy = np...
Haden asked 31/10, 2015 at 3:42
2
Solved
While I am predicting the one sample from my data, it gives reshape error but my model has equal number of rows. Here is my code:
import pandas as pd
from sklearn.linear_model import LinearRegressi...
Percheron asked 1/11, 2019 at 17:56
5
Solved
I have figured out how to make a table in R with 4 variables, which I am using for multiple linear regressions. The dependent variable (Lung) for each regression is taken from one column of a csv t...
Stroman asked 14/1, 2015 at 21:19
1 Next >
© 2022 - 2024 — McMap. All rights reserved.