-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
Description
There is a production case like this:
case class TrainingExample(indices: List[Int],
data: List[Float],
label: Float,
weight: Float)
object TestFeatureSpec {
val featuresType: TensorFlowType[TrainingExample] = TensorFlowType[TrainingExample]
}
...
def convertToTrainingExample(sv: Seq[SparseVector[Float]]): TrainingExample = {
val labelData = sv(0).data
val label = labelData.head
val weight = labelData.length match {
case a if a == 2 => labelData(1)
case _ => defaultWeight
}
TrainingExample(
sv(1).index.toList,
sv(1).data.toList,
label,
weight
)
}
...
val features = extracted
.featureValues[SparseVector[Float]]
.map(sv => (sampler.getPartition(), convertToTrainingExample(sv)))
.map { case (partition, example) =>
(partition, TestFeatureSpec.featuresType.toExample(example))
}
...
I guess there might be a problem with lists (indices, data), but can we handle this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested