Python 時系列分析 1,000本ノック
– ノック50: 時系列クラスタリング –

Python 時系列分析 1,000本ノック– ノック50: 時系列クラスタリング –
次の Python コードの出力はどれでしょうか?

Python コード:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
from tslearn.clustering import TimeSeriesKMeans
import numpy as np
np.random.seed(72)
data = np.random.rand(30, 100)
model = TimeSeriesKMeans(
n_clusters=4,
metric="softdtw",
random_state=0).fit(data)
print(model.labels_)
from tslearn.clustering import TimeSeriesKMeans import numpy as np np.random.seed(72) data = np.random.rand(30, 100) model = TimeSeriesKMeans( n_clusters=4, metric="softdtw", random_state=0).fit(data) print(model.labels_)
from tslearn.clustering import TimeSeriesKMeans
import numpy as np

np.random.seed(72)
data = np.random.rand(30, 100)

model = TimeSeriesKMeans(
    n_clusters=4, 
    metric="softdtw", 
    random_state=0).fit(data)

print(model.labels_)

 

回答の選択肢:

(A) 各クラスタに属する時系列データの数
(B) 各時系列データのクラスタ番号
(C) 各クラスタの中心座標
(D) 各時系列データのクラスタ中心までの距離