I'm new to Python and trying to perform linear regression using sklearn on a pandas dataframe. This is what I did:
data = pd.read_csv('xxxx.csv')
After that I got a DataFrame of two columns, let's call them 'c1', 'c2'. Now I want to do linear regressio...

Asked By Dinosaur

I'm new to Python and trying to perform linear regression using sklearn on a pandas dataframe. This is what I did:
data = pd.read_csv('xxxx.csv')
After that I got a DataFrame of two columns, let's call them 'c1', 'c2'. Now I want to do linear regressio...

Asked By Dinosaur

I am trying to implement multivariate linear regression in Python using TensorFlow, but have run into some logical and implementation issues. My code throws the following error:
Attempting to use uninitialized value Variable
Caused by op u'Variable/read'...

Asked By NEW USER

I am trying to implement multivariate linear regression in Python using TensorFlow, but have run into some logical and implementation issues. My code throws the following error:
Attempting to use uninitialized value Variable
Caused by op u'Variable/read'...

Asked By NEW USER

I started with simple implementation of single variable linear gradient descent but don't know to extend it to multivariate stochastic gradient descent algorithm ?
Single variable linear regression
import tensorflow as tf
import numpy as np
# create r...

Asked By NEW USER

I am a beginner in machine learning and tensorflow. In the first step trying the tensorflow, I tried a simple multivariate linear regression. However, it seems the model stuck at a local minimum. Here is my code.
import numpy as np
import tensorflow as t...

Asked By Firman

I calculated a model using OLS (multiple linear regression). I divided my data to train and test (half each), and then I would like to predict values for the 2nd half of the labels.
model = OLS(labels[:half], data[:half])
predictions = model.predict(data...

Asked By nickb

I am wondering if there is a better way to test if two variables are cointegrated than the following method:
import numpy as np
import statsmodels.api as sm
import statsmodels.tsa.stattools as ts
y = np.random.normal(0,1, 250)
x = np.random.normal(0,1, ...

Asked By Akavall

I want to build a multiple linear regression model by using Tensorflow.
Dataset: Portland housing prices
One data example: 2104,3,399900 (The first two are features, and the last one is house price; we have 47 examples)
Code below:
import numpy as np
...

Asked By Elsa Lin

I can't seem to find any python libraries that do multiple regression. The only things I find only do simple regression. I need to regress my dependent variable (y) against several independent variables (x1, x2, x3, etc.).
For example, with this data:
p...

Asked By Zach

I am planning to use Linear Regression in Spark. To get started, I checked out the example from the official documentation (which you can find here)
I also found this question on stackoverflow, which is essentially the same question as mine. The answer s...

Asked By Kito

I have a set of data and I want to compare which line describes it best (polynomials of different orders, exponential or logarithmic).
I use Python and Numpy and for polynomial fitting there is a function polyfit(). But I found no such functions for expo...

Asked By Tomas Novotny

How would I plot my linear regression results for this linear regression I did from pandas?
import pandas as pd
from pandas.stats.api import ols
df = pd.read_csv('Samples.csv', index_col=0)
control = ols(y=df['Control'], x=df['Day'])
one = ols(y=df['Sam...

Asked By ccsv

Here is what I am doing:
$ python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>> import statsmodels.api as sm
>>> statsmodels.__version__
'0.5.0'
>>> import ...

Asked By Tom

I'm trying to generate a linear regression on a scatter plot I have generated, however my data is in list format, and all of the examples I can find of using polyfit require using arange. arange doesn't accept lists though. I have searched high and low ab...

Asked By Dingo

I'm trying to generate a linear regression on a scatter plot I have generated, however my data is in list format, and all of the examples I can find of using polyfit require using arange. arange doesn't accept lists though. I have searched high and low ab...

Asked By Dingo

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")
data.cache() # Cache data for faster reuse
data = data.dropn...

Asked By Elm662

Plotting a single variable function in Python is pretty straightforward with matplotlib. But I'm trying to add a third axis to the scatter plot so I can visualize my multivariate model.
Here's an example snippet, with 30 outputs:
import numpy as np
np.r...

Asked By samthebrand

I tried this but couldn't get it to work for my data:
Use Scikit Learn to do linear regression on a time series pandas data frame
My data consists of 2 DataFrames. DataFrame_1.shape = (40,5000) and DataFrame_2.shape = (40,74). I'm trying to do some typ...

Asked By O.rka

I've been trying to get a prediction for future values in a model I've created. I have tried both OLS in pandas and statsmodels. Here is what I have in statsmodels:
import statsmodels.api as sm
endog = pd.DataFrame(dframe['monthly_data_smoothed8'])
smr...

Asked By pythonista