Skip to content

Instantly share code, notes, and snippets.

View amueller's full-sized avatar

Andreas Mueller amueller

View GitHub Profile
@amueller
amueller / ml_with_sklearn_notebook.ipynb
Created October 29, 2012 15:55
Teaser on machine learning with scikit-learn
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amueller
amueller / mnist_kernel_approximation.py
Created November 27, 2012 19:41
mnist kernel approximation
# Standard scientific Python imports
import pylab as pl
import numpy as np
from time import time
# Import datasets, classifiers and performance metrics
from sklearn import datasets, svm, pipeline
from sklearn.kernel_approximation import (RBFSampler,
Nystroem)
from sklearn.utils import shuffle
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amueller
amueller / gist:4299381
Created December 15, 2012 21:26
Plotting PCAs of pairs of MNIST digit classes
import numpy as np
import matplotlib.pyplot as plt
from itertools import product
from sklearn.decomposition import RandomizedPCA
from sklearn.datasets import fetch_mldata
from sklearn.utils import shuffle
mnist = fetch_mldata("MNIST original")
X_train, y_train = mnist.data[:60000] / 255., mnist.target[:60000]
@amueller
amueller / mnist_kernel_approx.py
Last active December 11, 2020 14:31
Comparing Nystroem and Fourier feature based kernel approximation on MNIST
# Standard scientific Python imports
import pylab as pl
import numpy as np
from time import time
# Import datasets, classifiers and performance metrics
from sklearn import datasets, svm, pipeline
from sklearn.kernel_approximation import (RBFSampler,
Nystroem)
from sklearn.utils import shuffle
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@amueller
amueller / regressions.txt
Last active December 11, 2015 01:38
regressions in 0.13-git
======================================================================
FAIL: Check that oob prediction is as acurate as
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/andy/sklearn_tests/sklearn/ensemble/tests/test_forest.py", line 198, in test_oob_score_classification
assert_almost_equal(training_score, clf.oob_score_)
File "/usr/lib/python2.7/dist-packages/numpy/testing/utils.py", line 468, in assert_almost_equal
raise AssertionError(msg)
@amueller
amueller / msrc_svm.py
Created January 15, 2013 19:10
Linear SVM on Aurelien's MSRC features
import os
from glob import glob
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import LinearSVC
from sklearn.metrics import accuracy_score, confusion_matrix
@amueller
amueller / Diagram1.dia
Last active August 18, 2022 05:03
Machine learning cheat sheet diagram svg and dia file
@amueller
amueller / km_test.py
Last active December 14, 2015 05:18
simple kmeans test with n_jobs=2
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
X, y = make_blobs()
KMeans(n_jobs=2).fit(X)
print("done")