mcpField
A
aeon

aeon

github.com/hkphysicsデータ・データベース045 回インストール19 週間前に更新
リポジトリ

aeon について

Aeon は、scikit-learn 互換 API を備えた Python の時系列機械学習ツールキットです。研究者や開発者向けに、分類・回帰・クラスタリングなどのアルゴリズムと、変換や距離計算、ベンチマーク機能を提供します。

主な機能

  1. 01時系列の分類と回帰
  2. 02クラスタリング、予測、異常検知
  3. 03セグメンテーションと類似検索
  4. 04特徴抽出と変換
  5. 05時系列距離メトリクス
  6. 06データセット読み込みとベンチマーク

活用シーン

  1. 01センサーデータの時系列分類
  2. 02時系列の将来値予測
  3. 03異常や変化点の検出
  4. 04特徴量抽出と時系列モデルの比較

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/hkphysics/scientific-agent-skills --skill aeon

インストール後、Claude Code で/aeonを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
anomaly_detection.md
classification.md
clustering.md
datasets_benchmarking.md
distances.md
forecasting.md
networks.md
regression.md
segmentation.md
similarity_search.md
transformations.md

詳細

Aeon 時系列機械学習

概要

Aeon は、時系列機械学習向けの scikit-learn 互換 Python ツールキットです(aeon-toolkit.org)。分類、回帰、クラスタリング、予測、異常検知、セグメンテーション、類似性検索、距離、変換、ベンチマーク、可視化にわたるアルゴリズムを、一貫した推定器 API で提供します。

バージョンに関する注意: サンプルは aeon 1.x を対象としています(安定版ドキュメント:v1.4.0、2026年3月)。v1.0 のリリースでは予測と変換が再構成されており、インポートパスは aeon 0.x/sktime 時代のコードとは異なります。

このスキルを使う場面

以下の場合にこのスキルを使用します。

  • 時系列データを分類したり、時系列データから予測したりする
  • 時系列の系列内で異常や変化点を検出する
  • 類似した時系列パターンをクラスタリングする
  • 将来の値を予測する
  • 繰り返し現れるパターン(モチーフ)や通常とは異なる部分系列(ディスコード)を見つける
  • 専用の距離指標を使って時系列を比較する
  • 時系列データから特徴量を抽出する

インストール

Python 3.10 以上が必要です(3.11 以上を推奨)。再現性のため、1.x リリースを固定してください。

uv pip install "aeon>=1.4,<2"

ディープラーニング予測器/分類器やその他のオプションの推定器を使用する場合:

uv pip install "aeon[all_extras]>=1.4,<2"

zsh では extras を引用符で囲んでください:uv pip install "aeon[all_extras]>=1.4,<2"。

実験的モジュール

アップストリームでは forecasting、anomaly_detection、segmentation、similarity_search、visualisation を実験的な機能として扱っており、マイナーリリース間でインターフェースが変更される可能性があります。これらのタスクが必要でない限り、本番パイプラインでは安定したモジュール(classification、regression、clustering、distances、transformations)を優先してください。

主な機能

1. 時系列分類

時系列を定義済みのクラスに分類します。アルゴリズムの一覧については references/classification.md を参照してください。

クイックスタート:

from aeon.classification.convolution_based import RocketClassifier
from aeon.datasets import load_classification

# Load data
X_train, y_train = load_classification("GunPoint", split="train")
X_test, y_test = load_classification("GunPoint", split="test")

# Train classifier
clf = RocketClassifier(n_kernels=10000)
clf.fit(X_train, y_train)
accuracy = clf.score(X_test, y_test)

アルゴリズムの選択:

  • 速度+性能:MiniRocketClassifier、Arsenal
  • 最高の精度:HIVECOTEV2、InceptionTimeClassifier
  • 解釈可能性:ShapeletTransformClassifier、Catch22Classifier
  • 小規模データセット:DTW 距離を使う KNeighborsTimeSeriesClassifier
2. 時系列回帰

時系列から連続値を予測します。アルゴリズムについては references/regression.md を参照してください。

クイックスタート:

from aeon.regression.convolution_based import RocketRegressor
from aeon.datasets import load_regression

X_train, y_train = load_regression("Covid3Month", split="train")
X_test, y_test = load_regression("Covid3Month", split="test")

reg = RocketRegressor()
reg.fit(X_train, y_train)
predictions = reg.predict(X_test)
3. 時系列クラスタリング

ラベルを使わずに、類似した時系列をグループ化します。手法については references/clustering.md を参照してください。

クイックスタート:

from aeon.clustering import TimeSeriesKMeans

clusterer = TimeSeriesKMeans(
    n_clusters=3,
    distance="dtw",
    averaging_method="ba"
)
labels = clusterer.fit_predict(X_train)
centers = clusterer.cluster_centers_
4. 予測

時系列の将来の値を予測します(aeon 1.x では実験的モジュールです)。予測器については references/forecasting.md を参照してください。

クイックスタート:

import numpy as np
from aeon.forecasting import NaiveForecaster
from aeon.forecasting.stats import ARIMA

y_train = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0])

# Set horizon in the constructor; predict passes the series to forecast from
naive = NaiveForecaster(strategy="last", horizon=5)
naive.fit(y_train)
y_pred = naive.predict(y_train)

# ARIMA uses p/d/q (not order=); multi-step via iterative_forecast
arima = ARIMA(p=1, d=1, q=1)
arima.fit(y_train)
y_pred = arima.iterative_forecast(y_train, prediction_horizon=5)
5. 異常検知

通常とは異なるパターンや外れ値を特定します。検出器については references/anomaly_detection.md を参照してください。

クイックスタート:

from aeon.anomaly_detection import STOMP

detector = STOMP(window_size=50)
anomaly_scores = detector.fit_predict(y)

# Higher scores indicate anomalies
threshold = np.percentile(anomaly_scores, 95)
anomalies = anomaly_scores > threshold
6. セグメンテーション

変化点を使って時系列を領域に分割します。references/segmentation.md を参照してください。

クイックスタート:

from aeon.segmentation import ClaSPSegmenter

segmenter = ClaSPSegmenter()
change_points = segmenter.fit_predict(y)
7. 類似性検索

時系列内または時系列間で類似したパターンを見つけます。references/similarity_search.md を参照してください。

クイックスタート:

from aeon.similarity_search import StompMotif

# Find recurring patterns
motif_finder = StompMotif(window_size=50, k=3)
motifs = motif_finder.fit_predict(y)

特徴量抽出と変換

特徴量エンジニアリングのために時系列を変換します。references/transformations.md を参照してください。

ROCKET 特徴量:

from aeon.transformations.collection.convolution_based import RocketTransformer

rocket = RocketTransformer()
X_features = rocket.fit_transform(X_train)

# Use features with any sklearn classifier
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier()
clf.fit(X_features, y_train)

統計的特徴量:

from aeon.transformations.collection.feature_based import Catch22

catch22 = Catch22()
X_features = catch22.fit_transform(X_train)

前処理:

from aeon.transformations.collection import MinMaxScaler, Normalizer

scaler = Normalizer()  # Z-normalization
X_normalized = scaler.fit_transform(X_train)

距離指標

時系列専用の距離尺度です。全項目については references/distances.md を参照してください。

使用方法:

from aeon.distances import dtw_distance, dtw_pairwise_distance

# Single distance
distance = dtw_distance(x, y, window=0.1)

# Pairwise distances
distance_matrix = dtw_pairwise_distance(X_train)

# Use with classifiers
from aeon.classification.distance_based import KNeighborsTimeSeriesClassifier

clf = KNeighborsTimeSeriesClassifier(
    n_neighbors=5,
    distance="dtw",
    distance_params={"window": 0.2}
)

利用可能な距離:

  • 弾性距離:DTW、DDTW、WDTW、ERP、EDR、LCSS、TWE、MSM
  • ロックステップ距離:ユークリッド距離、マンハッタン距離、ミンコフスキー距離
  • 形状ベース:Shape DTW、SBD

ディープラーニングネットワーク

時系列向けのニューラルアーキテクチャです。references/networks.md を参照してください。

アーキテクチャ:

  • 畳み込み:FCNClassifier、ResNetClassifier、InceptionTimeClassifier
  • 再帰型:RecurrentNetwork、TCNNetwork
  • オートエンコーダー:AEFCNClusterer、AEResNetClusterer

使用方法:

from aeon.classification.deep_learning import InceptionTimeClassifier

clf = InceptionTimeClassifier(n_epochs=100, batch_size=32)
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

データセットとベンチマーク

標準的なベンチマークを読み込み、パフォーマンスを評価します。references/datasets_benchmarking.md を参照してください。

データセットの読み込み:

from aeon.datasets import load_classification, load_gunpoint, load_regression

# Classification (generic loader or dataset-specific helper)
X_train, y_train = load_classification("GunPoint", split="train")
X_train, y_train = load_gunpoint(split="train")  # same UCR dataset

# Regression
X_train, y_train = load_regression("Covid3Month", split="train")

ベンチマーク:

from aeon.benchmarking import get_estimator_results

# Compare with published results
published = get_estimator_results("ROCKET", "GunPoint")

一般的なワークフロー

分類パイプライン
from aeon.transformations.collection import Normalizer
from aeon.classification.convolution_based import RocketClassifier
from sklearn.pipeline import Pipeline

pipeline = Pipeline([
    ('normalize', Normalizer()),
    ('classify', RocketClassifier())
])

pipeline.fit(X_train, y_train)
accuracy = pipeline.score(X_test, y_test)
特徴量抽出 + 従来型機械学習
from aeon.transformations.collection import RocketTransformer
from sklearn.ensemble import GradientBoostingClassifier

# Extract features
rocket = RocketTransformer()
X_train_features = rocket.fit_transform(X_train)
X_test_features = rocket.transform(X_test)

# Train traditional ML
clf = GradientBoostingClassifier()
clf.fit(X_train_features, y_train)
predictions = clf.predict(X_test_features)
可視化による異常検知
from aeon.anomaly_detection import STOMP
import matplotlib.pyplot as plt

detector = STOMP(window_size=50)
scores = detector.fit_predict(y)

plt.figure(figsize=(15, 5))
plt.subplot(2, 1, 1)
plt.plot(y, label='Time Series')
plt.subplot(2, 1, 2)
plt.plot(scores, label='Anomaly Scores', color='red')
plt.axhline(np.percentile(scores, 95), color='k', linestyle='--')
plt.show()

ベストプラクティス

データの準備
  1. 正規化:ほとんどのアルゴリズムは z 正規化の効果が得られます

    from aeon.transformations.collection import Normalizer
    normalizer = Normalizer()
    X_train = normalizer.fit_transform(X_train)
    X_test = normalizer.transform(X_test)
    
  2. 欠損値の処理:分析の前に補完します

    from aeon.transformations.collection import SimpleImputer
    imputer = SimpleImputer(strategy='mean')
    X_train = imputer.fit_transform(X_train)
    
  3. データ形式の確認:コレクションは (n_cases, n_channels, n_timepoints)、単一の系列は (n_channels, n_timepoints) を使用します(データ形式を参照)

モデルの選択
  1. シンプルな方法から始める:ディープラーニングの前に、ROCKET の派生手法から始めます
  2. 検証を行う:ハイパーパラメーターの調整用に、訓練データを分割します
  3. ベースラインと比較する:シンプルな手法(ユークリッド距離による 1-NN、Naive)と比較します
  4. リソースを考慮する:速度を重視するなら ROCKET、GPU が利用可能ならディープラーニングを使用します
アルゴリズム選択ガイド

迅速なプロトタイピング向け:

  • 分類:MiniRocketClassifier
  • 回帰:MiniRocketRegressor
  • クラスタリング:ユークリッド距離を使う TimeSeriesKMeans

最高精度を求める場合:

  • 分類:HIVECOTEV2、InceptionTimeClassifier
  • 回帰:InceptionTimeRegressor
  • 予測:AutoARIMA、AutoETS、TCNForecaster(ディープラーニングには [all_extras] が必要です)

解釈可能性を重視する場合:

  • 分類:ShapeletTransformClassifier、Catch22Classifier
  • 特徴量:Catch22、TSFresh

小規模なデータセット向け:

  • 距離ベース:DTW を使う KNeighborsTimeSeriesClassifier
  • 避けるもの:ディープラーニング(大量のデータが必要です)

リファレンスドキュメント

詳細情報は references/ にあります。

  • classification.md - すべての分類アルゴリズム
  • regression.md - 回帰手法
  • clustering.md - クラスタリングアルゴリズム
  • forecasting.md - 予測手法
  • anomaly_detection.md - 異常検知手法
  • segmentation.md - セグメンテーションアルゴリズム
  • similarity_search.md - パターンマッチングとモチーフの検出
  • transformations.md - 特徴量抽出と前処理
  • distances.md - 時系列の距離指標
  • networks.md - ディープラーニングアーキテクチャ
  • datasets_benchmarking.md - データ読み込みと評価ツール

その他のリソース

コメント