Commit
·
3392fee
1
Parent(s):
510d97a
Update ser.py
Browse files
ser.py
CHANGED
|
@@ -15,9 +15,23 @@ class SearchMood:
|
|
| 15 |
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
def embedings(self, samplex, sampley):
|
| 19 |
emb = self.embeding(samplex, sampley)
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
return(similarity)
|
| 22 |
|
| 23 |
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def Hierarchical(self, data):
|
| 21 |
+
# Load the data.
|
| 22 |
+
|
| 23 |
+
# Perform hierarchical clustering.
|
| 24 |
+
clusters, distances = hierarchical(data, distance='cosine', linkage='complete', return_clusters=True)
|
| 25 |
+
|
| 26 |
+
# Print the cluster labels.
|
| 27 |
+
print(clusters)
|
| 28 |
+
|
| 29 |
def embedings(self, samplex, sampley):
|
| 30 |
emb = self.embeding(samplex, sampley)
|
| 31 |
+
embHx = self.Hierarchical(emb[0])
|
| 32 |
+
embHy = self.Hierarchical(emb[1])
|
| 33 |
+
similarity = self.similar(embHx, embHy)
|
| 34 |
+
|
| 35 |
return(similarity)
|
| 36 |
|
| 37 |
|