Companion

object Companion

Functions

convertByteToFloat
Link copied to clipboard
fun convertByteToFloat(label: Byte): Float

Creates float label.

create
Link copied to clipboard
fun create(features: Array<FloatArray>, labels: FloatArray): OnHeapDataset

Takes data from external data features and labels to create dataset OnHeapDataset.

fun create(featuresGenerator: () -> Array<FloatArray>, labelGenerator: () -> FloatArray): OnHeapDataset

Takes the data from generators featuresGenerator and labelGenerator to create an OnHeapDataset.

fun create(pathToData: File, labels: FloatArray, preprocessing: Preprocessing = Preprocessing()): OnHeapDataset

Creates an OnHeapDataset from pathToData and labels using preprocessing to prepare images.

fun create(pathToData: File, labelGenerator: LabelGenerator, preprocessing: Preprocessing = Preprocessing()): OnHeapDataset

Creates an OnHeapDataset from pathToData and labelGenerator with preprocessing to prepare images.

fun create(featuresPath: String, labelsPath: String, numClasses: Int, featuresExtractor: (String) -> Array<FloatArray>, labelExtractor: (String, Int) -> FloatArray): OnHeapDataset

Takes data located in featuresPath, labelsPath with numClasses, extracts data and labels via featuresExtractor and labelExtractor to create an OnHeapDataset.

createTrainAndTestDatasets
Link copied to clipboard
fun createTrainAndTestDatasets(trainFeaturesPath: String, trainLabelsPath: String, testFeaturesPath: String, testLabelsPath: String, numClasses: Int, featuresExtractor: (String) -> Array<FloatArray>, labelExtractor: (String, Int) -> FloatArray): Pair<OnHeapDataset, OnHeapDataset>

Takes data located in trainFeaturesPath, trainLabelsPath, testFeaturesPath, testLabelsPath with numClasses, extracts data and labels via featuresExtractor and labelExtractor to create a pair of OnHeapDataset for training and testing.

toNormalizedVector
Link copied to clipboard
fun toNormalizedVector(bytes: ByteArray): FloatArray

Normalizes bytes via division on 255 to get values in range '[0; 1)'.

toOneHotVector
Link copied to clipboard
fun toOneHotVector(numClasses: Int, label: Byte): FloatArray

Creates binary vector with size numClasses from label.

toRawVector
Link copied to clipboard
fun toRawVector(bytes: ByteArray): FloatArray

Converts bytes to FloatArray.