How to use the formulas.init_transit function in formulas

To help you get started, we’ve selected a few formulas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sagefy / sagefy / simulation / sequencer.py View on Github external
def main(num_learners=1000, num_cards=50):
    d = create_responses(num_learners, num_cards)
    responses, learners, cards = d['responses'], d['learners'], d['cards']

    my_cards = [{
        'name': card['name'],
        'guess': init_guess,
        'guess_weight': init_weight,
        'slip': init_slip,
        'slip_weight': init_weight,
        'transit': init_transit,
        'transit_weight': init_weight,
    } for card in cards]

    my_learners = [{
        'name': learner['name'],
        'learned': init_learned,
    } for learner in learners]

    latest_response_per_learner = {}

    for i, response in enumerate(responses):
        # response keys: learner, card, time, score

        if response['learner'] in latest_response_per_learner:
            prev_response = latest_response_per_learner[response['learner']]
            prev_card = get_card(prev_response['card'], my_cards)