Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Pricing
Podcast Image

知能情報研究室ラジオ

【計算知能ラジオ】変化検知のコーディング

08 Sep 2023

Description

# 計算知能ラジオの原稿:変化検知とその手法   こんにちは、リスナーの皆さん!今日のテーマは「変化検知とその手法」です。このテーマはデータ分析、機械学習、時系列解析と幅広く関連しています。   ## 変化検知とは?   変化検知は、データのパターンが急激に変わった瞬間を特定する技術です。この変化はデータの異常や重要なイベントを指す場合が多く、早期に検出することで多くの問題を防ぐことができます。   ## 累積和による変化検知   累積和(Cumulative Sum, CUSUM)はシンプルながら効果的な変化検知手法です。基本的なアイデアは、データの平均からの偏差を累積していき、その累積和が一定の閾値を超えたら変化点とみなすというものです。   ### Pythonコード   ```python import numpy as np   def cusum_detection(data, threshold=50):     mean = np.mean(data)     S_t = 0     change_points = []       for i, x in enumerate(data):         S_t += x - mean         if abs(S_t) > threshold:             change_points.append(i)             S_t = 0       return change_points ```   ## 密度比による変化検知   密度比推定は、異なる2つのデータ分布の密度比を計算して、その比が急激に変化した場合に変化点であると判断します。   ### Pythonコード   ```python from sklearn.neighbors import KernelDensity import numpy as np   def density_ratio_detection(data, window_size=50, threshold=2):     change_points = []     for i in range(len(data) - window_size):         P_window = KernelDensity(kernel='gaussian').fit(data[i:i+window_size].reshape(-1, 1))         Q_window = KernelDensity(kernel='gaussian').fit(data[i+1:i+window_size+1].reshape(-1, 1))                 P_score = np.exp(P_window.score_samples(data[i:i+window_size].reshape(-1, 1))).mean()         Q_score = np.exp(Q_window.score_samples(data[i+1:i+window_size+1].reshape(-1, 1))).mean()           density_ratio = P_score / Q_score         if density_ratio > threshold or density_ratio < 1/threshold:             change_points.append(i + window_size)                 return change_points ```   このように、変化検知にはいくつかの手法がありますが、用途やデータの性質に応じて適切なものを選ぶ必要があります。以上、計算知能ラジオでした。次回もお楽しみに! 告知リンク: https://www.youtube.com/playlist?list=PLPiQ8tB0Q233SUXcAh_FkCzNS51aN48Ud https://youtu.be/gP7jjWApgHA https://www.kogakuin.ac.jp/admissions/event/oc.html https://wcci2024.org/

Audio
Featured in this Episode

No persons identified in this episode.

Transcription

This episode hasn't been transcribed yet

Help us prioritize this episode for transcription by upvoting it.

0 upvotes
🗳️ Sign in to Upvote

Popular episodes get transcribed faster

Comments

There are no comments yet.

Please log in to write the first comment.