Default print method for a neuralGAM object.
# S3 method for class 'neuralGAM'
print(x, ...)Prints a brief summary of the fitted model including:
The distribution family used ("gaussian", "binomial", or "poisson").
The model formula.
The fitted intercept (\(\eta_0\)).
The training MSE of the model.
The number of observations used to train the model.
# \dontrun{
library(neuralGAM)
dat <- sim_neuralGAM_data()
train <- dat$train
test <- dat$test
ngam <- neuralGAM(
y ~ s(x1) + x2 + s(x3),
data = train,
num_units = 128,
family = "gaussian",
activation = "relu",
learning_rate = 0.001,
bf_threshold = 0.001,
max_iter_backfitting = 10,
max_iter_ls = 10,
seed = 1234
)
#> [1] "Initializing neuralGAM..."
#> [1] "BACKFITTING Iteration 1 - Current Err = 0.00314307849443241 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 2 - Current Err = 0.0035904802501205 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 3 - Current Err = 0.0022177874489898 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 4 - Current Err = 0.00198120946126081 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 5 - Current Err = 0.00268658957361894 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 6 - Current Err = 0.00280545783365124 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 7 - Current Err = 0.0019751075608256 BF Threshold = 0.001 Converged = FALSE"
#> [1] "BACKFITTING Iteration 8 - Current Err = 0.000915071832718818 BF Threshold = 0.001 Converged = TRUE"
print(ngam)
#> Class: neuralGAM
#> Family : gaussian
#> Formula : y ~ s(x1) + x2 + s(x3)
#> Observations : 1400
#> Intercept (eta0) : 4.47201
#> Deviance explained : 90.78%
#> Train MSE : 1.22241
#> Pred. / Conf. Int. : disabled
# }