def main(): # parameters nsamples = 2325 ndim = 10 #encoding_dim = 200 batch_size = 2325 epochs = 8000 # generate dummy data x_train = data_gather.ggg() # model autoencoder, encoder, encoder1 = create_model(ndim) # train model autoencoder = train_model(autoencoder, x_train, batch_size, epochs) # encoded signal x_test = data_gather4.ggg() encodedsig = encoder1.predict(x_train) encodedsig1 = encoder1.predict(x_test) #encodedsig = autoencoder.predict(x_train) #encodedsig1=x_train return (encodedsig, encodedsig1)
from sklearn.model_selection import KFold import numpy as np import matplotlib.pyplot as plt from sklearn.svm import NuSVC import data_gather import data_gather4 import xlwt import random mnist1 = data_gather.ggg() mnist2 = data_gather4.ggg() XX = np.concatenate((mnist1, mnist2)) np.random.shuffle(XX) #input_var = input("Number of data fold:") size = len(XX) y = np.zeros(shape=[size, 1]) for index in range(0, size): if (4321 - index) >= 0: y[index, 0] = 0 else: y[index, 0] = 1 kf = KFold(n_splits=20) kf.get_n_splits(XX) print(kf) KFold(n_splits=20, random_state=None, shuffle=False) ii = 0 dum = np.zeros(len(XX)) for train_index, test_index in kf.split(XX): #print("TRAIN:", train_index, "TEST:", test_index) X_train, X_test = XX[train_index], XX[test_index] y_train, y_test = y[train_index], y[test_index]
from __future__ import division, print_function, absolute_import import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from random import randint import data_gather1 import data_gather import data_gather2 mnist2 = data_gather2.ggg() mnist1 = data_gather1.ggg() mnist = data_gather.ggg() # Parameters learning_rate = 0.0005 training_epochs = 5 batch_size = 1 display_step = 1 examples_to_show = 10 total_data_row = 2325 total_batch = np.floor(total_data_row / batch_size) # Network Parameters n_hidden_1 = 10 # 1st layer num features n_hidden_2 = 10 # 2nd layer num features n_input = 5 # MNIST data input (img shape: 28*28) # tf Graph input (only pictures) X = tf.placeholder("float", [None, n_input]) weights = {