The following code will design the function perceptron_predict(x, map_func, theta)
in MATLAB that returns the perceptron output t_hat, as a column vector of hard predictions applied to n inputs.
main.m425 chars16 lines
Here, map_func
is a function that can be used to transform the input data. theta
is the learned weights for the perceptron.
The function first applies the mapping function to the input dataset. It then calculates the predicted output using learned weights of the perceptron. The predicted output t_hat
is returned as a column vector of hard predictions applied to n inputs.
gistlibby LogSnag