Answers.Body: <p>You might not even need a classifier.</p>
  
  <p>I would devise a scoring function, based on analysis of the previous data you have. Each user gets a score based on features like</p>
  
  <ul>
  <li>how many times in the past has this user swapped a shift with somebody else?</li>
  <li>how many times has the user swapped with the current user?</li>
  <li>how many times has the user swapped this particular shift?</li>
  </ul>
  
  <p>For each criterion you add a number of points to the score; the second one might be weighted higher that the first one. Then the person with the highest score is most likely to switch shifts with your current user.</p>
  
  <p>The main question is the design of the scoring function, but I don't think you'd need to go into all the overkill of setting up a classifier; just think which criteria would make someone more likely to swap, and encode them directly. This has the advantage that it's transparent, ie you can always see <em>why</em> someone got recommended, and you can tweak your scoring method if the results are not quite what you'd want. This is often hard to do with ML classifiers.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-15T04:39:54.510Z
Answers.Text: Hi Oliver, I understand your comment regarding overkill. Actually I started learning AI/ML recently, I thought the best way to grasp is to learn by building something and asking questions in the process, so I thought of above generic problem involving shift swapping, this will include many constraint like a cashier would only swap with other cashier and so on. So I was thinking to apply ML/AI to learn it.
Answers.UserDisplayName: Paras
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-14T08:38:45.070Z
Answers.LastActivityDate: 2018-05-14T08:38:45.070Z
Answers.UserDisplayName: Oliver Mason
Answers.Body: <p>The first thing to think about is how you might identify a likely swapper without a computer, and what characteristics might identify that swapper, e.g. what role they have, how many times they swapped in the last year, 6 months, 6 weeks etc, how many times they've taken each shift, how long they've been around, do they have a family, etc. In this initial step you don't need to figure out HOW those characteristics identify the swapper, just that they might help to identify them.</p>
  <p>Once those &quot;features&quot; have been identified, you are ready to build a model of how you might identify a likely swapper. You would take a few examples of instances where two individuals swapped shifts, and map out the characteristics of each individual. This will identify a number of instances of your positive class. Flesh our your dataset with all other combinations of individuals and shifts which are, of course, instances where no switch occurred. These are your negative class.</p>
  <p>Before doing any modeling, check to see if any of your features are highly correlated with your target variable. If there are a couple of features that are highly correlated, you may not even need to use machine learning. Remember, machine learning is just using an algorithm to learn a pattern. <strong>If you can learn the pattern without an algorithm, you're done.</strong></p>
  <p>If you're still looking at several features that may be involved in a complex model to identify who might swap shifts, then you can start trying various model algorithms. To start with you could try logistic regression, random forest, naïve bayes, and SVM. Split your data and try and overfit on your training set. If you manage to overfit, you've got a chance. Start scaling back the features and try and find something that generalizes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-21T06:33:27.207Z
Answers.LastActivityDate: 2021-12-21T06:33:27.207Z
Answers.UserDisplayName: scign
Body: <p>I need to design an algorithm such that it handles the request for shift swapping.</p>
  <p>The algorithm will recommend a list of people who are more likely to swap that shift with the person by analyzing previous data.</p>
  <p>Can anyone list the techniques that will help me to do this or a good starting point?</p>
  <p>I was thinking about training a Naive Bayes Classifier and using Mahout for generating recommendations.</p>
  
Tags: <ai-design><algorithm-request><recommender-system>
Title: How to design a recommendation system for shift swapping?
UserDisplayName: Paras
ThreadText: # How to design a recommendation system for shift swapping?
  
  (Asked by: username_0 on 2018-05-14)
  
  I need to design an algorithm such that it handles the request for shift swapping.
  
  The algorithm will recommend a list of people who are more likely to swap that shift with the person by analyzing previous data.
  
  Can anyone list the techniques that will help me to do this or a good starting point?
  
  I was thinking about training a Naive Bayes Classifier and using Mahout for generating recommendations.
  
  **Tags:** ai-design, algorithm-request, recommender-system
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-05-14. Score: 0
  
  You might not even need a classifier.
  
  I would devise a scoring function, based on analysis of the previous data you have. Each user gets a score based on features like
  
  * how many times in the past has this user swapped a shift with somebody else?
  * how many times has the user swapped with the current user?
  * how many times has the user swapped this particular shift?
  
  For each criterion you add a number of points to the score; the second one might be weighted higher that the first one. Then the person with the highest score is most likely to switch shifts with your current user.
  
  The main question is the design of the scoring function, but I don't think you'd need to go into all the overkill of setting up a classifier; just think which criteria would make someone more likely to swap, and encode them directly. This has the advantage that it's transparent, ie you can always see *why* someone got recommended, and you can tweak your scoring method if the results are not quite what you'd want. This is often hard to do with ML classifiers.
  
  > **Comments:**
  > **username_0**: Hi username_1, I understand your comment regarding overkill. Actually I started learning AI/ML recently, I thought the best way to grasp is to learn by building something and asking questions in the process, so I thought of above generic problem involving shift swapping, this will include many constraint like a cashier would only swap with other cashier and so on. So I was thinking to apply ML/AI to learn it.  
  
  ---
  
  ### Answer by username_2 on 2021-12-21. Score: 0
  
  The first thing to think about is how you might identify a likely swapper without a computer, and what characteristics might identify that swapper, e.g. what role they have, how many times they swapped in the last year, 6 months, 6 weeks etc, how many times they've taken each shift, how long they've been around, do they have a family, etc. In this initial step you don't need to figure out HOW those characteristics identify the swapper, just that they might help to identify them.
  
  Once those "features" have been identified, you are ready to build a model of how you might identify a likely swapper. You would take a few examples of instances where two individuals swapped shifts, and map out the characteristics of each individual. This will identify a number of instances of your positive class. Flesh our your dataset with all other combinations of individuals and shifts which are, of course, instances where no switch occurred. These are your negative class.
  
  Before doing any modeling, check to see if any of your features are highly correlated with your target variable. If there are a couple of features that are highly correlated, you may not even need to use machine learning. Remember, machine learning is just using an algorithm to learn a pattern. **If you can learn the pattern without an algorithm, you're done.**
  
  If you're still looking at several features that may be involved in a complex model to identify who might swap shifts, then you can start trying various model algorithms. To start with you could try logistic regression, random forest, naïve bayes, and SVM. Split your data and try and overfit on your training set. If you manage to overfit, you've got a chance. Start scaling back the features and try and find something that generalizes.
  
  
  ---
  
  