| Title: | Random Vector Functional Link Networks |
|---|---|
| Description: | Random Vector Functional Link Networks. |
| Authors: | T. Moudiki [aut, cre] |
| Maintainer: | T. Moudiki <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 0.3.0 |
| Built: | 2026-05-24 10:17:16 UTC |
| Source: | https://github.com/thierrymoudiki/rvfl |
Applies dropout to the input data for regularization during training. The dropout rate determines the probability of retaining a unit.
dropout_layer(x, dropout = 0, seed = 42)dropout_layer(x, dropout = 0, seed = 42)
x |
A numeric matrix of input data. |
dropout |
A numeric value between 0 and 1 representing the dropout rate. Default is 0. |
seed |
An integer seed for random number generation. Default is 42. |
A matrix of the same shape as x with dropout applied.
# Apply dropout to a matrix x <- matrix(runif(20), nrow = 5) dropout_layer(x, dropout = 0.5)# Apply dropout to a matrix x <- matrix(runif(20), nrow = 5) dropout_layer(x, dropout = 0.5)
Returns the fitted (predicted) values for the RVFL2 model on the given data.
## S3 method for class 'rvfl2' fitted(object, x)## S3 method for class 'rvfl2' fitted(object, x)
object |
An object of class |
x |
A numeric matrix of input features (test data). |
A numeric vector of fitted values.
Simple and efficient implementation using the kernel trick on concatenated features
krvfl( x, y, lambda = 0.1, nb_hidden = 100L, activation = c("relu", "sigmoid", "tanh", "linear"), sigma = 1, seed = NULL, ... )krvfl( x, y, lambda = 0.1, nb_hidden = 100L, activation = c("relu", "sigmoid", "tanh", "linear"), sigma = 1, seed = NULL, ... )
x |
Matrix of predictors (n x p) |
y |
Response vector (n x 1) or matrix (n x m) |
lambda |
Regularization parameter |
|
Number of hidden units |
|
activation |
Activation function |
sigma |
Scale parameter for weights |
seed |
Random seed |
... |
Additional arguments |
krvfl object
Predict method for krvfl objects
## S3 method for class 'krvfl' predict(object, newdata = NULL, ...)## S3 method for class 'krvfl' predict(object, newdata = NULL, ...)
object |
A krvfl object from krvfl() |
newdata |
Matrix of new predictors (m x p) |
... |
Additional arguments (unused) |
Predicted values (m x 1) or (m x q) matrix
Predicts the target values using the fitted RVFL2 model on new input data.
## S3 method for class 'rvfl2' predict(object, new_x, dropout = object$dropout, seed = object$seed)## S3 method for class 'rvfl2' predict(object, new_x, dropout = object$dropout, seed = object$seed)
object |
An object of class |
new_x |
A numeric matrix of input features (test data). |
dropout |
A numeric value between 0 and 1 representing the dropout rate. Default is the value used during training. |
seed |
An integer seed for random number generation. Default is the value used during training. |
A numeric vector of predicted target values.
Print method for krvfl objects
## S3 method for class 'krvfl' print(x, ...)## S3 method for class 'krvfl' print(x, ...)
x |
A krvfl object |
... |
Additional arguments (unused) |
Computes the residuals (observed - predicted) for the RVFL2 model on the given data.
## S3 method for class 'rvfl2' residuals(object, x, y)## S3 method for class 'rvfl2' residuals(object, x, y)
object |
An object of class |
x |
A numeric matrix of input features (test data). |
y |
A numeric vector of observed target values (test labels). |
A numeric vector of residuals.
Generic function for RVFL models
rvfl(x, ...)rvfl(x, ...)
x |
Object input |
... |
Additional arguments passed to methods |
Fits a regression model using a Random Vector Functional Link (RVFL) network with dropout and regularization. The model includes both the original features and transformed features from a hidden layer.
rvfl2( x, y, nb_hidden = 50, sigma = 1, dropout = 0, seed = 42, lambda_1 = 0, lambda_2 = 0 )rvfl2( x, y, nb_hidden = 50, sigma = 1, dropout = 0, seed = 42, lambda_1 = 0, lambda_2 = 0 )
x |
A numeric matrix of input features (training data). |
y |
A numeric vector of target values (training labels). |
|
An integer specifying the number of hidden units in the model. Default is 50. |
|
sigma |
A numeric value controlling the standard deviation of the initial random weights. Default is 1. |
dropout |
A numeric value between 0 and 1 representing the dropout rate. Default is 0. |
seed |
An integer seed for random number generation. Default is 42. |
lambda_1 |
A numeric value controlling the L2 regularization on the input features. Default is 0. |
lambda_2 |
A numeric value controlling the L2 regularization on the hidden layer features. Default is 0. |
A list of class rvfl2 containing the fitted model with the coefficients, hidden layer weights, and training parameters.
Summary method for krvfl objects
## S3 method for class 'krvfl' summary(object, ...)## S3 method for class 'krvfl' summary(object, ...)
object |
A krvfl object |
... |
Additional arguments (unused) |
Displays a summary of the RVFL2 model, including the key hyperparameters.
## S3 method for class 'rvfl2' summary(object)## S3 method for class 'rvfl2' summary(object)
object |
An object of class |
None (prints summary information to the console).