I'm trying to build a friend recommendation algorithm that recommends users a new friend every week. Let's say I have a database of
user A
user B
user C
...
and they have a list of hobbies
user A has interests [hobby1, hobby2, hobby3, etc...]
user B has interests [hobby3, hobby6, hobby8, etc...]
user C has interests [hobby1, hobby3, hobby4, etc...]
...
How do I build an algorithm that pairs pick a good recommendation for everyone with the catch that it should be different every week?
Week 1
user A -> user C [2 hobbies in common]
user B -> user A [1 hobby in common]
user C -> user B [1 hobby in common]
...
Week 2
user A -> user B [1 hobby in common]
user B -> user C [1 hobby in common]
user C -> user A [2 hobbies in common]
...
Because on the requirements, it sounds like it could be easy to just completely randomize all user recommendations every week. Is there anything that would be better than that threshold?
First, you need a function that takes 2 Users (A and B) and outputs a "similarity score". The simplest way to do that is to count the amount of common hobbies.
Then find the user that has the best "similarity score" with A and recommend it to A.
Keep a table containing all recommendation (let's call it t_recommendations) that have been made to a certain person, this way, the next time you need to recommend a new person to A, take the person with the highest "similarity score" that is not in t_recommendations.
Table t_recommendations would have the following columns :
recommended_to : The ID of the user that received a recommendation
recommended : The ID of the user that has been recommended to recommended_to
recommendation_date: This one is optional but could be useful if you want to start recommending people again after a while.
Related
Dean-> manager -> senior faculty -> junior faculty -> students
The above structure is in hierarchical form and when I open dean form in servicenow I should be able to see record i.e. rest of the staff under him. Similarly in manager I should be able to see below him.......and so on for junior faculty I will be able to see students and for students there should be no record
Well you can create hierarchical related lists assuming you are using the List V2.
Check here:
https://docs.servicenow.com/bundle/orlando-platform-administration/page/administer/list-administration/task/t_EnableAHierarchicalList.html
I'm not sure this is 100% what you're after but it is a start. I think that in general a better idea is just to create simple Related Lists which allow the user to hop from one table to another. You don't always need to show everything in one view.
I am trying to come up with an UI design for creating a user in Account (Customer) and assigning them a to a one of the levels in hierarchy. And the hierarchy can change depending on the Account selected. I am developing this in an Ionic 2 app.
Would appreciate if you guys can suggest some best approaches in going about it. And, honestly, I am not able to come up with anything good.
Following is an example of various levels that can be setup up for different Accounts. There's going to be 10 levels but not all Accounts will use all 10 levels.
Account is the top most level. All the levels under that will have multiple values. And selecting a value at a level should show only the relevant values in the remaining levels.
Account - Store1 [A Super User having access to all features (Stores)]
|
Country - USA, Canada [User will have access to features of selected country]
|
Region - Eastern, Northern [Features only for the selected region]
|
States - CA, NY, etc.
|
City - San Francisco, San Jose, NYC, etc.
|
Store - Store1, Store2, etc.
Not all Accounts (Customers) will have all the levels. Some might have only 3 or some will have just 2 or others will have 5 and then some might have all 10 of them.
What's the best way to design the User Interface for such data.
Any ideas, suggestions, pointers will be very helpful.
Thanks.
Well , firstly i am sure you could come up with some good ideas you just need to be drinking better coffee ;) . You are a programmer .. its what we do.
Jokes aside. I have recently had to implement a similar hierarchical select structure and did it with each selection navigating to a new view. At first i didnt think this approach was the best but for my use case it actually was because each page had CRUD operations and so clearly differentiated each section.
In your case it is a bit different as they are only selects.
What i would do is show or hide a <ion-list> for each child in the selection process with the selected value at the top separated by an arrow icon.
Selection 1 -> Selection 2 -> Selection 3
Please select
item 1
item 2
item 3
item 4
So basically just show and hide with *ngIf based on the user role and where they are in the selection process with selected options at the top
I plan to implement this for Requisition document.
So, I have 8 users, each from different Organizations.
There are 3 Organization.
1. General Organization
Users :
1) G0
2) G1a
3) G1b
2. Finance Organization
Users :
1) F1
2) F2
3. Technical Organization
Users :
1) T0
2) T1a
3) T1b
Assuming that I am user G0, I have 4 Approvals. They are from :
1. G1a
2. G1b
3. F1
4. F2
And, assuming that I am user T0, I also have 4 Approvals. They are from :
1. T1a
2. T1b
3. F1
4. F2
So I need to have permission from people in my organization first (depends on who login) before the approval from people in Finance Organization.
How can I make it possible in Adempiere?
The Standard Approval in Adempiere requires the Supervisor of a User approve any value above the Approval Amount of the user's Role.
However, as you have no doubt discovered, it only allows for one supervisor approving.
To achieve what you need is a little trickier and you will need to use the Workflow functionality of Adempiere. There are a number of steps involved and they're described in this howto from the Adempiere wiki.
I would like assistance in trying to figure out how to set up a somewhat unique set of workflows.
For example, say I have several accounts, each assigned to the respective Stage 1 account representative. Each account should then be able to be submitted/assigned to the next stage, e.g. Stage 2 account representative, Stage 3 account representative. Each representative should also be able to send the account back down.
So, something like this:
Jones Account: Stage 1 Jones Account Representative -> Stage 2 Jones Account Representative -> Stage 3 Jones Account Representative
Smith Account: Stage 1 Smith Account Representative -> Stage 2 Smith Account Representative -> Stage 3 Smith Account Representative
Brown Account: Stage 1 Brown Account Representative -> Stage 2 Brown Account Representative -> Stage 3 Brown Account Representative
Is there a way this can be done?
It is possible in Zoho Creator. You have to create separate form to store all the stage 1, stage2 and stage 3 representatives for each user.
When the form submitted by the user A, you have to fetch the details from the form you have created to get a stage 1 representative of the user A and vice versa.
Check out the Expense Management application published in Zoho Creator Marketplace
https://creator.zoho.com/platform/public/showAppInfo?ownername=zohodogfood&callbackUrl=expense-management
Which has the same implementation what you are expecting.
I have User, and Follow Domain class that construct the Follower, Following relationship like Twitter. When my User visits another User's page, and click on their Follower list. I pop-up the list of the visited person's follower list, and then show a button in front of it that is labeled "Follow" or "Unfollow" depending on if you already following that person. So I do it the following way, but I'm not sure if this is efficient or maybe there is a better way of doing it. In order to make it efficient, I only retrieve 20 follower at a time and allow pagination.
> example of pop-up:
> ----------------------------------------------
> alex [follow]
> dave [unfollow]
> sarah[follow]
> paul [follow]
> ----------------------------------------------
Follow domain class has:
// The person to follow
User follow
// The person who is following the follow
User follower
// The status of the relationship if removed or still following
boolean status
User domain class is the typical Spring Security User class with a bunch of extra fields like locations and etc.
In my controller when I receive a request for follower list I do the following.
def visitedUser = User.get(visitedUserId)
// get the list of top 20 followers of this user
def followerList = Follow.findAllByFollow(visitedUser, [max:20])
// get the list of all people current user follow who is in the 20 follower list
def mutualFollow = Follow.findAllByFollowerAndFollowInList(currentUser, followerList)
Now I have the list of all the followers in profile of the person I'm visiting, and also the list of those who are mutual. Then I pass both to my GSP and while loop through the followerList in GSP, I compare the id of that follower, if the follower exist in my mutualFollow list I tweak the button to "unfollow" otherwise I keep the button as follow.
One step further to optimize this is to user projection to only retrieve the id of the mutualFollow instead of the whole USER domain object, but since USERs coming back are proxied and they have wrapper around them, I'm not sure that makes a big difference. Because All I retrieve is the id.
I appreciate any suggestion to improve this approach or an alternative. Thanks
I decided to use HQL and only retrieve the necessary info of those USERs within the follow list, and then I did a join to get the mutual people they both follow. And used that in the GSP page. Here is the simplified solution in SQL:
SELECT Ur.follow_id, Urs.follow_id as mutual FROM (SELECT * FROM FOLLOW WHERE FOLLOWER_ID=1)as Urs
RIGHT JOIN (SELECT * FROM FOLLOW WHERE FOLLOWER_ID=3) as Ur
ON Urs.follow_id=Ur.follow_id order by Ur.follow_id;