Calculating Similarity

I need help displaying the similarity score between the current user and other users.
The similarity score is based on color ranking when a user adds a color to favorite ranking then Jackard algorithms run in the backend to find the similarity score between the current user and other users and set the state of the page to that score, the state is a list of things, once a user signs up and adds his/her color to favorite ranking, then the state changes as the page load to recalculate the similarity score. I am having difficulties displaying a repeating group that represents the similarity score of other users calculated based on the current user.
how can I display the score if I am using the current data structure? Are there any suggestions on using a different data structure/ workflow?

Hello @Malek Welcome to the community!

It seems that recursive logic may be needed here.

Can you elaborate how the coefficient is returned for the current user, as well as, the other users? (How is it being sent and how is it returned?)

Hey @cmarchan !
Thanks for replying!
When a user adds a color to the ranking list, it saves the list to the user data types. When the pages load, it sets the state of the page to what the score of the similarity is, the state of the similarity is a list of user ranking favorites to the current user (I use the Jackard algorithm here). Is that enough information?

Thank you.

This similarity coefficient is a number. So … when you say that on page load a state is set … what is this state exactly?

The state is a list of numbers

@cmarchan @Malek sounds like a good use case for the :ranked by operator.

1 Like

It sound like so @chris.williamson1996 ! :smiley:

Hey @chris.williamson1996 !
Thanks for your reply! Can you please explain where the operator is added?


list of numbers :ranked by will sort this list using RMS

1 Like

Update: I overcame the issue of calculating the similarity score based on 2 profiles, the current user and another user but now, I am trying to add pairs of users every time a new user signs up, the users list is a 2 users list and based on the index of the list, the similarity score is calculated. I have a datatype called user pairs and I have user A and user B fields, User A is current user and User B is every other user, now how can create all the pairs among every user and user A?
In another words, when I create a new user B what would be the value ?

This is very helpful but I found it hard to apply due to the flow of the data I currently have