Commit 7e984525c9fd745a6b3da054df48469ed0420d62

Authored by Miguel Barão
1 parent 5d859a41
Exists in master and in 1 other branch dev

fix forgetting factor (was hardcoded)

Showing 2 changed files with 8 additions and 6 deletions   Show diff stats
aprendizations/student.py
@@ -12,11 +12,12 @@ logger = logging.getLogger(__name__) @@ -12,11 +12,12 @@ logger = logging.getLogger(__name__)
12 12
13 13
14 # ---------------------------------------------------------------------------- 14 # ----------------------------------------------------------------------------
15 -# kowledge state of each student....?? 15 +# kowledge state of a student
16 # Contains: 16 # Contains:
17 -# state - dict of topics with state of unlocked topics 17 +# state - dict of unlocked topics and their levels
18 # deps - access to dependency graph shared between students 18 # deps - access to dependency graph shared between students
19 -# topic_sequence - list with the order of recommended topics 19 +# topic_sequence - list with the recommended topic sequence
  20 +# current_topic - nameref of the current topic
20 # ---------------------------------------------------------------------------- 21 # ----------------------------------------------------------------------------
21 class StudentState(object): 22 class StudentState(object):
22 # ======================================================================= 23 # =======================================================================
@@ -34,13 +35,13 @@ class StudentState(object): @@ -34,13 +35,13 @@ class StudentState(object):
34 35
35 # ------------------------------------------------------------------------ 36 # ------------------------------------------------------------------------
36 # Updates the proficiency levels of the topics, with forgetting factor 37 # Updates the proficiency levels of the topics, with forgetting factor
37 - # FIXME no dependencies are considered yet...  
38 # ------------------------------------------------------------------------ 38 # ------------------------------------------------------------------------
39 def update_topic_levels(self): 39 def update_topic_levels(self):
40 now = datetime.now() 40 now = datetime.now()
41 for tref, s in self.state.items(): 41 for tref, s in self.state.items():
42 dt = now - s['date'] 42 dt = now - s['date']
43 - s['level'] *= 0.98 ** dt.days # forgetting factor 43 + forgetting_factor = self.deps.node[tref]['forgetting_factor']
  44 + s['level'] *= forgetting_factor ** dt.days # forgetting factor
44 45
45 # ------------------------------------------------------------------------ 46 # ------------------------------------------------------------------------
46 # Unlock topics whose dependencies are satisfied (> min_level) 47 # Unlock topics whose dependencies are satisfied (> min_level)
demo/demo.yaml
@@ -4,7 +4,7 @@ title: Example @@ -4,7 +4,7 @@ title: Example
4 database: students.db 4 database: students.db
5 5
6 6
7 -# values applie to each topic, if undefined there 7 +# values applied to each topic, if undefined there
8 file: questions.yaml 8 file: questions.yaml
9 shuffle_questions: true 9 shuffle_questions: true
10 choose: 6 10 choose: 6
@@ -27,3 +27,4 @@ topics: @@ -27,3 +27,4 @@ topics:
27 name: Sistema solar 27 name: Sistema solar
28 deps: 28 deps:
29 - math 29 - math
  30 + forgetting_factor: 0.1