Package 'rvfl'

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

Help Index


Dropout Layer

Description

Applies dropout to the input data for regularization during training. The dropout rate determines the probability of retaining a unit.

Usage

dropout_layer(x, dropout = 0, seed = 42)

Arguments

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.

Value

A matrix of the same shape as x with dropout applied.

Examples

# Apply dropout to a matrix
x <- matrix(runif(20), nrow = 5)
dropout_layer(x, dropout = 0.5)

Compute Fitted Values for RVFL2 Model

Description

Returns the fitted (predicted) values for the RVFL2 model on the given data.

Usage

## S3 method for class 'rvfl2'
fitted(object, x)

Arguments

object

An object of class rvfl2 (the fitted model).

x

A numeric matrix of input features (test data).

Value

A numeric vector of fitted values.


Simple and efficient implementation using the kernel trick on concatenated features

Description

Simple and efficient implementation using the kernel trick on concatenated features

Usage

krvfl(
  x,
  y,
  lambda = 0.1,
  nb_hidden = 100L,
  activation = c("relu", "sigmoid", "tanh", "linear"),
  sigma = 1,
  seed = NULL,
  ...
)

Arguments

x

Matrix of predictors (n x p)

y

Response vector (n x 1) or matrix (n x m)

lambda

Regularization parameter

nb_hidden

Number of hidden units

activation

Activation function

sigma

Scale parameter for weights

seed

Random seed

...

Additional arguments

Value

krvfl object


Predict method for krvfl objects

Description

Predict method for krvfl objects

Usage

## S3 method for class 'krvfl'
predict(object, newdata = NULL, ...)

Arguments

object

A krvfl object from krvfl()

newdata

Matrix of new predictors (m x p)

...

Additional arguments (unused)

Value

Predicted values (m x 1) or (m x q) matrix


Make Predictions with RVFL2 Model

Description

Predicts the target values using the fitted RVFL2 model on new input data.

Usage

## S3 method for class 'rvfl2'
predict(object, new_x, dropout = object$dropout, seed = object$seed)

Arguments

object

An object of class rvfl2 (the fitted model).

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.

Value

A numeric vector of predicted target values.


Print method for krvfl objects

Description

Print method for krvfl objects

Usage

## S3 method for class 'krvfl'
print(x, ...)

Arguments

x

A krvfl object

...

Additional arguments (unused)


Compute Residuals for RVFL2 Model

Description

Computes the residuals (observed - predicted) for the RVFL2 model on the given data.

Usage

## S3 method for class 'rvfl2'
residuals(object, x, y)

Arguments

object

An object of class rvfl2 (the fitted model).

x

A numeric matrix of input features (test data).

y

A numeric vector of observed target values (test labels).

Value

A numeric vector of residuals.


rvfl

Description

Generic function for RVFL models

Usage

rvfl(x, ...)

Arguments

x

Object input

...

Additional arguments passed to methods


Custom Regression Function (RVFL2)

Description

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.

Usage

rvfl2(
  x,
  y,
  nb_hidden = 50,
  sigma = 1,
  dropout = 0,
  seed = 42,
  lambda_1 = 0,
  lambda_2 = 0
)

Arguments

x

A numeric matrix of input features (training data).

y

A numeric vector of target values (training labels).

nb_hidden

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.

Value

A list of class rvfl2 containing the fitted model with the coefficients, hidden layer weights, and training parameters.


Summary method for krvfl objects

Description

Summary method for krvfl objects

Usage

## S3 method for class 'krvfl'
summary(object, ...)

Arguments

object

A krvfl object

...

Additional arguments (unused)


Summary of RVFL2 Model

Description

Displays a summary of the RVFL2 model, including the key hyperparameters.

Usage

## S3 method for class 'rvfl2'
summary(object)

Arguments

object

An object of class rvfl2 (the fitted model).

Value

None (prints summary information to the console).