版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/qq_33039859/article/details/85072277
- 将
[0 1 2 3 4 5 6 7 8 9]
标签转换成OneHot
编码
from sklearn.preprocessing import OneHotEncoder
ohe = OneHotEncoder()
ohe.fit(np.arange(10).reshape(-1,1))
labels = ohe.transform(labels).astype('uint8').toarray()
- 将numpy数组保存为mat文件
- Step1:创建一个字典
- Step2:添加字典变量以及内容
- Step3:调用函数另存为
.mat
文件
adict = {}
# Save as .mat file for Matlab Execution
adict['data_'+source+'_'+process] = data
adict['labels_'+process] = labels
sio.savemat('rms_seq_pic/cwru_'+process+ '.mat',adict)