Skip to content

Commit

Permalink
ignoring cardinality in modelinsights serialization (#474)
Browse files Browse the repository at this point in the history
* ignoring cardinality at modelinsights serialization

* get rid of empty test

* update the counter part of the test case, making it more understandable
  • Loading branch information
winterslu committed May 11, 2020
1 parent dc33ada commit 7d0c33e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/main/scala/com/salesforce/op/ModelInsights.scala
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,15 @@ case object ModelInsights {
{ case x: EvalMetric => JString(x.entryName) }
)
)
val featureDistributionSerializer = FieldSerializer[FeatureDistribution](
FieldSerializer.ignore("cardEstimate")
)
Serialization.formats(typeHints) +
EnumEntrySerializer.json4s[ValidationType](ValidationType) +
EnumEntrySerializer.json4s[ProblemType](ProblemType) +
new SpecialDoubleSerializer +
evalMetricsSerializer
evalMetricsSerializer +
featureDistributionSerializer
}

/**
Expand Down
3 changes: 3 additions & 0 deletions core/src/test/scala/com/salesforce/op/ModelInsightsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ class ModelInsightsTest extends FlatSpec with PassengerSparkFixtureTest with Dou
i.featureName shouldEqual o.featureName
i.featureType shouldEqual o.featureType
i.derivedFeatures.zip(o.derivedFeatures).foreach { case (ii, io) => ii.corr shouldEqual io.corr }
i.distributions.foreach { i => i.cardEstimate should not be None}
o.distributions.foreach { o => o.cardEstimate shouldEqual None}
RawFeatureFilterResultsComparison.compareSeqMetrics(i.metrics, o.metrics)
RawFeatureFilterResultsComparison.compareSeqDistributions(i.distributions, o.distributions)
RawFeatureFilterResultsComparison.compareSeqExclusionReasons(i.exclusionReasons, o.exclusionReasons)
Expand Down Expand Up @@ -968,4 +970,5 @@ class ModelInsightsTest extends FlatSpec with PassengerSparkFixtureTest with Dou
"second" -> classOf[SingleMetric]
)
}

}

0 comments on commit 7d0c33e

Please sign in to comment.