gs.xval.split: Cross-Validation Data Splitter

Description Usage Arguments Value Author(s) Examples

Description

gs.xval.split A function to split a dataset into training and testing sets for cross validation.

Usage

1
gs.xval.split(graphs, Y, k = "loo", ...)

Arguments

graphs

[n, d, d] or [[n]][v, v] the data with n samples of v vertices.

Y

[n] the labels of the samples with K unique labels.

k

the cross-validated method to perform. Defaults to 'loo'.

  • 'loo' Leave-one-out cross validation

  • isinteger(k) perform k-fold cross-validation with k as the number of folds.

...

trailing args.

Value

sets the cross-validation sets as an object of class "XV". Each element of the list contains the following items:

graphs.train

the training data as a [[n - k]][v, v] list.

Y.train

the training labels as a [n - k] vector.

graphs.test

the testing data as a [[k]][v, v] list.

Y.test

the testing labels as a [k] vector.

Author(s)

Eric Bridgeford

Examples

1
2
3
4
5
6
7
8
# prepare data for 10-fold validation
library(graphstats)
data <- gs.sims.er(n=100, v=10, priors=c(1), p=c(0.5))  # 100 examples of 10x10 graphs
graphs <- data$graphs; Y <- data$Y
sets.xval.10fold <- lol.xval.split(graphs, Y, k=10)

# prepare data for loo validation
sets.xval.loo <- lol.xval.split(graphs, Y, k='loo')

neurodata/graphstats documentation built on May 14, 2019, 5:19 p.m.