The gallstone dataset consists of a mix of demographic, bioimpedance and laboratory features. It is a mix of binary and continuous features, with 40 in total after pre-processing the dataset. It is relatively small, with only 319 total samples, where we use 223 of those for training and the remaining 96 for validation. This makes it potentially sensitive to initializations, or other hyperparameters such as the number of epochs to train.
This 4 hidden layer model with normalizing flows has over 30000 parameters, which can be seen when using the print function.
problem <- "binary classification"
sizes <- c(40, 16, 16, 16, 16, 1)
inclusion_priors <- c(0.5, 0.5, 0.5, 0.5, 0.5)
stds <- c(1, 1, 1, 1, 1)
inclusion_inits <- 'polarized_dense'
device <- "cpu"
model_gs <- lbbnn_net(problem_type = problem, sizes = sizes,
prior = inclusion_priors, flow = TRUE,
dims = c(10, 10, 10, 10),
inclusion_inits = inclusion_inits,
input_skip = TRUE, std = stds, device = device)
#print(model_gs)train_lbbnn(epochs = 1000, LBBNN = model_gs,
lr = 0.005, train_dl = train_loader_gs, device = device,
verbose = FALSE)
validate_lbbnn(LBBNN = model_gs, num_samples = 10, test_dl = test_loader_gs,
device = device)The above results in a very sparse model, where accuracy around 73%. Instead, training can be terminated at a specified minimum density using the argument “min_density” as follows:
torch::torch_manual_seed(42)
model_2 <- lbbnn_net(problem_type = problem, sizes = sizes,
prior = inclusion_priors, flow = TRUE,
dims = c(10, 10, 10, 10),
inclusion_inits = inclusion_inits,
input_skip = TRUE, std = stds, device = device)
train_lbbnn(epochs = 1000, LBBNN = model_2,
lr = 0.005, train_dl = train_loader_gs, device = device,
verbose = FALSE, min_density = 0.1)
validate_lbbnn(LBBNN = model_2, num_samples = 10, test_dl = test_loader_gs,
device = device)Accuracy is now improved to around 79%.
Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.
This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.