weka-kt

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

set

operator fun Instances.set(rowIndex: Int, instance: Instance): Instance

Set the instance at position rowIndex.

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

Parameters

rowIndex - Row index

instance - Row instanceoperator fun Instances.set(rowIndex: Int, attributeIndex: Int, value: Number): Unit

Set the value at position (rowIndex,attributeIndex).

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

Parameters

rowIndex - Row index

attributeIndex - Attribute index

value - Valueoperator fun Instances.set(rowIndex: Int, attribute: Attribute, value: Number): Unit

Set the value at position (rowIndex,attribute).

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

Parameters

rowIndex - Row index

attribute - Attribute

value - Valueoperator fun Instances.set(rowIndex: Int, attributeIndex: Int, value: String): Unit

Set string value at position (rowIndex,attributeIndex).

val data: Instances = getData()
data[4, 0] = "car"

Parameters

rowIndex - Row index

attributeIndex - Attribute index

value - Valueoperator fun Instances.set(rowIndex: Int, attribute: Attribute, value: String): Unit

Set string value at position (rowIndex,attribute).

val data: Instances = getData()
val att: Attribute = data.attributes[0]
data[4, att] = "car"

Parameters

rowIndex - Row index

attribute - Attribute

value - Value