1、ARIMA时间序列模型拟合
参考:https://blog.csdn.net/m0_46262108/article/details/122806515
https://blog.csdn.net/tecdat/article/details/128752078
安装:pip install statsmodels
import pandas as pd
from statsmodels.tsa.arima.model import ARIMA
# 假设有手机在不同时间点的坐标数据
mobile_data = [(1, 2, 10), (2, 3, 15), (3, 5, 20), (4, 6, 25)]
# 每个点为 (x, y, t) 坐标,其中 x 和 y 为手机在某个时间点的坐标值,t 为时间点
# 将坐标数据转换为 pandas DataFrame 格式
df = pd.DataFrame(mobile_data, columns=['x', 'y', 't'])
# 将时间点 t 设置为索引
df.set_index('t', inplace=True)
# 创建时间序列模型 (ARIMA 模型)
model_x = ARIMA(df['x'], order=(1, 0, 0)) # 设置 ARIMA 模型的 p、d、q 参数
model_y = ARIMA(df['y'], order=(1, 0, 0))
# 拟合模型
model_fit_x = model_x.fit()
model_fit_y = model_y.fit()
# 预测当前时间点的坐标值
current_t = 30 # 假设当前时间点为 t=30
predicted_x = model_fit_x.predict(end=current_t)
predicted_y =