API Reference#

Shown is the class and function hierarchy of TrueLearn.

For a more detailed description of the decisions made during implementation, please refer to the Design Considerations section.

truelearn.base: Contains the base classes for the library#

Base Classes#


The base class of all the classifiers in TrueLearn.

truelearn.datasets: Contains utilities for using datasets#

The truelearn.datasets module contains utilities to load datasets, such as the PEEK dataset.



A class that defines an implicit interface to the generator of the knowledge component.


datasets.load_peek_dataset(*[, dirname, ...])

Download and Parse PEEKDataset.

datasets.load_peek_dataset_raw(*[, dirname, ...])

Download and Load the raw PEEKDataset.

truelearn.learning: Contains the classifiers for learning#

The truelearn.learning module implements the classifiers in TrueLearn paper.


learning.INKClassifier(*[, ...])

A meta-classifier that combines KnowledgeClassifier and InterestClassifier.

learning.InterestClassifier(*[, ...])

A classifier that models the learner's interest and makes prediction based on the interest.

learning.KnowledgeClassifier(*[, ...])

A classifier that models the learner's knowledge and makes prediction based on the knowledge.

learning.NoveltyClassifier(*[, ...])

A classifier that models the learner's knowledge and makes prediction based on the knowledge.


A Classifier that always makes a positive prediction.

learning.PersistentClassifier(*[, ...])

A classifier that makes predictions based on whether the learner has engaged with the last learnable unit.

learning.MajorityClassifier(*[, engagement, ...])

A classifier that predicts based on the number of learner's engagement and non-engagement.

truelearn.models: Contains the representations used for learning#

The truelearn.models module implements the knowledge, learner and event models.


models.BaseKnowledgeComponent(*args, **kwds)

An interface defines a knowledge component of a learnable unit.

models.EventModel(knowledge, event_time)

A class that models a learning event in TrueLearn algorithm.

models.LearnerModel(knowledge, ...)

The model of a learner.

models.LearnerMetaWeights([novelty_weights, ...])

Store the weights used in meta training.

models.KnowledgeComponent(*args, **kwds)

A concrete class that implements BaseKnowledgeComponent.

models.HistoryAwareKnowledgeComponent(*args, ...)

A knowledge component that keeps a history about how it was updated.


The representation of the learner's knowledge.

truelearn.preprocessing: Contains preprocessing functions and classes#

The truelearn.preprocessing module implements the initial tasks required to use the classifiers.



A client that makes requests to the Wikifier API.



Calculate the mean of an iterable of values.


Calculate the sample standard deviation of an iterable of values.


Calculate the population standard deviation of an iterable of values.

truelearn.utils.metrics: Contains functions to generate metrics#

The truelearn.utils.metrics implements the commonly-used metrics in TrueLearn.


utils.metrics.get_precision_score(...[, ...])

Get the precision score of the prediction.

utils.metrics.get_recall_score(act_labels, ...)

Get the recall score of the prediction.

utils.metrics.get_accuracy_score(act_labels, ...)

Get the accuracy score of the prediction.

utils.metrics.get_f1_score(act_labels, ...)

Get the f1 score of the prediction.

truelearn.utils.visualisations: Contains plotting functions and classes#

truelearn.utils.visualisations provides utilities for creating visualisations.

The module provides Plotter classes that take the learner’s knowledge as input and produce various different charts.


utils.visualisations.LinePlotter([title, ...])

Line plotter.


Pie plotter.


Rose pie plotter.

utils.visualisations.BarPlotter([title, ...])

Bar plotter.

utils.visualisations.DotPlotter([title, ...])

Dot plotter.


Bubble plotter.


Word cloud plotter.


Radar plotter.


Treemap plotter.