Tsfresh花费的时间太长,计算机无法处理

时间:2019-09-25 14:01:20

标签: python feature-extraction

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

它永远不会停止并且保持处理状态,我尝试在安装了python 2.17.16的另一台笔记本电脑上运行相同的库,但是tsfresh库无法正常工作。

我该怎么办?

enter image description here

enter image description here

# 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()     

1 个答案:

答案 0 :(得分:0)

您是否尝试过MinimalFCParameters,如果它可以正常工作?有了这些,它应该在几秒钟内完成。

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

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

在另一台计算机上安装tsfresh的问题与tsfresh无关-错误消息表明您在呼叫pip install时没有互联网连接。