首页 > 解决方案 > tsfresh 耗时太长,电脑无法处理

问题描述

我正在尝试在 python 3.7.1 中使用带有测试文件的有效参数(24 行 x 366 列)使用 tsfresh 特征提取库

它永远不会停止并继续处理,我尝试在安装了 python 2.17.16 的不同笔记本电脑上运行相同的库,但 tsfresh 库不起作用。

我应该怎么办?

在此处输入图像描述

在此处输入图像描述

# Import Data from CSV file
#import csv
#with open('T7.csv') as T7:
#    reader = csv.reader(T7)
#    try: 
#        for row in reader:
#            print(row)
#    finally: 
#        T7.close()
from matplotlib import pyplot as plt
from matplotlib import style
import numpy as np
import pandas as pd

style.use('ggplot')


#from tsfresh import extract_features #as tsfreshobj
#from tsfresh import MinimalFeatureExtractionSettings
from tsfresh.feature_extraction import extract_features, EfficientFCParameters 
#X = extract_features(df, column_id='id', column_sort='time')
y=pd.read_csv ('1.csv')#, skiprows=1)

#y=np.loadtxt('T7_2.csv')#, 
             #unpack=True,
            # delimiter=',')
#y1=tsfreshobj.feature_extraction.extraction.generate_data_chunk_format(y)
#y2=tsfreshobj.feature_extraction.feature_calculators.absolute_sum_of_changes(y1)
#y1=extract_features(y, feature_extraction_settings=MinimalFeatureExtractionSettings)
print (y)

# from tsfresh.feature_extraction import MinimalFeatureExtractionSettings
y1=extract_features(y, column_id='time', default_fc_parameters=EfficientFCParameters())#, column_sort='time')
print (y)
print (y1)
plt.plot(y1)

print (y)
plt.title ('some numbers')
plt.ylabel('Y axis')
plt.xlabel ('X axis')


plt.show()     

标签: pythonfeature-extraction

解决方案


您是否尝试过MinimalFCParameters它是否有效?有了这些,它应该在几秒钟内完成。

一个问题可能是,您需要将代码包装在 . 中if __name__ == "__main__",否则多处理库会出现问题。

如果这没有帮助,您可以使用我在此处描述的任何技术来并行化tsfresh计算。

tsfresh在您的另一台机器上安装的问题与tsfresh- 错误消息显示您在通话时没有互联网连接无关pip install


推荐阅读