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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the code of quickstart 2 - hyperparam search #10344

Merged
merged 4 commits into from Dec 4, 2023

Conversation

chenmoneygithub
Copy link
Collaborator

@chenmoneygithub chenmoneygithub commented Nov 9, 2023

馃洜 DevTools 馃洜

Open in GitHub Codespaces

Install mlflow from this PR

pip install git+https://github.com/mlflow/mlflow.git@refs/pull/10344/merge

Checkout with GitHub CLI

gh pr checkout 10344

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

A few improvements, mostly centered around code part:

  • Refactor the Keras code to be compatible with Keras best practice.
  • Reduce the workload of the script, e.g., less epoch.
  • Break long sentences into multiple lines.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

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/gateway: AI Gateway service, Gateway client APIs, third-party Gateway integrations
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/recipes: Recipes, Recipe APIs, Recipe configs, Recipe Templates
  • area/projects: MLproject format, project running backends
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/server-infra: MLflow Tracking server backend
  • area/tracking: Tracking Service, tracking client APIs, autologging

Interface

  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • 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/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/breaking-change - The PR will be mentioned in the "Breaking Changes" 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

Copy link

github-actions bot commented Nov 9, 2023

Documentation preview for b22b208 will be available here when this CircleCI job completes successfully.

More info

@github-actions github-actions bot added the rn/documentation Mention under Documentation Changes in Changelogs. label Nov 9, 2023
Copy link
Collaborator

@jessechancy jessechancy left a comment

Choose a reason for hiding this comment

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

Looks good, just have some comments about cleaning up

@@ -24,16 +27,18 @@ Set up
------

- Install MLflow. See the :ref:`introductory quickstart <quickstart-1>` for instructions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to display :ref: to the user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yea, that's a weird sphinx stuff

@@ -76,68 +79,79 @@ Now load the dataset and split it into training, validation, and test sets.
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't part of this change, but I was wondering if we should do this cleaner?

  1. Split the data into input and label first before running the splitting instead of in the middle
  2. Or shuffle and split manually based on a predefined split percentage (60,15,25 etc.) instead of using two train_test_splits since in this case the proportion of the dataset allocated to each is not immediately apparent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed, it would be more clear

# Evaluate the model
predicted_qualities = model.predict(test_x)
rmse = np.sqrt(mean_squared_error(test_y, predicted_qualities))
eval_result = model.evaluate(test_x, test_y, batch_size=64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for hyperparameter tuning, we shouldn't encourage the user to optimize the objective function in relation to the test dataset, but rather the validation dataset. Optimizing on the test dataset is in some sense polluting the results of testing

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can optionally use the test data at the end of optimization to see how well the 'best' model actually does

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

very good call, fixed

.. image:: ../../_static/images/quickstart_mlops/mlflow_registry_transitions.png
:width: 800px
:align: center
:alt: Screenshot of MLflow tracking UI models page showing the registered model
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this image is not rendering

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nice catch

(Note that specifying the port as above will be necessary if you are running the tracking server on the
same machine at the default port of **5000**.)

You could also have used a ``runs:/<run_id>`` URI to serve a model, or any supported URI described in :ref:`artifact-stores`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this :ref: is also rendered to the user, not sure if we want that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

on the website that will be correct, the md preview is not working 100% well with sphinx.

Signed-off-by: chenmoneygithub <chen.qian@databricks.com>
Signed-off-by: chenmoneygithub <chen.qian@databricks.com>
Signed-off-by: chenmoneygithub <chen.qian@databricks.com>
Signed-off-by: chenmoneygithub <chen.qian@databricks.com>
Transition the model to **Staging** by choosing the **Stage** dropdown:

.. image:: ../../_static/images/quickstart_mlops/register_model_button.png
:width: 800px
Copy link
Member

Choose a reason for hiding this comment

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

Can we set this to a percentage value? 70% at full screen will render this to roughly what 800px would be. Fixed width sizes have issues with screen resizing.

@chenmoneygithub chenmoneygithub merged commit 36c3572 into mlflow:master Dec 4, 2023
54 checks passed
@chenmoneygithub chenmoneygithub deleted the better-quickstart-2 branch January 2, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn/documentation Mention under Documentation Changes in Changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants