get_prob: Computes model class conditional probabilities

Description Usage Arguments Value Methods (by class) Author(s) Examples

Description

Computes model class conditional probabilities

Usage

1
2
3
4
5
6
get_prob(object, feats, normalize = TRUE, log_domain = FALSE,
  backend = "R", ...)

## S3 method for class 'model.spec'
get_prob(object, feats, normalize = TRUE,
  log_domain = FALSE, backend = "R", ...)

Arguments

object

Linear classifier specification object.

feats

Numeric Matrix of features. Follows the usual convention of having one example per row. For a model with M features and dataset with N examples the matrix should be N \times K

normalize

Logical scalar. If TRUE return normalized probabilities

log_domain

Logical scalar. If TRUE returns log probabilities.

backend

Computation back-end ('R', 'C', or 'CUDA')

...

other arguments passed to specific methods

Value

Numeric Matrix. Class conditional probabilities matrix. Each row corresponds to the probabilities of one example. For model with K classes and a dataset of N examples the returned matrix should be N \times K

Methods (by class)

Author(s)

Mohamed Ishmael Diwan Belghazi

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Generate random initial weights
w_init <- matrix(rnorm(784 * 10), 784, 10)
# construct model
linear_classifier <- Classifier(weights_init=w_init)
# Fetch training variables
feats <- mini_mnist$train$images
targets <- mini_mnist$train$labels
# Set decay coefficient
decay <- 0.01
# compute log probabilities of the training set using the three back-ends
log_prob_R <- get_prob(linear_classifier, feats, TRUE, TRUE, 'R')
log_prob_C <- get_prob(linear_classifier, feats, TRUE, TRUE, 'C')
log_prob_CUDA <- get_prob(linear_classifier, feats, TRUE, TRUE, 'CUDA')

IshmaelBelghazi/gpuClassifieR documentation built on May 7, 2019, 6:45 a.m.