Skip to main content

Term Deposit Prediction with MLflow and scikit-learn

Tune a term deposit model with GridSearchCV and see every candidate in MLflow: one parent run, a child run for each of the best, and an honest test score.

  • Python
  • uv
  • MLflow
  • scikit-learn
  • pandas

Screenshots

Screenshot 1 of 4: Title card: Term Deposit Prediction, Python source code for MLflow, with its stack and a terminal where the search tries 9 candidates and the best scores a test ROC AUC of 0.8145.

Title card: Term Deposit Prediction, Python source code for MLflow, with its stack and a terminal where the search tries 9 candidates and the best scores a test ROC AUC of 0.8145.

One-off price

  • ₹149+ GST, ₹175.82 in total
  • $3
  • Download it from your library as soon as your payment is confirmed.
  • Every later release of this project is included, at no extra cost.
Latest release
1.0.0 · Nov 28, 2026

Overview

The complete source code of a hyperparameter search in Python, recorded by MLflow 3.18 autologging. One command tries 9 combinations of settings for a gradient-boosted model, scores each with 5-fold cross-validation, files the 5 best as child runs under one parent run, and scores the winner on customers the search never saw.

Hyperparameter searches produce dozens of numbers and very little memory. Term Deposit Prediction with MLflow and scikit-learn runs a scikit-learn grid search on the public Bank Marketing data and lets MLflow autologging keep every candidate, so you can see why the winner won.

What one search records

  • The parent run. The search's own settings, the best settings, the best cross-validation score, the full results of every candidate on every fold as cv_results.csv, and plots of the best model's confusion matrix, ROC curve and precision-recall curve on its training data.
  • A child run per candidate. The 5 best candidates get a run each, with their settings and their mean, spread and rank across the folds.
  • An honest score. 20% of the calls are kept out of the search, and the winner is scored on them: a test ROC AUC of 0.8145 in the first search.
  • The code behind it. The Git commit of the code that ran the search.

A model that could really be used

  • No leakage. The dataset's call length is left out, because it isn't known until the call is over.
  • A clean pipeline. Text columns are one-hot encoded and a HistGradientBoostingClassifier predicts, in one scikit-learn pipeline.
  • A checked download. The data is downloaded once and its SHA-256 fingerprint checked before it's read.

Code you can build on

  • A clean Python package. A src layout managed by uv, with one command: tune.
  • Settings in one place. pydantic-settings reads .env, and .env.example documents every setting.
  • Exact versions. uv.lock pins every package: MLflow 3.18.0, scikit-learn 1.9.1, pandas 3.1.1 and Python 3.15.
  • No data in the archive. The project downloads the public dataset on the first run.

What it doesn't include

  • No saved model. The search is about choosing settings, so autologging doesn't save models.
  • No hosting. It runs on your own computer, against an MLflow tracking server you start in one command.
  • No test project. The results above come from real runs, not from automated tests in the archive.

Run it in six steps

  1. Unzip the archive.
  2. Start an MLflow tracking server.
  3. Copy .env.example to .env.
  4. Install the packages with uv sync.
  5. Put the project in Git.
  6. Search with uv run tune.

The README has every command, for macOS and Linux and for PowerShell. How to Set Up and Run the Term Deposit Prediction Project (opens in a new tab) shows each step with what it should print. It was tested from a clean copy of the archive on macOS.

Learn how it was built

Part 5 of the free tutorial series MLflow Tutorial for Machine Learning in Python (opens in a new tab) explains autologging, nested runs and hyperparameter tuning, using this code.

Free tutorial series

MLflow Tutorial for Machine Learning in Python

Prefer to learn by building it? This free, step-by-step guide on our blog shows how the project is made.

Read the series (opens in a new tab)

What you get

Everything in the archive, at a glance.

  • Version 1.0.0 of the complete source code: a Python package managed by uv
  • The tune command: a grid search over 9 combinations of settings with 5-fold cross-validation
  • MLflow autologging of the search as a parent run with a child run for each of the best candidates
  • The best model's ROC AUC on test data the search never sees, logged on the parent run
  • A scikit-learn pipeline that one-hot encodes the text columns before a gradient-boosted classifier
  • A checked download of the public Bank Marketing data, with the call length left out
  • Settings in .env through pydantic-settings, with a documented .env.example
  • uv.lock with the exact version of every package
  • A README with the setup for macOS, Linux and PowerShell, the search, every setting and the dataset's credit

Built with

The exact runtimes and versions it was built and tested against.

  • Python3.15.2
  • uv0.13.10
  • MLflow3.18.0
  • scikit-learn1.9.1
  • pandas3.1.1
  • NumPy2.5.5
  • pydantic-settings2.16.3

What is in the archive

The file tree you get once you unzip it.

term-deposit-prediction-mlflow-scikit-learn/

  • src/
    • term_deposit_prediction/
      • __init__.py
      • code_version.py
      • config.py
      • data.py
      • model.py
      • tune.py
  • .env.example
  • .gitignore
  • .python-version
  • pyproject.toml
  • uv.lock
  • README.md

What it needs from you

The accounts and services it expects to find, so nothing is a surprise.

  • uv, which installs Python 3.15 and the packages for you
  • Git, so each run records the commit of its code
  • An MLflow tracking server: the README starts one on your computer in one command
  • An internet connection for the first install, about 550 MB of packages, and the first search, which downloads the data

Releases

Every version so far, newest first.

  1. 1.0.0Latest

    First release of the complete source code.

    • Runs a grid search over 9 combinations of settings for a gradient-boosted classifier on the Bank Marketing data.
    • Records the search with MLflow 3.18.0 autologging: one parent run, and a child run for each of the 5 best candidates.
    • Scores the best model on test data the search never sees.
    • Includes a README that takes you from the archive to your first recorded search.

Source Code Licence

What you may do with it

What you may and may not do with the source code you buy.

Read the full licence
  1. What this licence covers

This licence governs every file included in a product you buy from Dewiride Store: source code, configuration, database scripts, sample data, documentation and any other file in the download. It takes effect when your payment is confirmed and applies to every release of that product that reaches your library. Files that reach your library through an annual updates membership are governed in exactly the same way.

It forms part of the Terms of Sale and Use. Where a product page states different or additional licence terms for that product, those terms prevail for that product. The membership page may likewise state different or additional licence terms for the files a membership carries, and those terms then prevail for those files.

  1. The licence we grant you

We grant you a perpetual, worldwide, non-exclusive, non-transferable licence to use, reproduce, adapt, translate and modify the files, and to include the result in your own work, on the conditions set out below.

Perpetual means it does not expire. Worldwide means it is not limited to any country. Non-exclusive means we license the same product to other customers. Non-transferable means you cannot pass it on to someone else.

The licence is granted to you — either you personally, or the organisation you identified when buying. Everyone working within that organisation may use the files for that organisation’s projects. Nobody outside it may.

  1. What you may do
  • Use and change the files in your own projects, commercial or otherwise, with no limit on the number of projects.
  • Build a product or a service on them and charge your own customers for it.
  • Deploy the result for a client, as part of work you are doing for that client.
  • Distribute the result in compiled, deployed or otherwise non-source form.
  • Keep as many back-up copies as you reasonably need.
  • Study, observe and test how the code works, and obtain the information you need to make it work with your own software.

The last two are yours by law under sections 52(1)(aa) to (ac) of the Indian Copyright Act, 1957, and nothing in this licence is intended to take them away.

  1. What you may not do
  • Resell, sublicense, redistribute or publish the files themselves, in whole or in substantial part, in source form.
  • Include them in a template, starter kit, course, tutorial repository or component library that you sell or give away, where the code is the thing being supplied.
  • Share your account, your download links or your invoices with anyone outside your organisation.
  • Publish the files in a public repository, or in any other place where they can be obtained without buying them.
  • Remove or obscure the copyright and attribution notices in the source files.
  • Use the files to build something whose main purpose is to compete with Dewiride Store as a supplier of the same code.

The distinction that matters is simple: you may sell what you build with the code; you may not sell the code.

  1. Third-party components

Our products depend on open-source libraries, frameworks and services that we did not write. Those remain under their own licences, which we do not and cannot change. Where a product includes or requires such a component, its licence is named in the product’s documentation, and complying with it is your responsibility.

  1. Releases

Every release of a product you own is covered by this same licence and appears in your library at no extra cost. A release you have already downloaded remains licensed to you even if we later stop publishing the product. A release that reached your library through an annual updates membership is licensed to you on these same terms, and stays licensed after the period that carried it has ended.

  1. Ownership

We keep ownership of the files and of the copyright in them. You own whatever you create with them: your changes, your additions and the product you build are yours.

  1. If this licence ends

This licence ends if you materially breach it and do not put the breach right within thirty days of us asking you to in writing. It also ends if your payment is reversed or refunded, because the purchase it depends on no longer stands. Where a membership period is refunded or reversed, the licence ends for the releases that period carried and for nothing else: anything you bought separately, or that another period carried, is unaffected.

If it ends, you must stop using the files and delete the copies you hold. Work you had already delivered to a client before that point may continue in use, so that ending this licence never breaks something your own customer relies on.

  1. No warranty beyond the description

The warranties and limits in section 19 and section 20 of the Terms of Sale and Use apply to this licence as well.

  1. Governing law

This licence is governed by the law of India, and section 24 of the Terms of Sale and Use applies to any dispute about it. If a translation and the English version differ in meaning, the English version governs.