时间序列模型:ARIMA时间序列模型、LSTM时序预测

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 =
  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

loong_XL

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值