Base Classes for Models

class batcore.modelbase.RecommenderBase
abstract fit(data)

trains RecommenderBase on given data :param data: train data to fit

abstract predict(pull, n=10)

predicts best n reviewers for the pull

Parameters:
  • pull – pull for which reviewers need to be predicted

  • n (int) – number of reviewers to predict

Returns:

list of recommendations

class batcore.modelbase.BanRecommenderBase(no_owner=True, no_inactive=True, inactive_time=60)

Base class for the recommender models with built-in filtering of the candidates.

Parameters:
  • no_owner – flag to add or remove owners of the pull request from the recommendations

  • no_inactive – flag to add or remove inactive reviewers from recommendations

  • inactive_time – number of consecutive days without any actions needed to be considered an inactive

filter(scores, pull)

For the given pull request filters candidates

Parameters:
  • pull – pull request for which recommendations are calculated

  • scores – dict scores of potential candidates for the code review

fit(data)

performs necessary updates

remove_inactive(scores, cur_date)

removes recently inactive users from the resulstin scores

Parameters:
  • scores – dict with scores for each reviewer candidate

  • cur_date – date of the pull request for which scores were calculated

static remove_user(scores, user_id)
Parameters:
  • scores – dict with scores for each reviewer candidate

  • user_id – id of candidate to be removed

update_time(events)

for all the participants in each event updates time of most recent action

Parameters:

events – batch of events