Pular para o conteúdo principal

Term Deposit Prediction with MLflow and scikit-learn

Ajuste um modelo de depósito a prazo com GridSearchCV e veja cada candidato no MLflow: uma execução pai, uma execução filha para cada um dos melhores e uma nota honesta.

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

Capturas de tela

Captura 1 de 4: Capa: Term Deposit Prediction, código-fonte em Python para MLflow, com a stack e um terminal em que a busca testa 9 candidatos e o melhor tem ROC AUC de teste de 0,8145.

Capa: Term Deposit Prediction, código-fonte em Python para MLflow, com a stack e um terminal em que a busca testa 9 candidatos e o melhor tem ROC AUC de teste de 0,8145.

Pagamento único

  • ₹ 149+ GST, ₹ 175,82 no total
  • US$ 3
  • Baixe na sua biblioteca assim que o pagamento for confirmado.
  • Todas as versões futuras deste projeto estão incluídas, sem custo adicional.
Versão mais recente
1.0.0 · 28 de nov. de 2026

Visão geral

O código-fonte completo de uma busca de hiperparâmetros em Python, registrada pelo autologging do MLflow 3.18. Um comando testa 9 combinações de configurações de um modelo de gradient boosting, avalia cada uma com validação cruzada de 5 partes, guarda as 5 melhores como execuções filhas de uma execução pai e avalia a vencedora com clientes que a busca nunca viu.

Buscas de hiperparâmetros geram dezenas de números e quase nenhuma memória. Term Deposit Prediction with MLflow and scikit-learn executa uma busca em grade do scikit-learn com os dados públicos do Bank Marketing e deixa o autologging do MLflow guardar cada candidato, para você ver por que o vencedor venceu.

O que uma busca registra

  • A execução pai. As configurações da própria busca, as melhores configurações, a melhor nota de validação cruzada, os resultados completos de cada candidato em cada parte em cv_results.csv, e gráficos da matriz de confusão, da curva ROC e da curva de precisão e recall do melhor modelo nos dados de treino.
  • Uma execução filha por candidato. Os 5 melhores candidatos ganham uma execução cada, com suas configurações e sua média, dispersão e posição entre as partes.
  • Uma nota honesta. 20% das ligações ficam fora da busca, e o vencedor é avaliado nelas: um ROC AUC de teste de 0,8145 na primeira busca.
  • O código por trás. O commit do Git do código que executou a busca.

Um modelo que poderia mesmo ser usado

  • Sem vazamento. A duração da ligação fica de fora, porque só é conhecida quando a ligação termina.
  • Um pipeline limpo. As colunas de texto passam por one-hot encoding e um HistGradientBoostingClassifier faz a previsão, em um único pipeline do scikit-learn.
  • Um download verificado. Os dados são baixados uma vez e têm a impressão SHA-256 conferida antes da leitura.

Código para você construir em cima

  • Um pacote Python limpo. Uma estrutura src gerenciada com uv, com um comando: tune.
  • Configurações em um só lugar. O pydantic-settings lê o .env, e o .env.example documenta cada configuração.
  • Versões exatas. O uv.lock fixa cada pacote: MLflow 3.18.0, scikit-learn 1.9.1, pandas 3.1.1 e Python 3.15.
  • Nenhum dado no arquivo. O projeto baixa o dataset público na primeira execução.

O que não está incluído

  • Nenhum modelo salvo. A busca serve para escolher configurações, então o autologging não salva modelos.
  • Sem hospedagem. Roda no seu próprio computador, com um servidor de rastreamento do MLflow que você inicia com um comando.
  • Sem projeto de testes. Os resultados acima vêm de execuções reais, não de testes automatizados no arquivo.

Rode em seis etapas

  1. Descompacte o arquivo.
  2. Inicie um servidor de rastreamento do MLflow.
  3. Copie .env.example para .env.
  4. Instale os pacotes com uv sync.
  5. Coloque o projeto no Git.
  6. Faça a busca com uv run tune.

O README tem todos os comandos, para macOS e Linux e para PowerShell. How to Set Up and Run the Term Deposit Prediction Project (abre em uma nova aba) (em inglês) mostra cada etapa com o que ela deve exibir. Foi testado a partir de uma cópia limpa do arquivo no macOS.

Como ele foi construído

A parte 5 da série gratuita de tutoriais MLflow Tutorial for Machine Learning in Python (abre em uma nova aba) (em inglês) explica o autologging, as execuções aninhadas e o ajuste de hiperparâmetros, usando este código.

Série de tutoriais gratuita

MLflow Tutorial for Machine Learning in Python

Prefere aprender construindo? Este guia gratuito e passo a passo no nosso blog mostra como o projeto é feito.

Ler a série (abre em uma nova aba)

O que você leva

Tudo o que está no arquivo, em um relance.

  • Versão 1.0.0 do código-fonte completo: um pacote Python gerenciado com uv
  • O comando tune: uma busca em grade de 9 combinações de configurações com validação cruzada de 5 partes
  • Autologging do MLflow da busca como uma execução pai com uma execução filha para cada um dos melhores candidatos
  • O ROC AUC do melhor modelo em dados de teste que a busca nunca vê, registrado na execução pai
  • Um pipeline do scikit-learn que aplica one-hot encoding às colunas de texto antes de um classificador de gradient boosting
  • Um download verificado dos dados públicos do Bank Marketing, sem a duração da ligação
  • Configurações no .env com pydantic-settings e um .env.example documentado
  • uv.lock com a versão exata de cada pacote
  • Um README com a instalação para macOS, Linux e PowerShell, a busca, cada configuração e o crédito do dataset

Feito com

As versões e os ambientes exatos com que foi criado e testado.

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

O que há no arquivo

A árvore de pastas que você recebe ao descompactar.

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

O que ele precisa de você

As contas e os serviços que ele espera encontrar, para nada surpreender.

  • uv, que instala o Python 3.15 e os pacotes para você
  • Git, para que cada execução registre o commit do seu código
  • Um servidor de rastreamento do MLflow: o README inicia um no seu computador com um comando
  • Conexão com a internet para a primeira instalação, cerca de 550 MB de pacotes, e a primeira busca, que baixa os dados

Versões

Todas as versões até agora, da mais recente para a mais antiga.

  1. 1.0.0Mais recente

    Primeira versão do código-fonte completo.

    • Executa uma busca em grade de 9 combinações de configurações para um classificador de gradient boosting com os dados do Bank Marketing.
    • Registra a busca com o autologging do MLflow 3.18.0: uma execução pai e uma execução filha para cada um dos 5 melhores candidatos.
    • Avalia o melhor modelo em dados de teste que a busca nunca vê.
    • Inclui um README que leva você do arquivo à sua primeira busca registrada.

Source Code Licence

O que você pode fazer com ele

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

Ler a licença completa
  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.