Skip to content

Instantly share code, notes, and snippets.

@liorshk
liorshk / mlflow_gridsearch.py
Created April 22, 2020 15:24
Create MLFlow runs with Sklearn Gridsearch object
def log_run(gridsearch: sklearn.GridSearchCV, experiment_name: str, model_name: str, run_index: int, conda_env, tags={}):
"""Logging of cross validation results to mlflow tracking server
Args:
experiment_name (str): experiment name
model_name (str): Name of the model
run_index (int): Index of the run (in Gridsearch)
conda_env (str): A dictionary that describes the conda environment (MLFlow Format)
tags (dict): Dictionary of extra data and tags (usually features)
@mohit-sinha
mohit-sinha / lgb_bo.py
Created June 27, 2018 11:51
Use this for LightGBM parameter optimisation by Bayesian optimisation.
import pandas as pd;
import numpy as np;
import lightgbm as lgb
from bayes_opt import BayesianOptimization
from sklearn.model_selection import cross_val_score
def lgb_evaluate(
numLeaves,
maxDepth,
scaleWeight,