关于很多博客中的使用tsfresh提取时间序列特征,运行例子的时候报错:Can only compute partial correlation for lugs up to 50% of the sample size.
解决方法:
1. 网上博客例子是这样的:
import tsfresh
from tsfresh.examples.robot_execution_failures import download_robot_execution_failures, load_robot_execution_failures
download_robot_execution_failures()
timeseries, y = load_robot_execution_failures()
from tsfresh import extract_features
extraced_features = extract_features(timeseries, column_id='id', column_sort='time')
extraced_features.head()
替换成这样:
import tsfresh
from tsfresh.examples.robot_execution_failures import download_robot_execution_failures, load_robot_execution_failures
from tsfresh import extract_features
robot_execution_failures.download_robot_execution_failures()
df, y = robot_execution_failures.load_robot_execution_failures()
df.head()
extraction_settings = ComprehensiveFCParameters()
X = extract_features(df, column_id='id', column_sort='time',
default_fc_parameters=extraction_settings,
# we impute = remove all NaN features automatically
impute_function=impute)
X.head()
2. 如果还有错误,先重启你的notebook然后再试试。
3. 如果还有错误,那么首先重新安装你的pandas和numpy,然后重启你的notebook。
4.如果还有错误,手动删掉你安装的tsfresh包,重新安装tsfresh,然后重启你的notebook测试。
经过上面的步骤后,经过我的亲测,可以解决各种报错问题。最后如果成功会出现类似下图效果:
有问题可加qq群Python数据分析&机器学习636866908或者群R语言&大数据分析456726635与我进行沟通讨论。