Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Only import matplotlib where necessary for artifact plotting #3703

Merged
merged 2 commits into from
Nov 16, 2020

Conversation

dbczumar
Copy link
Collaborator

Signed-off-by: Corey Zumar corey.zumar@databricks.com

What changes are proposed in this pull request?

Moves a top-level matplotlib import for mlflow.sklearn.autolog() into the exception-caught artifact logging block where its required. This ensures that matplotlib is not a hard dependency for mlflow.sklearn.autolog().

How is this patch tested?

Existing unit tests ensure that artifact logging continues to function properly with the presence of matplotlib. @eedeleon and I will discuss strategies for testing the degraded functionality when matplotlib is unavailable, which is important in the context of a skinny client

Release Notes

Bug fix: mlflow.sklearn.autolog() no longer has a hard dependency on matplotlib.

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/artifacts: Artifact stores and artifact logging
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages
  • area/examples: Example code
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/projects: MLproject format, project running backends
  • area/scoring: Local serving, model deployment tools, spark UDFs
  • area/server-infra: MLflow server, JavaScript dev server
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, JavaScript, plotting
  • area/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Models
  • area/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registry
  • area/windows: Windows support

Language

  • language/r: R APIs and clients
  • language/java: Java APIs and clients
  • language/new: Proposals for new client languages

Integrations

  • integrations/azure: Azure and Azure ML integrations
  • integrations/sagemaker: SageMaker integrations
  • integrations/databricks: Databricks integrations

How should the PR be classified in the release notes? Choose one:

  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>
@dbczumar dbczumar requested a review from harupy November 16, 2020 20:04
@github-actions github-actions bot added area/tracking Tracking service, tracking client APIs, autologging rn/bug-fix Mention under Bug Fixes in Changelogs. labels Nov 16, 2020
@@ -500,6 +499,7 @@ def _log_specialized_estimator_content(fitted_estimator, run_id, fit_args, fit_k
display.ax_.set_title(artifact.title)
filepath = tmp_dir.path("{}.png".format(artifact.name))
display.figure_.savefig(filepath)
import matplotlib.pyplot as plt
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sklearn's plotting functionality depends on matplotlib; accordingly, we do not anticipate that this import will fail

@akshaya-a
Copy link
Contributor

thanks for the very quick fix!

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>
@harupy
Copy link
Member

harupy commented Nov 16, 2020

LGTM!

@dbczumar dbczumar merged commit 8651845 into mlflow:master Nov 16, 2020
harupy added a commit to harupy/mlflow that referenced this pull request Nov 19, 2020
…3703)

* Only import matplotlib where necessary for artifact plotting

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>

* Silly change for formatter

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>
harupy added a commit to harupy/mlflow that referenced this pull request Nov 19, 2020
…3703)

* Only import matplotlib where necessary for artifact plotting

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>

* Silly change for formatter

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
harupy added a commit that referenced this pull request Nov 19, 2020
* Do not disable existing logger when init alembic (#3653)

Signed-off-by: ruoxuany <ruoxuan.yin@citrix.com>

Co-authored-by: ruoxuany <ruoxuan.yin@citrix.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Only import matplotlib where necessary for artifact plotting (#3703)

* Only import matplotlib where necessary for artifact plotting

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>

* Silly change for formatter

Signed-off-by: Corey Zumar <corey.zumar@databricks.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Fix run_link for cross-workspace model versions (#3681)

Fix run_link for cross-workspace model versions

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

Co-authored-by: ruoxuany <ruoxuan.yin@citrix.com>
harupy added a commit to mlflow-automation/mlflow that referenced this pull request Dec 24, 2020
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
harupy added a commit to harupy/mlflow that referenced this pull request Dec 24, 2020
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
harupy added a commit that referenced this pull request Dec 24, 2020
* updates

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update UI updates / fixes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Add #3867 in small-changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move #3815 in autologging enhancements

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move #3859 in small changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Classify #3768 as a small bug fix

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move up #3552

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move #3703

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move #3643

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* replace #3815 with #3682

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comments

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comment

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* fix order

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
lorenzwalthert pushed a commit to lorenzwalthert/mlflow that referenced this pull request Jan 15, 2021
* updates

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update UI updates / fixes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Add mlflow#3867 in small-changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3815 in autologging enhancements

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3859 in small changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Classify mlflow#3768 as a small bug fix

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move up mlflow#3552

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3703

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3643

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* replace mlflow#3815 with mlflow#3682

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comments

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comment

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* fix order

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
harupy added a commit to chauhang/mlflow that referenced this pull request Apr 8, 2021
* updates

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update UI updates / fixes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Add mlflow#3867 in small-changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3815 in autologging enhancements

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3859 in small changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Classify mlflow#3768 as a small bug fix

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move up mlflow#3552

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3703

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3643

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* replace mlflow#3815 with mlflow#3682

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comments

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comment

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* fix order

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
harupy added a commit to wamartin-aml/mlflow that referenced this pull request Jun 7, 2021
* updates

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update UI updates / fixes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Add mlflow#3867 in small-changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Update CHANGELOG.rst

Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3815 in autologging enhancements

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3859 in small changes

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Classify mlflow#3768 as a small bug fix

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move up mlflow#3552

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3703

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* move mlflow#3643

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* replace mlflow#3815 with mlflow#3682

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comments

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* Address comment

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* update

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

* fix order

Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: Harutaka Kawamura <hkawamura0130@gmail.com>
Co-authored-by: dbczumar <39497902+dbczumar@users.noreply.github.com>
Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area/tracking Tracking service, tracking client APIs, autologging rn/bug-fix Mention under Bug Fixes in Changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants