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 make_blobs | |
from sklearn.neighbors import NearestNeighbors | |
import matplotlib.pyplot as plt | |
import multiprocessing | |
import numpy as np | |
import time | |
# Set random seed (for reproducibility) | |
np.random.seed(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
import numpy as np | |
from Queue import Queue | |
class HMM: | |
def __init__(self, transition_matrix, observation_matrix, delay, initial_state): | |
self.TM = transition_matrix | |
self.OM = observation_matrix | |
self.delay = delay |
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.datasets import make_blobs | |
from sklearn.preprocessing import StandardScaler | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
# Create and scale dataset | |
X, _ = make_blobs(n_samples=500, centers=2, cluster_std=5.0, random_state=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
import numpy as np | |
from sklearn.datasets import make_blobs | |
from sklearn.preprocessing import StandardScaler | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
# Create and scale dataset | |
X, _ = make_blobs(n_samples=500, centers=2, cluster_std=5.0, random_state=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
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.integrate import odeint | |
# Set random seed (for reproducibility) | |
np.random.seed(1000) | |
# Start and end time (in milliseconds) | |
tmin = 0.0 |
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 keras.backend as K | |
import multiprocessing | |
import tensorflow as tf | |
from gensim.models.word2vec import Word2Vec | |
from keras.callbacks import EarlyStopping | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Flatten | |
from keras.layers.convolutional import Conv1D |
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.cluster import KMeans | |
from sklearn.datasets import make_blobs | |
from sklearn.metrics.pairwise import pairwise_distances | |
import multiprocessing | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
# Generate a dummy dataset |
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 tensorflow as tf | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
nb_users = 5000 | |
nb_products = 2000 | |
nb_factors = 500 | |
max_rating = 5 |
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
''' | |
Mathematical expression learning experiment | |
Giuseppe Bonaccorso (https://www.bonaccorso.eu) | |
Based on: http://machinelearningmastery.com/learn-add-numbers-seq2seq-recurrent-neural-networks/ | |
''' | |
from __future__ import print_function | |
from keras.models import Sequential |
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
''' | |
Cifar-10 classification | |
Original dataset and info: https://www.cs.toronto.edu/~kriz/cifar.html for more information | |
See: https://www.bonaccorso.eu/2016/08/06/cifar-10-image-classification-with-keras-convnet/ for further information | |
''' | |
from __future__ import print_function | |
import numpy as np |