df_negative = negative_numerical.join(negative_cluster_labels) df_negative = df_negative.join(negative_target) complete_df = pd.concat([df_positive, df_negative]) complete_df = complete_df.reset_index(drop=True) # shuffle the data complete_df = complete_df.sample(frac=1).reset_index(drop=True) train_x = complete_df[numerical] train_y = Util.encode(complete_df['Cluster Label']) true_labels = complete_df['CreditStatus'] # dividing the dataset into training and test sets x_train, y_train, x_test, y_test, test_true_labels = Util.split_data( 0.8, train_x, train_y, true_labels) n_hidden_1 = 8 n_input = train_x.shape[1] n_classes = train_y.shape[1] weights = { 'h1': tf.Variable(tf.random_normal([n_input, n_hidden_1])), 'out': tf.Variable(tf.random_normal([n_hidden_1, n_classes])) } biases = { 'b1': tf.Variable(tf.random_normal([n_hidden_1])), 'out': tf.Variable(tf.random_normal([n_classes])) }
import numpy as np import sys sys.path.append("..") import utility.Util as Util credit_data = Util.open_file("../data/credit_data.csv") # create lists of types of features numerical = ["Duration", 'InstallmentRatePecnt', 'PresentResidenceTime', 'Age'] target = ['CreditStatus'] credit_data = credit_data.sample(frac=1).reset_index(drop=True) train_x, train_y = Util.pre_process_data(credit_data, numerical, target) # dividing the dataset into training and test sets x_train, y_train, x_test, y_test = Util.split_data(0.8, train_x, train_y) n_hidden_1 = 8 n_input = train_x.shape[1] n_classes = train_y.shape[1] weights = { 'h1': tf.Variable(tf.random_normal([n_input, n_hidden_1])), 'out': tf.Variable(tf.random_normal([n_hidden_1, n_classes])) } biases = { 'b1': tf.Variable(tf.random_normal([n_hidden_1])), 'out': tf.Variable(tf.random_normal([n_classes])) }