-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ML path selection #60
base: main
Are you sure you want to change the base?
Conversation
…th-selection # Conflicts: # buildSrc/src/main/kotlin/Versions.kt # usvm-core/src/main/kotlin/org/usvm/Machine.kt # usvm-core/src/main/kotlin/org/usvm/ps/PathSelectorFactory.kt # usvm-jvm/build.gradle.kts
# Conflicts: # usvm-core/build.gradle.kts
usvm-ml-path-selection/src/main/kotlin/org/usvm/ModifiedUMachineOptions.kt
Show resolved
Hide resolved
class CoverageCounterStatistics<State : UState<*, *, *, *, State>>( | ||
private val coverageStatistics: CoverageStatistics<*, *, State>, | ||
private val coverageCounter: CoverageCounter, | ||
private val methodName: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we include method signature here?
usvm-ml-path-selection/src/main/kotlin/org/usvm/ps/BlockGraph.kt
Outdated
Show resolved
Hide resolved
usvm-ml-path-selection/src/main/kotlin/org/usvm/util/ModifiedUtil.kt
Outdated
Show resolved
Hide resolved
usvm-ml-path-selection/src/main/kotlin/org/usvm/CoverageCounter.kt
Outdated
Show resolved
Hide resolved
usvm-ml-path-selection/src/main/kotlin/org/usvm/machine/ModifiedJcMachine.kt
Outdated
Show resolved
Hide resolved
usvm-ml-path-selection/src/main/kotlin/org/usvm/ps/FeaturesLogger.kt
Outdated
Show resolved
Hide resolved
testStatementsCounts.values.sum(), | ||
testFinished.values.sumOf { if (it) 1.0 else 0.0 }.toFloat(), | ||
) | ||
return Json.encodeToJsonElement(statistics).jsonObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to return a statistics
object, avoiding serialization to json.
if (path.isEmpty()) { | ||
return | ||
} | ||
val jsonData = buildJsonObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use serializable object instead of creating a json manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first field of this object would need to be a multidimensional array of floats of unknown depth. I can think of 2 ways of making it serializabe: writing a custom serializer or making it a JsonArray. Both options seem to me like doing almost the same thing as creating a json manually, but probably even worse.
return blockList.map { getBlockFeatures(it) } | ||
} | ||
|
||
fun saveGraph(filePath: Path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to split the BlockGraph
data structure and graph printer
env, edgesDataBuffer, | ||
edgesShape.map { it.toLong() }.toLongArray() | ||
) | ||
val result = gnnSession!!.run(mapOf(Pair("x", featuresData), Pair("edge_index", edgesData))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mapOf("x" to featuresData)
) | ||
val result = gnnSession!!.run(mapOf(Pair("x", featuresData), Pair("edge_index", edgesData))) | ||
val output = (result.get("output").get().value as Array<*>).map { | ||
(it as FloatArray).toList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use FloatArray
if possible
No description provided.