forked from microsoft/SynapseML
-
Notifications
You must be signed in to change notification settings - Fork 0
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
modify recommendation assertion. #2
Open
JessicaXYWang
wants to merge
36
commits into
KeerthiYandaOS:keerthiyanda/spark3.4
Choose a base branch
from
JessicaXYWang:recommendation_fix
base: keerthiyanda/spark3.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
e4e01bb
chore: bump to spark 3.3.1
JessicaXYWang 23273d6
Adding Spark3.4 Support
KeerthiYandaOS d283c1d
Removing comment
KeerthiYandaOS 505ba7a
Updating evn file
KeerthiYandaOS 0ef7496
Fixing build errors
KeerthiYandaOS db91269
Fixing build error
KeerthiYandaOS abe0285
fixing style error
KeerthiYandaOS a495685
Fixing scala errors
KeerthiYandaOS 0d22061
Adding json
KeerthiYandaOS 1ea3b96
Adding play
KeerthiYandaOS 358aed6
Converting to json
KeerthiYandaOS 79ce14f
Adding scalac plugin
KeerthiYandaOS ec761d8
Version update
KeerthiYandaOS 4ac421a
Updating scoverage version
KeerthiYandaOS ba7e79a
Adding scalariform
KeerthiYandaOS 6b1bb0d
Adding versionScheme
KeerthiYandaOS 5d8f23f
update version
KeerthiYandaOS 64c635a
Updating the path
KeerthiYandaOS 3bc2028
Update hadoop
KeerthiYandaOS d5efcb9
Updating breeze version
KeerthiYandaOS 29c94c1
Remove scalactic exclusion
KeerthiYandaOS ef4f337
Adding scikit-learn
KeerthiYandaOS d7d4a67
removing versions
KeerthiYandaOS 4adca08
Adding scikit-learn
KeerthiYandaOS 1faadce
Adding sklearn
KeerthiYandaOS b0210f6
Adding exclusion
KeerthiYandaOS e1e8d2e
Exclude avro
KeerthiYandaOS 0b0ccb8
exc sql
KeerthiYandaOS e9c19ac
Adding protobuf
KeerthiYandaOS e4354a7
try fix LightGBM unit test
svotaw 6c1a640
Merge branch 'keerthiyanda/spark3.4' of https://github.com/KeerthiYan…
svotaw e4e608c
Updating horovod to 0.28.1
KeerthiYandaOS d942c2d
Update Quickstart - Document Question and Answering with PDFs.ipynb
BrendanWalsh 65e5fcc
Fixing Databricks Runtime and Tests
KeerthiYandaOS f828a81
modify recommendation assertion
JessicaXYWang b0f6e63
update RankingAdapterModelSpec
JessicaXYWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ package com.microsoft.azure.synapse.ml.recommendation | |
|
||
import com.microsoft.azure.synapse.ml.core.test.fuzzing.{EstimatorFuzzing, TestObject, TransformerFuzzing} | ||
import org.apache.spark.ml.util.MLReadable | ||
import org.apache.spark.sql.DataFrame | ||
import org.scalactic.Equality | ||
|
||
class RankingAdapterSpec extends RankingTestBase with EstimatorFuzzing[RankingAdapter] { | ||
override def testObjects(): Seq[TestObject[RankingAdapter]] = { | ||
|
@@ -15,6 +17,19 @@ class RankingAdapterSpec extends RankingTestBase with EstimatorFuzzing[RankingAd | |
|
||
override def modelReader: MLReadable[_] = RankingAdapterModel | ||
|
||
override def assertDFEq(df1: DataFrame, df2: DataFrame)(implicit eq: Equality[DataFrame]): Unit = { | ||
def prep(df: DataFrame) = { | ||
// sort rows and round decimals before compare two dataframes | ||
import org.apache.spark.sql.functions._ | ||
val roundListDecimals: Seq[Float] => Seq[Float] = _.map { value => | ||
BigDecimal(value.toDouble).setScale(6, BigDecimal.RoundingMode.HALF_UP).toFloat | ||
} | ||
val castListToIntUDF = udf(roundListDecimals) | ||
val sortedDF = df.orderBy(col("prediction")) | ||
val updatedDF: DataFrame = sortedDF.withColumn("label", castListToIntUDF(col("label"))) | ||
updatedDF | ||
} | ||
super.assertDFEq(prep(df1), prep(df2))(eq)} | ||
} | ||
|
||
class RankingAdapterModelSpec extends RankingTestBase with TransformerFuzzing[RankingAdapterModel] { | ||
|
@@ -24,4 +39,18 @@ class RankingAdapterModelSpec extends RankingTestBase with TransformerFuzzing[Ra | |
} | ||
|
||
override def reader: MLReadable[_] = RankingAdapterModel | ||
|
||
override def assertDFEq(df1: DataFrame, df2: DataFrame)(implicit eq: Equality[DataFrame]): Unit = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unless i'm missing something this is the same as above. can we reduce code duplication? |
||
def prep(df: DataFrame) = { | ||
// sort rows and round decimals before compare two dataframes | ||
import org.apache.spark.sql.functions._ | ||
val roundListDecimals: Seq[Float] => Seq[Float] = _.map { value => | ||
BigDecimal(value.toDouble).setScale(6, BigDecimal.RoundingMode.HALF_UP).toFloat | ||
} | ||
val castListToIntUDF = udf(roundListDecimals) | ||
val sortedDF = df.orderBy(col("prediction")) | ||
val updatedDF: DataFrame = sortedDF.withColumn("label", castListToIntUDF(col("label"))) | ||
updatedDF | ||
} | ||
super.assertDFEq(prep(df1), prep(df2))(eq)} | ||
} |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
With the goal of making sure that we're not hiding a real issue by changing tests, are we sure it's accurate to sort and round?
Why did it work before when it was unsorted and unrounded?