CNNimgClassification: CNN img classification

CNNimgClassificationR Documentation

CNN img classification

Description

Classification using convolutionnal network on image profile.

Usage

CNNimgClassification(
  object,
  scores = c("prediction", "all", "none"),
  fcol = "markers",
  resample_data = TRUE,
  model_type = "CNN",
  keep_img = FALSE,
  epochs = 40,
  batch_size = 32,
  lr = 0.001,
  show_plot = FALSE
)

Arguments

object

An instance of class "MSnSet".

scores

One of "prediction", "all" or "none" to report the score for the predicted class only, for all classes or none.

fcol

The feature meta-data containing marker definitions. Default is markers.

resample_data

Logical to tell if you want to rebalance the data (remove proteins with bad profiles and add artificial ones to get a more uniform distribution of the number of profiles per class)

model_type

The type of neural network you want (either 'CNN' or 'SpatialTransformer').

keep_img

Logical to tell if you want to keep the images profiles created.

epochs

The number of epochs for training; default is 40.

batch_size

The size of the batch for training; default is 16.

lr

The learning rate of the neural network; default is 0.001.

show_plot

Logical to tell if you want to print the loss and accuracy plots.

Details

This algorithm will not apply clustering on raw data but on the image of the profiles from each protein. Then by using a convolutional network, it will learn to classify those images and then make predictions. Also, since the output is a log softmax, we can interpret these scores as probabilities. So we can handle proteins with composite profiles.

The first model available is a classical CNN containg two conv2d layers with dropout, Tanh activation and maxpool. The second one is a spatial transformers using convolutional layers and affine transformation.

This function calls python scripts in order to use torch python library, so it totally depends on reticulate r package.

Value

An instance of class "MSnSet" with CNNimg and CNNimg.scores feature variables storing the classification results and scores respectively.

Examples

library(pRolocExtra)
data(tan2009r1)
res <- CNNimgClassification(tan2009r1)
getPredictions(res, fcol = "CNNimg")
getPredictions(res, fcol = "CNNimg", t = 0.75)
plot2D(res, fcol = "CNNimg")

mgerault/pRolocExtra documentation built on Sept. 15, 2022, 9:26 a.m.