Posts

Showing posts from May, 2024

A Single Layer Perceptron for Regression: Part 3

   New Functions created: normalize :  This function normalizes inputs using either min-max or Z-score normalization techniques.  Importance of Normalization: Preventing than others just because their range of values are greater in comparison. Parameters :  (1) input (numpy array (m,n)): input/predictor values that have to be normalized.                       (2) outputs(numpy array (m,1)) : Output values that have to be normalized.                       (3) type_of_normlaization (string): can be min_max or z_score.                       denormalize:  This function converts the normalized values back to their original form. Parameters:   (1) outputs(numpy array (m,1)) : Predicted outputs that are to be brought back to                                                                                their original form.                        (2) term1(float):Either the min value or the mean of the original outputs.                      (3) term2(float): Either the max value or the standar

A Single Layer Perceptron for Regression: Part 2

  Functions Edited: initialize_weights: Earlier, this function returned an numpy array of shape (1,n). It has now been edited to return the transpose, i.e., an numpy array of shape (n,1). This change was made to make matrix multiplication in the function forward_pass easy. forward_pass:  The main change is that now this function uses matrix multiplication to multiply all inputs with the weights. This will enable batch processing.  activate: This function now activates the input sums for every row of predictor values. New Functions created: backward_pass : Finding the change in weights required with respect to the Error. Based on the derivation, for a neuron that is on the output layer, delta w = learning_rate * eeta * input_attribute_ij wherein eeta = predicted_output_i*( 1 - predicted_output_i)(actual_output_i - predicted_output_i).  Parameters :  (1) input (numpy array (m,n))                       (2) predicted_output(numpy array (m,1))                       (3) actual_output(numpy a