perceptron | R Documentation |
Binary classification algorithm that learns to separate two classes of data points by finding an optimal decision boundary (hyper plane) in the feature space.
perceptron(
training_data,
to_clasify,
activation_method,
max_iter,
learning_rate,
learn = FALSE,
waiting = TRUE
)
training_data |
Data frame with already classified observations. Each column represents a parameter of the values. The last column contains the output, this means, the expected output when the other column values are inputs. Each row is a different observation. It works as training data. |
to_clasify |
Vector containing the parameters of the new value that we want to classify. |
activation_method |
Activation function to be used. It must be one of
|
max_iter |
Maximum epoch during the training phase. |
learning_rate |
Value at which the perceptron will learn from previous epochs mistakes. |
learn |
Boolean value. If it is set to "TRUE" multiple clarifications and explanations are printed along the code |
waiting |
If TRUE while |
Functioning:
Generate a random weight for each independent variable.
Check if the weights classify correctly. If they do, go to step 4
Adjust weights based on the error between the expected output and the real output. If max_iter is reached go to step 4. If not, go to step 2.
Return the weights and use them to classify the new value
List with the weights of the inputs.
Víctor Amador Padilla, victor.amador@edu.uah.es
# example code
perceptron(db_per_or, c(1, 1, 1), "gelu", 1000, 0.1)
perceptron(db_per_and, c(0,0,1), "swish", 1000, 0.1, TRUE, FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.