weka-kt

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

sliceAttributes

fun Instances.sliceAttributes(range: IntRange): Instances

Slice the given range of attributes out of the dataset.

val iris: Instances = getIris()

// Get attributes in the interval [2..3]
val sliceAtts: Instances = iris.sliceAttributes(2..3)

Parameters

range - Range of ints indicating the slice interval

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

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

Get the subset of attributes with the given indices.

val iris: Instances = getIris()

// Get attributes 0, 1 and 3
val sliceAttributes: Instances = iris.sliceAttributes(0, 1, 3)

Parameters

indices - List of indices to return the attributes of

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