truelearn.learning.EngageClassifier#

class truelearn.learning.EngageClassifier[source]#

Bases: BaseClassifier

A Classifier that always makes a positive prediction.

Examples

>>> from truelearn.learning import EngageClassifier
>>> from truelearn.models import EventModel
>>> engage = EngageClassifier()
>>> engage
EngageClassifier()
>>> # prepare an event model with empty knowledge
>>> event = EventModel()
>>> engage.fit(event, False)
EngageClassifier()
>>> engage.predict(event)
True
>>> engage.predict_proba(event)
1.0

Methods

__init__()

Init EngageClassifier object.

fit(x, y)

Train the model.

get_params([deep])

Get parameters for this Classifier.

predict(x)

Predict whether the learner will engage in the learning event.

predict_proba(x)

Predict the probability that the learner will engage in the learning event.

set_params(**args)

Set the parameters of this Classifier.

__init__() None[source]#

Init EngageClassifier object.

fit(x: EventModel, y: bool) Self[source]#

Train the model.

Parameters:
  • x – A representation of a learning event.

  • y – A bool indicating whether the learner engages in the learning event.

Returns:

The updated classifier object.

get_params(deep: bool = True) Dict[str, Any][source]#

Get parameters for this Classifier.

Parameters:

deep – If True, will return the parameters for this Classifier and contained sub-objects that inherit BaseClassifier class.

Returns:

A dict mapping variable names to the corresponding objects.

predict(x: EventModel) bool[source]#

Predict whether the learner will engage in the learning event.

Parameters:

x – A representation of a learning event.

Returns:

A bool indicating whether the learner will engage in the learning event.

predict_proba(x: EventModel) float[source]#

Predict the probability that the learner will engage in the learning event.

Parameters:

x – A representation of a learning event.

Returns:

A float indicating the probability that the learner will engage in the learning event.

set_params(**args) Self[source]#

Set the parameters of this Classifier.

A value can be reset only if the given parameter has the same type as the original value.

Parameters:

**args – Keyword arguments. The key should match the parameter names of the classifier. The arguments should have the correct type.

Returns:

The updated classifier.

Raises:
  • TrueLearnTypeError – Types of parameters do not satisfy their constraints.

  • TrueLearnValueError – Values of parameters do not satisfy their constraints.

  • InvalidArgumentError – If the given argument name is not in the class.