百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pytorch-tsmixer

> 包管理
开源

一个可通过 pip 安装的 PyTorch 实现的 TSMixer,提供了一个易于使用且高效的时间序列预测解决方案。

196 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

一个可通过 pip 安装的 PyTorch 实现的 TSMixer,提供了一个易于使用且高效的时间序列预测解决方案。

TSMixer: Time Series Mixer for Forecasting

Overview

TSMixer is an unofficial PyTorch-based implementation of the TSMixer architecture as described TSMixer Paper. It leverages mixer layers for processing time series data, offering a robust approach for both standard and extended forecasting tasks.

Installation

You can install the package using pip:

bash
pip install pytorch-tsmixer

or after cloning the repository, you can install it directly from the source code:

bash
pip install .

Modules

  • tsmixer.py: Contains the TSMixer class, a model using mixer layers for time series forecasting.
  • tsmixer_ext.py: Implements the TSMixerExt class, an extended version of TSMixer that integrates additional inputs and contextual information.

Usage

TSMixer

python
from torchtsmixer import TSMixer
import torch

m = TSMixer(sequence_length=10, prediction_length=5, input_channels=2, output_channels=4)
x = torch.randn(3, 10, 2)
y = m(x)

TSMixerExt

python
from torchtsmixer import TSMixerExt
import torch

m = TSMixerExt(
    sequence_length=10,
    prediction_length=5,
    input_channels=2,
    extra_channels=3,
    hidden_channels=8,
    static_channels=4,
    output_channels=4
)

x_hist = torch.randn(3, 10, 2, requires_grad=True)
x_extra_hist = torch.randn(3, 10, 3, requires_grad=True)
x_extra_future = torch.randn(3, 5, 3, requires_grad=True)
x_static = torch.randn(3, 4, requires_grad=True)

y = m.forward(
    x_hist=x_hist,
    x_extra_hist=x_extra_hist,
    x_extra_future=x_extra_future,
    x_static=x_static
)

Example: Training Loop with TSMixer

Here's a basic example of how to use TSMixer in a simple training loop. This example assumes a regression task with a mean squared error loss and an Adam optimizer.

…

This example is quite basic and should be adapted to your specific dataset and task. For instance, you might want to add data loading with DataLoader, validation steps, and more sophisticated training logic.

Testing

Run tests using:

bash
python -m unittest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This implementation is based on the TSMixer model as described in TSMixer Paper.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonforecastingpiptime-seriestsmixer

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类包管理
定价开源

> 相关工具

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image