Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from numpy import where
- from collections import Counter
- from sklearn.datasets import make_blobs
- from matplotlib import pyplot as plt
- X, y = make_blobs(n_samples=1000, centers=2, random_state=1)
- print(X.shape, y.shape)
- counter = Counter(y)
- print(counter)
- for i in range(10):
- print(X[i], y[i])
- for label, _ in counter.items():
- row_ix = where(y==label)[0]
- plt.scatter(X[row_ix, 0], X[row_ix, 1], label=str(label))
- plt.legend()
- plt.show()
- from numpy import where
- from collections import Counter
- from sklearn.datasets import make_blobs
- from matplotlib import pyplot as plt
- X, y = make_blobs(n_samples=1000, centers=3, random_state=1)
- print(X.shape, y.shape)
- counter = Counter(y)
- print(counter)
- for i in range(10):
- print(X[i], y[i])
- for label, _ in counter.items():
- row_ix = where(y==label)[0]
- plt.scatter(X[row_ix, 0], X[row_ix, 1], label=str(label))
- plt.legend()
- plt.show()
- import pandas as pd
- import numpy as np
- from matplotlib import pyplot as plt
- from sklearn.linear_model import LinearRegression
- hgt = np.random.randint(50,70,10).reshape(-1,1)
- wgt = np.random.randint(90,120,10).reshape(-1,1)
- regression = LinearRegression()
- regression.fit(hgt,wgt)
- regression.predict([[60]])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement