def main(argv=None): # mnist = input_data.read_data_sets("/tmp/data", one_hot=True) train_data = matfile_reader.dataset_reader( r'G:\04 实验数据\02 实验台实验数据\实验数据_20180119\bearing_dataset_2000.mat') # train_data = pd.read_excel("traindataset.xlsx") print("train dateset read over") # test_data = pd.read_excel("E:\\故障诊断实验数据\\实验数据_20171201\\原始数据_数据集\\test_dataset.xlsx") train_samples, train_labels, data_tag = data_preprocess(train_data) train(train_samples, train_labels, data_tag)
def main(argv=None): # test_data = pd.read_excel("testdataset.xlsx") test_data = matfile_reader.dataset_reader(r'G:\04 实验数据\02 实验台实验数据\实验数据_20180119\bearing_dataset_2000.mat', train=False) # test_data=test_data[0:10000,:] print("train dateset read over") # test_data = pd.read_excel("E:\\故障诊断实验数据\\实验数据_20171201\\原始数据_数据集\\test_dataset.xlsx") test_samples, test_labels, data_tag = AlexNet_1d_diagnosis_train.data_preprocess(test_data) evaluate(test_samples, test_labels, data_tag)
import scipy.io as scio import numpy as np from AlexNet_1d_diagnosis import matfile_reader #parameters noise_factor=0.5 #read data data_path='E:/bearing_dataset_1024.mat' train_dataset=matfile_reader.dataset_reader(data_path) test_dataset=matfile_reader.dataset_reader(data_path,train=False) train_data_sample=train_dataset[:,0:1024] train_data_label=train_dataset[:,-1] test_data_sample=test_dataset[:,0:1024] test_data_label=test_dataset[:,-1] #add noise to test datasamples and train datasamples train_noise=train_data_sample+noise_factor*np.random.randn(*train_data_sample.shape) test_noise=test_data_sample+noise_factor*np.random.randn(*test_data_sample.shape) datasample_train_noise=np.column_stack((train_noise,train_data_label)) datasample_test_noise=np.column_stack((test_noise,test_data_label)) #save processed data scio.savemat('E:/bearing_dataset_1024_with_noise.mat',{'traindata':datasample_train_noise,'testdata':datasample_test_noise})
import scipy.io as scio import pandas as pd from AlexNet_1d_diagnosis import matfile_reader import numpy as np train_data = matfile_reader.dataset_reader("E:\\bearing_dataset_2000.mat") test_data = matfile_reader.dataset_reader('E:\\bearing_dataset_2000.mat', train=False) np.savetxt('train_data.csv', train_data, delimiter=',') np.savetxt('test_data.csv', test_data, delimiter=',')