Skip to content

Instantly share code, notes, and snippets.

Andreas Mueller amueller

Block or report user

Report or block amueller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@amueller
amueller / commits.py
Created Oct 26, 2018
list recent commits by author
View commits.py
from github import Github
gh = Github("SECRETKEY")
rep = gh.get_repo("scikit-learn/scikit-learn")
org = gh.get_organization("scikit-learn")
org_members = list(org.get_members())
import datetime
n_commits = {}
limit = datetime.datetime(2017, 1, 1)
@amueller
amueller / parsing_in_preparation.ipynb
Created Sep 28, 2018
parsing in preparation datasets on openml
View parsing_in_preparation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View student_groups.py
import cvxpy as cvx
n_students = 130
n_projects = 30
assignment = cvx.Int(rows=n_students, cols=n_projects)
import numpy as np
rng = np.random.RandomState(0)
project_preferences = rng.rand(n_students, n_projects)
View tree_plotting.py
import numpy as np
from numbers import Integral
from sklearn.externals import six
from sklearn.tree.export import _color_brew, _criterion, _tree
def plot_tree(decision_tree, max_depth=None, feature_names=None,
class_names=None, label='all', filled=False,
leaves_parallel=False, impurity=True, node_ids=False,
@amueller
amueller / bench_feat_agg.py
Created Oct 27, 2017
bench feature agglomeration
View bench_feat_agg.py
"""
Benchmarks np.bincount method vs np.mean for feature agglomeration in
../sklearn/cluster/_feature_agglomeration. Use of np.bincount provides
a significant speed up if the pooling function is np.mean.
np.bincount performs better especially as the size of X and n_clusters
increase.
"""
import matplotlib.pyplot as plt
import numpy as np
View printer.py
class Formatter(object):
def __init__(self, indent_est='step'):
self.indent_est = indent_est
self.types = {}
self.htchar = ' '
self.lfchar = '\n'
self.indent = 0
self.step = 4
self.width = 79
self.set_formater(object, self.__class__.format_object)
View constant_values.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View curving.py
import numpy as np
import matplotlib.pyplot as plt
class Curve(object):
def __init__(self, scores, to="B+", std_adjust=0):
self.to = to
self.scores = scores
self.letters = ["A+", "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D", "F"]
idx = self.letters.index(to)
# +3 is because we do D and F manually
@amueller
amueller / abomination.py
Created Jul 28, 2016
binary operators on all estimators
View abomination.py
from sklearn.base import BaseEstimator
def piper(self, other):
from sklearn.pipeline import make_pipeline, Pipeline
if isinstance(self, Pipeline):
steps = ([estimator for (name, estimator) in self.steps] + [other])
return make_pipeline(*steps)
else:
return make_pipeline(self, other)
@amueller
amueller / colormap_extraction.py
Last active Apr 27, 2016
extract colormap from an image
View colormap_extraction.py
from colorspacious import cspace_convert
from scipy.sparse.csgraph import minimum_spanning_tree
from sklearn.metrics import euclidean_distances
import scipy.sparse as sp
from colorspacious import cspace_convert
from scipy.sparse.csgraph import minimum_spanning_tree
from sklearn.metrics import euclidean_distances
import scipy.sparse as sp
You can’t perform that action at this time.