weka-kt

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

get

operator fun Instances.get(rowIndex: Int): Instance

Get the instance at index rowIndex.

val iris: Instances = getIris()
val row: Instance = iris[4]

Parameters

rowIndex - Row index

Return Instance at rowIndex

operator fun Instances.get(rowIndex: Int, attributeIndex: Int): Double

Get the value at position (rowIndex,attributeIndex).

val iris: Instances = getIris()
val value: Double = iris[4, 0]

Parameters

rowIndex - Row index

attributeIndex - Attribute index

Return Value at position (rowIndex,attributeIndex)

operator fun Instances.get(rowIndex: Int, attribute: Attribute): Double

Get the value at position (rowIndex,attribute).

val iris: Instances = getIris()
val att: Attribute = iris.attributes[0]
val value: Double = iris[4, att]

Parameters

rowIndex - Row index

attribute - Attribute

Return Value at position (rowIndex,attribute)

operator fun Instances.get(rangeRows: IntRange, rangeAttributes: IntRange): Instances

Slice the given range of attributes out of the dataset.

val iris: Instances = getIris()

// Get rows from 5 to 50 and attributes from 2 to 3
val irisReduces: Instances = iris[5..50, 2..3]

Parameters

rangeRows - Range of ints indicating the row slice interval

rangeAttributes - Range of ints indicating the attribute slice interval

Return Subset of this dataset, that is only the attributes and rows in the given ranges are in the result

See Also

Instances.slice