Description Usage Arguments Value Examples
Predict using a Radial Basis Function Neural Network.
1 | RBFNN_predict(model, X, centroids, stds, inputType = "original_dataset")
|
model |
The trained RBFNN. |
X |
original dataset, distance matrix or gaussian kernel matrix. |
centroids |
centroids of the model. |
stds |
standard deviations of each RBF. |
inputType |
type of |
The predicted labels (in classification) or the value (in regression).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | data(iris)
iris <- iris
## Random permutation because the labels are ordered and therefore the accuracy would not
## be correct (only for this dataset).
iris <- iris[sample(nrow(iris)), ]
dataset <- iris[, 1:4]
labels <- iris[, 5]
X_train <- dataset[1:100, ]
y_train <- labels[1:100]
X_test <- dataset[101:150, ]
y_test <- labels[101:150]
neurons <- 10
seed_val <- 1
RBFNN <- RBFNN_train(as.matrix(X_train), as.matrix(y_train), neurons, seed_val)
model <- RBFNN$model
centroids <- RBFNN$centroids
stds <- RBFNN$stds
predictions <- RBFNN_predict(model, X_test, centroids, stds)
table(predictions, y_test)
accuracy <- sum(diag(table(predictions, y_test)))/nrow(X_test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.