Skip to content

Instantly share code, notes, and snippets.

View walterreade's full-sized avatar

Walter Reade walterreade

View GitHub Profile
@dsal1951
dsal1951 / Calculate Model Lift
Created July 4, 2016 05:53
Data needed for a Lift chart (aka Gains chart) for a predictive model created using Sklearn and Matplotlib
def calc_lift(x,y,clf,bins=10):
"""
Takes input arrays and trained SkLearn Classifier and returns a Pandas
DataFrame with the average lift generated by the model in each bin
Parameters
-------------------
x: Numpy array or Pandas Dataframe with shape = [n_samples, n_features]
y: A 1-d Numpy array or Pandas Series with shape = [n_samples]
@mesgarpour
mesgarpour / YeoJohnson.py
Last active October 13, 2022 11:53
Yeo-Johnson Transformation
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import warnings
import numpy as np
import pandas as pd
import sys
__author__ = "Mohsen Mesgarpour"
__copyright__ = "Copyright 2016, https://github.com/mesgarpour"
__credits__ = ["Mohsen Mesgarpour"]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kingjr
kingjr / hinge_vs_loss.py
Last active August 25, 2020 01:47
Illustrate how SVM and Logistic Regression are very similar except that SVM strictly relies on a subset of the data.
# Author: Jean-Remi King <jeanremi.king@gmail.com>
"""
Illustrate how a hinge loss and a log loss functions
typically used in SVM and Logistic Regression
respectively focus on a variable number of samples.
For simplification purposes, we won't consider the
regularization or penalty (C) factors.
"""
import numpy as np
import matplotlib.animation as animation
@mblondel
mblondel / seminb.py
Created October 28, 2015 12:50
Semi-supervised Naive Bayes
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Mathieu Blondel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@baraldilorenzo
baraldilorenzo / readme.md
Last active November 21, 2023 22:41
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A short tutorial on pandas MultiIndexing with DataFrames"
]
},
{