Description Usage Arguments Value Methods (by class) Author(s) Examples
Computes model cost
1 2 3 4 5 |
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 |
targets |
Numeric matrix of one hot encoded target. Follows the usual convention of having one target per row. For a model with K classes and a dataset with N examples the matrix should be N \times K |
decay |
Numeric scalar. Tikhonov regularization coefficient (weight decay). Should be a non-negative real number. |
backend |
Computation back-end ('R', 'C', or 'CUDA') |
... |
other arguments passed to specific methods |
cost Numeric scalar. model cost
model.spec
: Computers model cost for linear classification
specification objects
Mohamed Ishmael Diwan Belghazi
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 cost of the training set using the three back-ends
cost_R <- get_cost(linear_classifier, feats, targets, decay, 'R')
cost_C <- get_cost(linear_classifier, feats, targets, decay, 'C')
cost_CUDA <- get_cost(linear_classifier, feats, targets, decay, 'CUDA')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.