def open_and_display_data(self): data, label = dh.open_data() self.data.append(data, label) num_new_lines_to_add = data.shape[1] for i in range(1, num_new_lines_to_add + 1): if self.display_type == 'decimated': self.data_area.plot(self.data.decimated_data[-i], data.keys()[-i] + " " + label, color=COLORS[self.color_index]) elif self.display_type == 'heavy': self.data_area.plot(self.data.heavy_decimate_data[-i], data.keys()[-i] + " " + label, color=COLORS[self.color_index]) self.make_data_summary_frame(self.data, -i, data.keys()[-i] + " " + label) self.color_index = (self.color_index + 1) % 9
import data_handler as data from MLP import MLP def read_file(): iris = load_iris() return iris.data, iris.target batch_size = 2 num_epochs = 1000 number_final_att = 13 if __name__ == '__main__': ############################################## 2d inputs, labels = data.open_data('wine.arff', 3) inputs = np.array(inputs) labels = np.array(labels) pca = Pca() data = preprocessing.scale(inputs) pcaAdapt = PcaAdapt(13) pcaAdapt.train(data) result = np.matrix.transpose(pcaAdapt.pca_result(data)).reshape( len(data), number_final_att) mlp = MLP(3) points = result
import numpy as np from TCN import TCN import data_handler as data import os if __name__ == '__main__': num_epochs = 1000 n_classes = 20 batch_size = 20 num_features = 19 timesteps = 150 max_len = 150 lean_rate = 0.001 os.environ['CUDA_VISIBLE_DEVICES'] = str(1) inputs, labels = data.open_data(max_len=max_len) inputs, labels = np.array(inputs), np.array(labels) model = TCN(n_classes) inputs = np.reshape(inputs, (-1, timesteps, num_features)) shape = inputs.shape[1:] model.create_tcn(shape) model.compile(lean_rate) model.fit(inputs, labels, num_epochs, batch_size)
from Mlp import Mlp from Rbf import Rbf import data_handler as data import numpy as np if __name__ == '__main__': num_classes = 3 num_features = 7 num_layers = 3 layer_size = 128 num_epochs = 4000 learn_rate = 0.01 batch_size = 21 momentum = 0.8 folds = 10 inputs, labels = data.open_data('seeds_dataset.txt', num_classes) inputs = np.concatenate((inputs, inputs)) labels = np.concatenate((labels, labels)) accuracy = {} train_folds = (folds - 1) / folds test_folds = 1 / folds # cross-fold-validation for fold in range(folds): step = fold * int(test_folds * len(inputs) / 2) train_set_len_step = int(train_folds * len(inputs) / 2) + step test_set_len = int(test_folds * len(inputs) / 2) train_inputs = inputs[step:train_set_len_step] train_labels = labels[step:train_set_len_step]