首页 > 解决方案 > 使用时间序列分析的 KMeans 聚类

问题描述

这是我的代码:

distance = getDistanceByPoint(hr_tm2sif_df, kmeans[1])

这是由此产生的错误:

   Error:
   TypeError                                 Traceback (most recent call last)
   <ipython-input-77-79f84ace211e> in <module>()
      2 outliers_fraction = 0.15
      3 # get the distance between each point and its nearest centroid. The biggest distances are 
   considered as anomaly
   ----> 4 distance = getDistanceByPoint(hr_tm2sif_df, kmeans[1])
      5 # number of observations that equate to the 13% of the entire data set
      6 number_of_outliers = int(outliers_fraction*len(distance))

   TypeError: 'KMeans' object is not subscriptable

标签: pythontime-seriesdata-sciencecluster-computing

解决方案


推荐阅读