def row_cosine_similarities(self):
"""The squared row cosine similarities.
The row cosine similarities are obtained by calculating the cosine of the angle shaped by
the row principal coordinates and the row principal components. This is calculated by
squaring each row projection coordinate and dividing each squared coordinate by the sum of
the squared coordinates, which results in a ratio comprised between 0 and 1 representing the
squared cosine.
Returns:
pandas.DataFrame: A dataframe of shape (`n`, `k`) containing the squared row cosine
similarities.
"""
squared_coordinates = np.square(self.row_principal_coordinates)
total_squares = squared_coordinates.sum(axis='columns')
return squared_coordinates.div(total_squares, axis='rows')
评论列表
文章目录