我对model.predict(X)
行的实际预测有些困惑。我用Google搜索找不到任何东西。
import statsmodels.api as sm
# Step 1) Load data into dataframe
df = pd.read_csv('my_data.csv')
# Step 2) Separate dependent and independent variables
X = df['independent_variable']
y = df["dependent_variable"]
# Step 3) using OLS -fit a linear regression
model = sm.OLS(y, X).fit()
predictions = model.predict(X) # make predictions
predictions
我不确定predictions
显示什么?它是在预测下一个x行的数量吗?我不只是传入我的自变量吗?