Skip to content

Instantly share code, notes, and snippets.

View amueller's full-sized avatar

Andreas Mueller amueller

View GitHub Profile
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_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
@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]
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
@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 / find_param_names.py
Created October 7, 2012 20:06
find parameter names for sklearn estimators
from sklearn.utils.testing import all_estimators
import numpy as np
all_objects = []
for C in all_estimators():
try:
all_objects.append(C[1]())
except:
pass
params = [c.get_params().keys() for c in all_objects]
@amueller
amueller / digits_video.py
Created October 5, 2012 19:13
Visualization of iris and digits datasets via random projections
# (c) 2012 Andreas Mueller [email protected]
# License: BSD 2-Clause
#
# See my blog for details: http://peekaboo-vision.blogspot.com
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
@amueller
amueller / weird.npy
Created September 20, 2012 12:02
elliptic_envelope problem
blub
@amueller
amueller / chi2_p_value.py
Created September 4, 2012 14:46
chi2_p_value
import numpy as np
from sklearn.feature_selection import chi2
data = np.load("values.npy")
labels = np.load("labels.npy")
print(chi2(data, labels))