Learn R Programming

freestats (version 0.0.3)

perceptrain: An original perceptron algorithm

Description

Train data with perceptron algorithm

Usage

perceptrain(S, y, alpha_k = 1, endcost = 0)

Arguments

S
Each row represents a data points with last column equal to 1; S=[X,1]
y
Class label for data points in S
alpha_k
The speed of converge
endcost
The termination condition of cost function

Value

z
Normal vector of a hyperplane
Z_history
Trajactory of normal vector of a hyperplane
NumofIteration
Number of iterations for algorithm

Details

S is especially designed for perceptron.

For more information fakedata

Examples

Run this code
set.seed(1024)
z <- runif(n=3)
mydata <- fakedata(w=z,n=100)
r <- perceptrain(S=mydata$S,y=mydata$y,alpha_k=1,endcost=0)
r

Run the code above in your browser using DataLab