Created
December 8, 2020 04:08
-
-
Save farmaker47/cc6a654e56b4348ee51e1838c2e85f12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun execute(floatsInput: FloatArray): Pair<ArrayList<String>, ArrayList<Float>> { | |
................................. | |
................................. | |
val listOfArrayMeanScores = arrayMeanScores.toCollection(ArrayList()) | |
val listOfMaximumValues = arrayListOf<Float>() | |
for (i in 0 until 10) { | |
val number = listOfArrayMeanScores.max() ?: 0f | |
listOfMaximumValues.add(number) | |
listOfArrayMeanScores.remove(number) | |
} | |
val listOfMaxIndices = arrayListOf<Int>() | |
for (i in 0 until 10) { | |
for (k in arrayMeanScores.indices) { | |
if (listOfMaximumValues[i] == arrayMeanScores[k]) { | |
listOfMaxIndices.add(k) | |
} | |
} | |
} | |
val finalListOfOutputs = arrayListOf<String>() | |
for (i in listOfMaxIndices.indices) { | |
finalListOfOutputs.add(labels.get(listOfMaxIndices.get(i))) | |
} | |
return Pair(finalListOfOutputs, listOfMaximumValues) // ArrayList<String> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment