Skip to content

Instantly share code, notes, and snippets.

View rth's full-sized avatar

Roman Yurchak rth

View GitHub Profile
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid2
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
from matplotlib.offsetbox import AnchoredOffsetbox
class AnchoredScaleBar(AnchoredOffsetbox):
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
pad=0.1, borderpad=0.1, sep=2, prop=None, **kwargs):
"""
@rth
rth / supervised_tf.py
Created February 26, 2019 16:31 — forked from larsmans/supervised_tf.py
Supervised tf (tf-chi², tf-rf) for scikit-learn
import numpy as np
#from scipy.special import chdtrc
from scipy.sparse import spdiags
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import LabelBinarizer
def _chisquare(f_obs, f_exp, reduce):
"""Replacement for scipy.stats.chisquare with custom reduction.
@rth
rth / SanFrancisco.Neighborhoods.json
Created May 21, 2020 12:59 — forked from cdolek/SanFrancisco.Neighborhoods.json
San Francisco Neighborhoods GeoJson with Zipcodes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.