This file contains 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 pylab import plt | |
import numpy as np | |
def f(x): | |
return 3 * x ** 3 - 4 * x ** 2 | |
x = np.linspace(-2, 4, 25) | |
y = f(x) |
This file contains 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 pylab import plt | |
import numpy as np | |
def f(x): | |
return 3 * x ** 3 - 4 * x ** 2 | |
x = np.linspace(-2, 4, 25) | |
y = f(x) |
This file contains 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 pylab import plt | |
import numpy as np | |
def f(x): | |
return 3 * x ** 3 - 4 * x ** 2 | |
x = np.linspace(-2, 4, 25) | |
y = f(x) |
This file contains 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 | |
ssp = [1, 1, 1, 1, 0] | |
def epoch(): | |
asp = [1, 0] | |
tr = 0 | |
for _ in range(100): | |
a = np.random.choice(asp) | |
s = np.random.choice(ssp) | |
if a == s: |
This file contains 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 pylab import plt, mpl | |
from sklearn.cluster import KMeans | |
from sklearn.datasets import make_blobs | |
x, y = make_blobs(n_samples=200, centers=5, | |
random_state=500, cluster_std=1.25) | |
model = KMeans(n_clusters=5, random_state=0) | |
model.fit(x) | |
KMeans(n_clusters=5, random_state=0) |