weka-kt

wekakt / com.github.stevenlang.wekakt.extensions / weka.core.Instances / sliceRows

sliceRows

fun Instances.sliceRows(range: IntRange): Instances

Slice the given range of rows out of the dataset.

val iris: Instances = getIris()

// Get rows in the interval [2..3]
val sliceRows: Instances = iris.sliceRows(2..3)

Parameters

range - Range of ints indicating the slice interval

Return Subset of this dataset, that is only the rows in the given range are in the result

fun Instances.sliceRows(vararg indices: Int): Instances

Get the subset of rows with the given indices.

val iris: Instances = getIris()

// Get rows 2, 5 and 8
val sliceRows: Instances = iris.sliceRows(2, 5, 8)

Parameters

indices - List of indices to return the rows of

Return Subset of this dataset containing only the rows specified in indices