示例#1
0
            diff = math.fabs(a[i] - b[i])
            diffs.append(diff * factor[i])
        return diffs


if __name__ == "__main__":
    optimization_goals = OptimizationGoals(words_in_parallel=20,
                                           words_in_parallel_factor=3,
                                           repetition_correct_factor=0,
                                           repetition_incorrect_factor=0)

    # update exercise source stats
    BookmarkPriorityUpdater._update_exercise_source_stats()

    # optimize for algorithm for these users
    users = User.find_all()

    start = timer()

    user_ids = [user.id for user in users]
    results = []
    for user_id in user_ids:
        algorithm = ArtsRT()
        evaluator = AlgorithmEvaluator(user_id, algorithm, change_limit=1.0)
        variables_to_set = [['d', getattr(algorithm, 'd'), +5],
                            ['b', getattr(algorithm, 'b'), +10],
                            ['w', getattr(algorithm, 'w'), +10]]
        result = evaluator.fit_parameters(variables_to_set, optimization_goals)
        if result is not None:
            count_bookmarks = len(evaluator.fancy.bookmarks)
            count_exercises = sum(
示例#2
0
# - there was a bug in the bookmark quality and a
#   bookmark that was a subset of another would not
#   be correctly detected as such
#
# - there were too few examples with contexts of
#   20 words so we increased the context size to 42

from zeeguu_core.model import User
from zeeguu_core.word_scheduling.arts.bookmark_priority_updater import BookmarkPriorityUpdater
from zeeguu_core import db


def fix_bookmark_priorities(USER_ID):
    print(f"fixing for user {USER_ID}")
    user = User.find_by_id(USER_ID)

    all_users_bookmarks = user.all_bookmarks()
    for each in all_users_bookmarks:
        each.update_fit_for_study()
    db.session.commit()

    BookmarkPriorityUpdater.update_bookmark_priority(db, user)
    print(f"... OK for {len(all_users_bookmarks)} bookmarks")


for user in User.find_all()[700:]:
    try:
        fix_bookmark_priorities(user.id)
    except:
        print("... failed")