Skip to content
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

fix: companionModelClassName no longer returns generic type variable #2195

Merged
merged 6 commits into from
Apr 9, 2024

Conversation

BrendanWalsh
Copy link
Collaborator

This commit addresses an issue in the companionModelClassName method where the resolution of the companion model's class name was not accurately reflecting the intended Python package path for Regression models.

"from M import M", where M is the name of MLLib's Regressor class' concrete model type parameter:
https://github.com/apache/spark/blob/45ba9224602eb18fe45e339cbb8cf2e8a4924f0b/mllib/src/main/scala/org/apache/spark/ml/regression/Regressor.scala#L28

Implemented reflection with scala.reflect.runtime.universe._ to accurately access and utilize type information at runtime, overcoming Scala's type erasure limitations.

Tested against the existing method for all wrappable classes and found the only divergence to be the instance where it fixed the broken wrapped regressor. Added a regression test for this scenario.

@microsoft microsoft deleted a comment from azure-pipelines bot Apr 9, 2024
@microsoft microsoft deleted a comment from azure-pipelines bot Apr 9, 2024
@microsoft microsoft deleted a comment from codecov-commenter Apr 9, 2024
@microsoft microsoft deleted a comment from azure-pipelines bot Apr 9, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 83.59%. Comparing base (ca747bb) to head (0e9c0e6).

Files Patch % Lines
.../azure/synapse/ml/core/utils/JarLoadingUtils.scala 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2195      +/-   ##
==========================================
- Coverage   85.91%   83.59%   -2.33%     
==========================================
  Files         329      329              
  Lines       17086    17089       +3     
  Branches     1515     1523       +8     
==========================================
- Hits        14680    14285     -395     
- Misses       2406     2804     +398     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@microsoft microsoft deleted a comment from azure-pipelines bot Apr 9, 2024
@BrendanWalsh
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

override val uid: String = "test"
}

private[codegen] class TestRegressor extends Regressor[Vector, TestRegressor, TestRegressorModel] with Wrappable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this end up in the python bindings?

@mhamilton723 mhamilton723 merged commit 50c7f1e into microsoft:master Apr 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants