EduData.Task

EduData.Task.KnowledgeTracing.format.tl2json(src: str, tar: str, to_int=True, left_shift=False)[source]

convert the dataset in tl sequence into json sequence

.tl format The first line is the number of exercises a student attempted. The second line is the exercise tag sequence. The third line is the response sequence.

15
1,1,1,1,7,7,9,10,10,10,10,11,11,45,54
0,1,1,1,1,1,0,0,1,1,1,1,1,0,0

.json format Each sample contains several response elements, and each element is a two-element list. The first is the exercise tag and the second is the response.

[[1,0],[1,1],[1,1],[1,1],[7,1],[7,1],[9,0],[10,0],[10,1],[10,1],[10,1],[11,1],[11,1],[45,0],[54,0]]
EduData.Task.KnowledgeTracing.graph.correct_co_influence_graph(ku_num, *src, tar=None, input_is_file=True)[source]

Co-influence graph

A co-influence pair is defined as two vertexes that the sum of transition count is large and the difference is small.

Diagonal_value is always 0

Parameters
  • ku_num

  • src

  • tar

  • input_is_file

Examples

>>> _seq = [
...     [[0, 1], [1, 0], [1, 1], [2, 0]],
...     [[0, 1], [1, 1], [2, 0], [2, 1]],
...     [[2, 1], [2, 1], [1, 1], [2, 0]],
...     [[1, 0], [0, 1], [0, 1], [2, 0]],
...     [[2, 0], [1, 1], [0, 1], [2, 1]],
... ]
>>> correct_co_influence_graph(3, _seq, input_is_file=False)
array([[0., 1., 0.],
       [1., 0., 0.],
       [0., 0., 0.]])
EduData.Task.KnowledgeTracing.graph.correct_transition_count_graph(ku_num, *src, tar=None, input_is_file=True)[source]
Parameters
  • ku_num

  • src

  • tar

  • input_is_file

Examples

>>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]
>>> correct_transition_count_graph(3, _seq, input_is_file=False)
[[0, 0, 1], [0, 0, 1], [0, 0, 0]]
>>> _seq = [[[0, 1], [1, 1], [1, 1], [2, 1]]]
>>> correct_transition_count_graph(3, _seq, input_is_file=False)
[[0, 1, 0], [0, 0, 1], [0, 0, 0]]
EduData.Task.KnowledgeTracing.graph.correct_transition_graph(ku_num, *src, tar=None, input_is_file=True, diagonal_value=0.0)[source]

When a concept is mastered, how much probability is it to be transferred to another concept.

For example,

` [[0, 1], [1, 0], [1, 1], [2, 1]] [[2, 0], [1, 0], [0, 1], [2, 1]] ` When concept #0 is mastered (i.e., 1st in seq #1, 3rd in seq #2), only concept # 2 can be mastered (4th in seq #2). Thus, the transition probabilty for concept #0 is [0, 0, 1], which mastering concept #0 can influence mastering concept #2 more thant concept #1.

Parameters
  • ku_num

  • src

  • tar

  • input_is_file

  • diagonal_value

Examples

>>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]
>>> correct_transition_graph(3, _seq, input_is_file=False)
[[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]
>>> _seq = [[[0, 1], [1, 1], [1, 1], [2, 1]]]
>>> correct_transition_graph(3, _seq, input_is_file=False)
[[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]
EduData.Task.KnowledgeTracing.graph.dense_graph(ku_num: int, tar=None, undirected: bool = False)[source]

Dense graph where any two vertex have a link

No self loop is reserved.

Parameters
  • ku_num (int) –

  • tar

  • undirected

Examples

Target file is a json file, json.load can be used to read it.

Demo of target file with undirected tag is False: [

[0, 1], [0, 2], [1, 0], … [2, 0], [2, 1]

]

Demo of target file with undirected tag is True: [

[0, 1], [1, 2], [0, 2]

]

>>> dense_graph(3)
[[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]]
>>> dense_graph(3, undirected=True)
[[0, 1], [0, 2], [1, 2]]
EduData.Task.KnowledgeTracing.graph.posterior_correct_probability_graph(ku_num, *src, tar=None, input_is_file=True, fill_na_with=0.0)[source]

When a concept is mastered, how much probability is another concept correctly answered.

For example,

` [[0, 1], [1, 1], [1, 1], [2, 1]] [[2, 0], [1, 0], [0, 1], [2, 1]] ` When concept #0 is mastered (i.e., 1st in seq #1, 3rd in seq #2), concept #1 and # 2 can both be mastered (1th in seq # 1, 4th in seq #2). Thus, the posterior correct probability for concept #0 is [0, 1, 1].

Parameters
  • ku_num

  • src

  • tar

  • input_is_file

  • fill_na_with

Returns

  • >>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]

  • >>> posterior_correct_probability_graph(3, _seq, input_is_file=False)

  • [[0.0, 1.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]

EduData.Task.KnowledgeTracing.graph.posterior_correct_transition_graph(ku_num, *src, tar=None, input_is_file=True, diagonal_value=None)[source]

Correct transition graph based on posterior correct graph

For example,

` [[0, 1], [1, 1], [1, 1], [2, 1]] [[2, 0], [1, 0], [0, 1], [2, 1]] ` When concept #0 is mastered (i.e., 1st in seq #1, 3rd in seq #2), concept #1 and # 2 can both be mastered (1th in seq # 1, 4th in seq #2). Thus, the posterior correct probability for concept #0 is [0, 1, 1].

Parameters
  • ku_num

  • src

  • tar

  • input_is_file

  • diagonal_value

Returns

  • >>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]

  • >>> posterior_correct_transition_graph(3, _seq, input_is_file=False)

  • [[0.0, 0.5, 0.5], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]

  • >>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]

  • >>> posterior_correct_transition_graph(3, _seq, input_is_file=False)

  • [[0.0, 0.5, 0.5], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]

EduData.Task.KnowledgeTracing.graph.similarity_graph(ku_num, src_graph, tar)[source]

construct similarity graph based on transition graph

EduData.Task.KnowledgeTracing.graph.transition_graph(ku_num, *src, tar=None, input_is_file=True, diagonal_value=0.0)[source]

When a concept is learned, how much probability does another concept appear.

For example,

` [[0, 1], [1, 0], [1, 1], [2, 1]] [[2, 0], [1, 0], [0, 1], [2, 1]] ` When concept #0 is learned (i.e., 1st in seq #1, 3rd in seq #2), concept #2 and #1 could appear (2nd in seq #1, 4th in seq #2) Thus, the transition probabilty for concept #0 is [0, 0.5, 0.5].

Parameters
  • ku_num

  • src

  • tar

  • input_is_file

  • diagonal_value

Examples

>>> _seq = [[[0, 1], [1, 0], [1, 1], [2, 1]], [[2, 0], [1, 0], [0, 1], [2, 1]]]
>>> transition_graph(3, _seq, input_is_file=False)
[[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.0, 1.0, 0.0]]
>>> _seq = [[[0, 1], [1, 1], [1, 1], [2, 1]]]
>>> transition_graph(3, _seq, input_is_file=False)
[[0.0, 1.0, 0.0], [0.0, 0.0, 1.0], [0.0, 0.0, 0.0]]