regression

How to save each iterating Statsmodel as a file to be used later?

How to save each iterating Statsmodel as a file to be used later? Question: I have the following table generated: import pandas as pd import numpy as np from matplotlib import pyplot as plt # Generate ‘random’ data np.random.seed(0) X = 2.5 * np.random.randn(10) + 1.5 res = 0.5 * np.random.randn(10) y = 2 + …

Total answers: 2

Loop through each row and build regression model & plot (n-1 row step through)

Loop through each row and build regression model & plot (n-1 row step through) Question: I have a simple linear regression model below, that has been fit to a 10 row data. import pandas as pd import numpy as np from matplotlib import pyplot as plt # Generate ‘random’ data np.random.seed(0) X = 2.5 * …

Total answers: 2

What is the best practice to apply cross-validation using TimeSeriesSplit() over dataframe within end-2-end pipeline in python?

What is the best practice to apply cross-validation using TimeSeriesSplit() over dataframe within end-2-end pipeline in python? Question: Let’s say I have dataset within the following pandas dataframe format with a non-standard timestamp column without datetime format as follows: +——–+—–+ |TS_24hrs|count| +——–+—–+ |0 |157 | |1 |334 | |2 |176 | |3 |86 | |4 …

Total answers: 2

Multiclass regression using one vs one

Multiclass regression using one vs one Question: I am trying to fit a logistic regression using the method of one vs one in R or Python however nothing seems to work. I have an interest variable Y with 4 classes and 16 X variables. In my model, I would like to use all X variables …

Total answers: 1

Frequency of a single value in dataframe column

Frequency of a single value in dataframe column Question: Let a column of dataset be ITEM 2 10 -200 3 6 -200 -200 and i want to get only the number of times -200 occured in the column and also the percentage for example in given data set we have 7 rows and out of …

Total answers: 2

Least Squares regression doesn't fit properly

Least Squares regression doesn't fit properly Question: My goal is to fit a decent regression and exclude data that does not fit within a criteria. I need to take data that can correlate well for my project. There is sample data below. I have an issue with my code for least squares regression. The picture …

Total answers: 1

Drawing line of regression onto scatter graph in python

Drawing line of regression onto scatter graph in python Question: I am trying to draw the line of regression onto a scatter graph. I have two functions: def place_y(x, slope, intercept): return slope * x + intercept def draw_line_of_regression(): """The line of regression can be used to predict further values""" import matplotlib.pyplot as plt # …

Total answers: 1

How to get proper feature importance information when using categorical feature in h2O

How to get proper feature importance information when using categorical feature in h2O Question: When I have categorical features in my dataset, h20 implies one-hot encoding and start the training process. When I call summary method to see the feature importance tho, it treats each encoded categorical feature as a feature. My question is that …

Total answers: 1

SVR ValueError: x and y must be the same size

SVR ValueError: x and y must be the same size Question: I’m trying to perform a test utilizing Support Vector Regression model. I inputted the data and performed the feature scaling of my dataset, however when I tried to run it to produce a graph it gives me the error "x and y isn’t the …

Total answers: 1