Learn R Programming

butcher (version 0.3.5)

axe-nnet: Axing a nnet.

Description

nnet objects are created from the nnet package, leveraged to fit multilayer perceptron models.

Usage

# S3 method for nnet
axe_call(x, verbose = FALSE, ...)

# S3 method for nnet axe_env(x, verbose = FALSE, ...)

# S3 method for nnet axe_fitted(x, verbose = FALSE, ...)

Value

Axed nnet object.

Arguments

x

A model object.

verbose

Print information each time an axe method is executed. Notes how much memory is released and what functions are disabled. Default is FALSE.

...

Any additional arguments related to axing.

Examples

Run this code
# Load libraries
library(parsnip)
library(nnet)

# Create and fit model
nnet_fit <- mlp("classification", hidden_units = 2) %>%
  set_engine("nnet") %>%
  fit(Species ~ ., data = iris)

out <- butcher(nnet_fit, verbose = TRUE)

# Another nnet object
targets <- class.ind(c(rep("setosa", 50),
                       rep("versicolor", 50),
                       rep("virginica", 50)))

fit <- nnet(iris[,1:4],
            targets,
            size = 2,
            rang = 0.1,
            decay = 5e-4,
            maxit = 20)

out <- butcher(fit, verbose = TRUE)

Run the code above in your browser using DataLab