I hereby claim:
- I am briverse17 on github.
- I am briverse17 (https://keybase.io/briverse17) on keybase.
- I have a public key ASClqICkmZWZzzb0EGXAf22qkhszbwGm45mQ6FchnmLmJgo
To claim this, I am signing this object:
DOWNLOAD_DIR="/tmp" | |
DOWNLOAD_URL="https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64" | |
echo "Getting stable VSCode .deb distribution" | |
wget -q --show-progress -nc -O "$DOWNLOAD_DIR/code_stable.deb" "$DOWNLOAD_URL" | |
if [ -f "$DOWNLOAD_DIR/code_stable.deb" ]; then | |
echo "Installing stable VSCode" | |
apt install "$DOWNLOAD_DIR/code_stable.deb/" | |
echo "Cleaning up..." |
I hereby claim:
To claim this, I am signing this object:
def isConverged(self, new_medoids): | |
return set([tuple(x) for x in self.medoids]) == set([tuple(x) for x in new_medoids]) |
new_medoids = [] | |
for i in range(0, self.k): | |
new_medoid = self.medoids[i] | |
old_medoids_cost = self.medoids_cost[i] | |
for j in range(len(clusters[i])): | |
#Cost of the current data points to be compared with the current optimal cost | |
cur_medoids_cost = 0 | |
for dpoint_index in range(len(clusters[i])): | |
cur_medoids_cost += euclideanDistance(clusters[i][j], clusters[i][dpoint_index]) |
for i in range(self.max_iter): | |
#Labels for this iteration | |
cur_labels = [] | |
for medoid in range(0,self.k): | |
#Dissimilarity cost of the current cluster | |
self.medoids_cost[medoid] = 0 | |
for k in range(len(X)): | |
#Distances from a data point to each of the medoids | |
d_list = [] | |
for j in range(0,self.k): |
def initMedoids(self, X): | |
''' | |
Parameters | |
---------- | |
X: input data. | |
''' | |
self.medoids = [] | |
#Starting medoids will be random members from data set X | |
indexes = np.random.randint(0, len(X)-1,self.k) |
class k_medoids: | |
def __init__(self, k = 2, max_iter = 300, has_converged = False): | |
''' | |
Class constructor | |
Parameters | |
---------- | |
- k: number of clusters. | |
- max_iter: number of times centroids will move | |
- has_converged: to check if the algorithm stop or not | |
''' |
class k_medoids: | |
def __init__(self, k = 2, max_iter = 300, has_converged = False): | |
''' | |
Class constructor | |
Parameters | |
---------- | |
- k: number of clusters. | |
- max_iter: number of times centroids will move | |
- has_converged: to check if the algorithm stop or not | |
''' |