[{'role': 'system', 'content': "You are an expert in machine learning and your task is to classify code snippets into one of the following categories: ['helper_functions', 'load_data', 'data_exploration', 'data_preprocessing', 'evaluation', 'modelling', 'prediction', 'result_visualization', 'save_results', 'comment_only']."}, {'role': 'user', 'content': 'Identify the single most appropriate category to which the provided code belongs. Provide your response as a single category label without any additional information, commentary, or personal opinions.\\nPython Code:import numpy as np\nimport matplotlib.pyplot as plt\nclass NeuralNetwork():\ndef __init__(self, inputLayerSize, hiddenLayerSize, outputLayerSize):\nself.inputLayerSize = inputLayerSize\nself.hiddenLayerSize = hiddenLayerSize\nself.outputLayerSize = outputLayerSize\nself.Wh = np.random.randn(inputLayerSize, hiddenLayerSize)/np.sqrt(inputLayerSize)\nself.Wo = np.random.randn(hiddenLayerSize, outputLayerSize)/np.sqrt(hiddenLayerSize)\nself.Bh = np.zeros((1, hiddenLayerSize))\nself.Bo = np.zeros((1, outputLayerSize))\nself.minNorm = 0\nself.maxNorm = 1\nself.Zh = None\nself.Zo = None\nself.Ah = None\nself.Ao = None\ndef normalize(self, X, newMin, newMax):\ncurMin = np.amin(X, axis=0)\ncurMax = np.amax(X, axis=0)\ncurRange = (curMax - curMin)\nnewRange = (newMax - newMin)\nreturn (((X - curMin) * newRange) / curRange) + newMin\ndef denormalize(self, normalized, oldMin, oldMax):\nreturn self.normalize(normalized, oldMin, oldMax)\ndef sigmoid(self, z):\nreturn 1/(1+np.exp(-z))\ndef sigmoidGradient(self,z):\nreturn self.sigmoid(z)*(1-self.sigmoid(z))\ndef cost(self, X, y):\noutput = self.feed_forward(X)\ncost = np.sum((output-y)**2) / 2.0\nreturn cost\ndef costGradient(self, output, y):\nreturn output - y\ndef dCdW(self, layer_input, layer_error):\nreturn np.dot(layer_input.T, layer_error)\ndef dCdB(self, curLayerError):\n\'\'\'\nCurLayerError has one row for each observation in our training set.\nThis is fine for dCdW because the matrix multiplication takes\ncare of transforming the output into dimensions that\nequal our weight dimensions (so we can subtract).\nHowever bias isn\'t multiplied by anything so we\'re stuck with\nthe dimensions of the output error. To fix this take the sum of\nall the output errors across observations (we could also take the average\nbut our learning rate will handle scaling this value appropriately).\nThe operation below sums all the values in a matrix on the row axis (0).\nIt\'s essentially like summing all the rows into a single row. The column\ndimensions remain unchanged.\n\'\'\'\nreturn np.sum(curLayerError, axis=0, keepdims=True)\ndef feed_forward(self, X):\nself.Zh = np.dot(X, self.Wh) + self.Bh\nself.Ah = self.sigmoid(self.Zh)\nself.Zo = np.dot(self.Ah, self.Wo) + self.Bo\nself.Ao = self.sigmoid(self.Zo) #network output\nreturn self.Ao\ndef backprop(self, X, output, y):\nerr_output = self.costGradient(output, y) * self.sigmoidGradient(self.Zo)\nerr_hidden = np.dot(err_output, self.Wo.T) * self.sigmoidGradient(self.Zh)\ndCdWh = self.dCdW(X, err_hidden)\ndCdWo = self.dCdW(self.Ah, err_output)\ndCdBh = self.dCdB(err_hidden)\ndCdBo = self.dCdB(err_output)\nreturn dCdWh, dCdWo, dCdBh, dCdBo\ndef update_weights(self, X, y, lr):\noutput = self.feed_forward(X)\ndCdWh, dCdWo, dCdBh, dCdBo = self.backprop(X, output, y)\nself.Wh -= lr * dCdWh\nself.Wo -= lr * dCdWo\nself.Bh -= lr * dCdBh\nself.Bo -= lr * dCdBo\ncost = self.cost(X, y)\nreturn cost\ndef train(self, X, y, epochs, lr, log_interval):\nX = self.normalize(X, self.minNorm, self.maxNorm)\ny = self.normalize(y, self.minNorm, self.maxNorm)\ncost_history = []\nfor epoch in range(1,epochs+1):\nself.log("Epoch %d ---------------" % epoch, epoch, log_interval)\ncost = self.update_weights(X, y, lr)\ncost_history.append(cost)\nmsg = "Cost:" + str(round(cost,5)) + "\\n"\nself.log(msg, epoch, log_interval)\nreturn cost_history\ndef predict(self, X, y_min, y_max):\nnormalized_input = self.normalize(X, self.minNorm, self.maxNorm)\noutput = self.feed_forward(normalized_input)\ndenormalized_output = self.denormalize(output, y_min, y_max)\nreturn denormalized_output\ndef log(self, msg, epoch, log_interval):\nif epoch % log_interval == 0:\nprint(msg)'}, {'role': 'assistant', 'content': 'modelling'}]