This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_digits | |
from sklearn.svm import SVC | |
from sklearn.utils import shuffle | |
from sklearn.metrics import zero_one_score | |
import numpy as np | |
digits = load_digits() | |
X, y = shuffle(digits.data, digits.target) | |
X_train, X_test = X[:1000, :], X[1000:, :] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import datasets, manifold | |
from sklearn.neighbors import NearestNeighbors | |
import numpy as np | |
n_points = 1000 | |
n_neighbors = 10 | |
out_dim = 2 | |
n_trials = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from IPython.parallel import Client | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.cross_validation import KFold | |
from sklearn.svm import SVC | |
from sklearn import datasets | |
from sklearn.preprocessing import Scaler | |
from sklearn.utils import shuffle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.stats | |
class ChineseRestaurantProcess(object): | |
def __init__(self, alpha): | |
self.alpha = alpha | |
self.customers = [] | |
def sample(self, n_samples=1): | |
samples = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import warnings | |
from itertools import cycle, izip | |
from sklearn.utils import gen_even_slices | |
from sklearn.utils import shuffle | |
from sklearn.base import BaseEstimator | |
from sklearn.base import ClassifierMixin | |
from sklearn.preprocessing import LabelBinarizer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn import datasets | |
from sklearn.cross_validation import ShuffleSplit | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.svm import SVC | |
from sklearn.preprocessing import Scaler | |
#data = datasets.load_digits() | |
data = datasets.fetch_mldata("usps") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.svm import LinearSVC | |
from sklearn.cross_validation import ShuffleSplit | |
from sklearn.grid_search import GridSearchCV | |
from sklearn import datasets | |
n_samples = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.cross_validation import StratifiedKFold | |
from sklearn.datasets import load_iris | |
from sklearn.svm import LinearSVC | |
iris = load_iris() | |
X, y = iris.data, iris.target | |
cv = StratifiedKFold(y, 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import fetch_mldata | |
from sklearn.decomposition import FastICA, PCA | |
from sklearn.cluster import KMeans | |
# fetch natural image patches | |
image_patches = fetch_mldata("natural scenes data") | |
X = image_patches.data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.grid_search import GridSearchCV | |
from sklearn.cross_validation import StratifiedKFold | |
def main(): | |
mnist = fetch_mldata("MNIST original") | |
X_all, y_all = mnist.data/255., mnist.target | |
print("scaling") | |
X = X_all[:60000, :] | |
y = y_all[:60000] |
OlderNewer