The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

classification: gallstone dataset

Prepare data

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.

torch::torch_manual_seed(42)
loaders_gs <- get_dataloaders(gallstone_dataset, train_proportion = 0.70,
                              train_batch_size = 223, test_batch_size = 96,
                              standardize = TRUE, seed = 42)
train_loader_gs <- loaders_gs$train_loader
test_loader_gs <- loaders_gs$test_loader

Define model

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 and validate

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%.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.