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 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
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 | |
import tensorflow as tf | |
from sklearn.datasets import make_blobs | |
# Set random seed (for reproducibility) | |
np.random.seed(1000) | |
# Create dataset | |
nb_samples=2000 |
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 scipy.sparse import dok_matrix | |
from sklearn.metrics.pairwise import pairwise_distances | |
import numpy as np | |
# Set random seed (for reproducibility) | |
np.random.seed(1000) | |
# Create a dummy user-item dataset | |
nb_users = 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.datasets import make_classification | |
import numpy as np | |
# Set random seed (for reproducibility) | |
np.random.seed(1000) | |
def sigmoid(arg): | |
return 1.0 / (1.0 + np.exp(-arg)) |
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 | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
nb_patterns = 4 | |
pattern_width = 4 | |
pattern_height = 4 | |
max_iterations = 10 |
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 | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
nb_patterns = 4 | |
pattern_width = 4 | |
pattern_height = 4 | |
max_iterations = 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
from sklearn.datasets import load_digits | |
import numpy as np | |
# Set random seed for reproducibility | |
np.random.seed(1000) | |
# Load MNIST dataset | |
X, Y = load_digits(return_X_y=True) | |
X /= 255.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 numpy as np | |
from sklearn.datasets import make_classification | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.model_selection import train_test_split | |
# Set random seed (for reproducibility) | |
np.random.seed(1000) | |
nb_samples = 5000 |