Icon

20200616r Pikairos Keras metrics export

# variable name of the input network: input_network (here a Dummy model)# variable name of the input table: input_table (here a Dummy input table)# variable name of the output table: output_table (here a data set)# https://en.wikipedia.org/wiki/Pandasfrom pandas import DataFramefrom keras.models import Sequentialfrom keras.layers.core import Dense, Activationfrom keras.optimizers import SGDfrom keras.utils import np_utils# https://en.wikipedia.org/wiki/NumPyimport numpy as np# X_test = input_table['X_test']number_of_rows = X_test.shape[0]print( number_of_rows)X_test = np.asarray( X_test)X_test = np.concatenate( X_test, axis=0 )print( X_test.shape)X_test = X_test.reshape( number_of_rows, 784) print( "Shape of Input Data: ", X_test.shape)# Convert Class to Categorical ArrayNB_CLASSES = 10Y_test = np_utils.to_categorical( input_table['class'], NB_CLASSES)OPTIMIZER = SGD() # SGD optimizerinput_network.compile(loss='categorical_crossentropy', optimizer=OPTIMIZER, metrics=['accuracy'])input_network.summary()VERBOSE = 1score = input_network.evaluate(X_test, Y_test, verbose=VERBOSE)print("\nTest score:", score[0])print('Test accuracy:', score[1])flow_variables['Test score'] = score[0]flow_variables['Test Accuracy'] = score[1]##############Prediction = input_network.predict(X_test, verbose=VERBOSE)print( "Shape of Prediction: ", Prediction.shape) output_table = DataFrame(Prediction) Neural NetworkInput + Dense + SoftMaximplemented usingKERASExtract MetricsMNIST Imagescan be extracted fromKERAS librarydirectlyCollect all input columnsinto a single columnof type listDL PythonNetwork Creator DL Python NetworkExecutor Extract MNISTdata from KERAS Create CollectionColumn # variable name of the input network: input_network (here a Dummy model)# variable name of the input table: input_table (here a Dummy input table)# variable name of the output table: output_table (here a data set)# https://en.wikipedia.org/wiki/Pandasfrom pandas import DataFramefrom keras.models import Sequentialfrom keras.layers.core import Dense, Activationfrom keras.optimizers import SGDfrom keras.utils import np_utils# https://en.wikipedia.org/wiki/NumPyimport numpy as np# X_test = input_table['X_test']number_of_rows = X_test.shape[0]print( number_of_rows)X_test = np.asarray( X_test)X_test = np.concatenate( X_test, axis=0 )print( X_test.shape)X_test = X_test.reshape( number_of_rows, 784) print( "Shape of Input Data: ", X_test.shape)# Convert Class to Categorical ArrayNB_CLASSES = 10Y_test = np_utils.to_categorical( input_table['class'], NB_CLASSES)OPTIMIZER = SGD() # SGD optimizerinput_network.compile(loss='categorical_crossentropy', optimizer=OPTIMIZER, metrics=['accuracy'])input_network.summary()VERBOSE = 1score = input_network.evaluate(X_test, Y_test, verbose=VERBOSE)print("\nTest score:", score[0])print('Test accuracy:', score[1])flow_variables['Test score'] = score[0]flow_variables['Test Accuracy'] = score[1]##############Prediction = input_network.predict(X_test, verbose=VERBOSE)print( "Shape of Prediction: ", Prediction.shape) output_table = DataFrame(Prediction) Neural NetworkInput + Dense + SoftMaximplemented usingKERASExtract MetricsMNIST Imagescan be extracted fromKERAS librarydirectlyCollect all input columnsinto a single columnof type listDL PythonNetwork Creator DL Python NetworkExecutor Extract MNISTdata from KERAS Create CollectionColumn

Nodes

Extensions

Links