python - 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()
解决方案
您是否尝试过MinimalFCParameters
它是否有效?有了这些,它应该在几秒钟内完成。
一个问题可能是,您需要将代码包装在 . 中if __name__ == "__main__"
,否则多处理库会出现问题。
如果这没有帮助,您可以使用我在此处描述的任何技术来并行化tsfresh
计算。
tsfresh
在您的另一台机器上安装的问题与tsfresh
- 错误消息显示您在通话时没有互联网连接无关pip install
。
推荐阅读
- python - 如何从 Raspberry Pi UART 解码字节
- c++ - Json http 响应,if else 语句
- xslt - XLT 1.0 将节点与循环进行比较
- javascript - 在 Javascript 中将变量指定为数组目标(可变性?)
- javascript - Vanilla Javascript中鼠标悬停的循环功能
- android - 如何从 *.txt 文件中获取数据到 Iterable
Flutter 中的对象 - java - ShiroFilter invalidRequest HTTP 400 错误
- python - subprocess + grep 用于反斜杠终止的字符串
- php - PHP Mysqli 使用密码()函数准备语句
- c# - Linq to SQL,其中两列必须从列表中匹配