# NOT RUN {
# libraries
library(fda)
# Loading data
data("daily")
# Obtaining response
total_prec = apply(daily$precav, 2, mean)
# Creating functional data
temp_data = array(dim = c(65, 35, 1))
tempbasis65 = create.fourier.basis(c(0,365), 65)
timepts = seq(1, 365, 1)
temp_fd = Data2fd(timepts, daily$tempav, tempbasis65)
# Data set up
temp_data[,,1] = temp_fd$coefs
# Creating grid
tune_list_weather = list(num_hidden_layers = c(2),
neurons = c(8, 16),
epochs = c(250),
val_split = c(0.2),
patience = c(15),
learn_rate = c(0.01, 0.1),
num_basis = c(7),
activation_choice = c("relu", "sigmoid"))
# Running Tuning
weather_tuned = fnn.tune(tune_list_weather,
total_prec,
temp_data,
basis_choice = c("fourier"),
domain_range = list(c(1, 24)),
nfolds = 2)
# Looking at results
weather_tuned
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab