Ejemplo n.º 1
0
    def __init__(self):
        c = Convert()
        x_train, y_train, x_test, y_test = c.getDTOneHotData()
        self.x_train = np.array(x_train)
        self.x_test = np.array(x_test)
        self.y_train = pd.get_dummies(np.array(y_train), prefix="y")
        self.label_value = y_test  #list format of label
        self.y_test = pd.get_dummies(np.array(y_test), prefix="y")
        '''
        To classify images using a recurrent neural network, we consider every image
        row as a sequence of pixels. Because MNIST image shape is 28*28px, we will then
        handle 28 sequences of 28 steps for every sample.
        '''

        # Parameters
        self.learning_rate = 0.01
        self.training_iters = 300
        self.batch_size = len(self.x_train)  # forest-net must total data
        self.display_step = 10

        # Network Parameters
        self.n_input = 418  # feature number
        self.n_steps = 4  # timesteps
        self.n_hidden = 128  # hidden layer num of features
        self.n_classes = 2  # MNIST total classes (0-9 digits)
        self.forget_bias = 1.0  # forget bias value
 def __init__(self):
     c = Convert()
     self.x_train, self.y_train, self.x_test, self.y_test = c.get_libsvm_gbdt_data(
         "common")
     self.y_input = self.y_test
     self.y_train = pd.get_dummies(np.array(self.y_train), prefix="y")
     self.y_test = pd.get_dummies(np.array(self.y_test), prefix="y")
Ejemplo n.º 3
0
 def get_data(self, tag):
     c = Convert()
     if tag == "normal":
         (self.x_train, self.y_train, self.x_test,
          self.y_test) = c.getDTData()
     elif tag == "oneHot":
         (self.x_train, self.y_train, self.x_test,
          self.y_test) = c.getDTOneHotData()
Ejemplo n.º 4
0
'''

from __future__ import print_function

import tensorflow as tf
from tensorflow.python.ops import rnn, rnn_cell
import numpy as np
import pandas as pd
import sys
sys.path.append("../script")
from convert_input import Convert
from validation import Validation
# Import MNIST data
#from tensorflow.examples.tutorials.mnist import input_data
#mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
c = Convert()
x_train, y_train, x_test, y_test = c.getDTOneHotData()
x_train = np.array(x_train)
x_test = np.array(x_test)
y_train = pd.get_dummies(np.array(y_train))
input_value = y_test
y_test = pd.get_dummies(np.array(y_test))
'''
To classify images using a recurrent neural network, we consider every image
row as a sequence of pixels. Because MNIST image shape is 28*28px, we will then
handle 28 sequences of 28 steps for every sample.
'''

# Parameters
learning_rate = 0.01
training_iters = 300
Ejemplo n.º 5
0
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''

from __future__ import print_function

import tensorflow as tf
from tensorflow.python.ops import rnn, rnn_cell
import pandas as pd
import numpy as np
import sys
sys.path.append("../script")
from convert_input import Convert
from validation import Validation


c = Convert()
x_train, y_train, x_test, y_test = c.get_libsvm_gbdt_data("recent")
#x_train = np.array(x_train)
#x_test = np.array(x_test)
print (type(x_train[0]), x_test[0].shape)
#exit()
def conversion(temp):
    result = list()
    for value in temp:
        result.append(value.todense())
    return np.array(result)
x_train = conversion(x_train)
x_test = conversion(x_test)

y_input = y_test
y_train = pd.get_dummies(np.array(y_train),prefix="y")