View source: R/predict.graphclass.r
| predict.graphclass | R Documentation |
Given an object of type graphclass, this function obtains the fitted classes for a new data.
## S3 method for class 'graphclass'
predict(object, newdata, type = c("class", "prob", "error"), Ytest, ...)
type |
Indicates the type of response: |
Ytest |
If type = "error", true classes to compare. |
gc |
A trained graph classifier object |
X |
A matrix containing rows with vectorized upper triangular adjacency matrices (column-major order) |
A vector containing the predicted classes.
data(COBRE.data)
X <- COBRE.data$X.cobre
Y <- COBRE.data$Y.cobre
#Split into train and test
test <- runif(length(Y)) <= 0.1
gc <- graphclass(X = X[!test, ], Y = factor(Y[!test]), type = "intersection",
lambda = 1e-4, rho = 1, gamma = 1e-5)
gc.test <- predict(gc, X[test, ])
predict(gc, X[test, ], "error", Ytest = Y[test])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.