Module Teacher (.ml)


module Teacher: sig .. end
Methods for iteratively teaching of a Hypothesis. E.g. for methods that use Gradient Descent or other local search mechanisms

type 'a t 
The general type of teachers for a Hypothesis space 'a
type 'a examiner 
Exams on a Hypothesis of type 'a
type permutation 
Permutations
val id : permutation
A permutation that keeps everything in place
val shuffle : permutation
Shuffles the order of the data each time the permutation is used
val fixed_shuffle : permutation
Determines the order once, then the same shuffled order is used on subsequent runs
val empty : 'a t
A do nothing teacher
val make_teacher : 'a array -> permutation -> ('b -> 'a -> 'b) -> 'b t
Make a teacher from training function and some data
val teacher_of_fun : ('a -> 'a) -> 'a t
Make a teacher from a function on the Hypothesis space
val (|->) : 'a t -> 'a t -> 'a t
Concatenation of two teachers
val repeat : 'a t -> int -> 'a t
repeat the teacher n times
val callback_student : ('a -> unit) -> 'a t
call some callback that has the student, grades or both as a parameter
val callback_grades : (float list list -> unit) -> 'a t
see callback_student
val callback_both : ('a -> float list list -> unit) -> 'a t
see callback_student
val reset_grades : 'a t
Reset all grades that have been collected so far
val ignore_grades : 'a t -> 'a t
Ignore all grades, that are generated by the teacher, still the exams are taken
val really_ignore_grades : 'a t -> 'a t
Like ignore_grades, but there is actually no grading done by this teacher. This is much faster, but the values passed to callbacks inside the teacher will differ.
val teach_until_student : ('a -> bool) -> ?max:int -> 'a t -> 'a t
repeat until a given predicate on the student, grades or both will be satisfied or after max passes of the teacher
val teach_until_grades : (float list list -> bool) -> ?max:int -> 'a t -> 'a t
see teach_until_student
val teach_until_both : ('a -> float list list -> bool) -> ?max:int -> 'a t -> 'a t
see teach_until_student
val teach_sync : unit Event.event -> 'a t
Sync teaching to a event. Can be used to sync teachers in one thread to other threads, that may handle GUIs or similar aspects
val teach : 'a t -> 'a -> 'a
Apply a given teacher to a Hypothesis, returning a new Hypothesis.
val teach_graded : 'a t -> 'a examiner list -> 'a -> 'a * float list list
Teach and grade at the same time, the return value gives all the grades as well as the new Hypothesis
val make_strukture_exam : ('a -> float) -> 'a examiner
Make an exam that will grade according to the structure of the Hypothesis.
val make_data_exam : ('a -> 'b -> float) -> 'b array -> 'a examiner
Make an exam that grades how well the Hypothesis is doing on some data.
val make_exam : 'a examiner list -> 'a -> float list
Perform a number of exams on a student
val print_grades : float list list -> unit
Print a list of exam results, as returned by the teach_graded function