A menagerie of machine learning utilities.
Currently implements k_fold learning and k_fold comparative performance plots via Real.
It is likely that bootstrapping will be added soon and also a couple of additional types of comparative plots.
post()options, who are passed on to Post calls via options, this is passed to explicitly. This not used in main call, and it defaults to model_01...model_NN If a variable, the generated names are returned.
Additional Opts for the Post are allowed. For each Post, all options with matching outer term name
are stripped and passed. For instance
jitter(accuracy(2,'AUC')) is passed to Post jitter, and
it signifies that the predictor passes as it is second argument the AUC of the model against the
leave out segment. The implementation is expected correct at the predictor end, here we just
provide means to pass the information to the plotter.
Also see options for k_fold_learn/4.
accuracy(N,Name)the Nth (>1) position of the statistic is accuracy identified by Name
accuracy(Pname)predicate name for obtaining the accuracy names, called as
average_accuracy(Avg=mean)R function for obtaining the single accuracy from the k_fold accuracies
set to false to avoid re-runing ground models. Convenient for running comparatives
?- [pack(mlu/examples/stoic)]. ?- stoic. % use ?- stoic_ng. % if you do not have library(real).
?- Data = [r,a,b,c,d,e,f], k_fold_segments( Data, H, Sgs, folds(3) ). Data = [r, a, b, c, d, e, f], H = r, Sgs = [[a, d], [b, c], [e, f]]. ?- Data = [r,a,b,c,d,e,f], k_fold_segments( Data, H, Sgs, [folds(3),by_permutation(false)] ). Data = [r, a, b, c, d, e, f], H = r, Sgs = [[b, e], [c, d], [a, f]].
Pack mlu uses pack pack_errors for throwing errors.
mlu_errors.pl defines local errors within the pack_errors infrastructure.
Currently the predicate: copy_terms Goal and Yield, and requires that Yield's copy will be ground after Goal's copy is called.
integer(R), the V in Pairs is a list of results (
?- lib(pepl). ?- sload_pe( coin ). ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ). Freqs = [head-47, tail-53]. ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ). Freqs = [head-49, tail-51].
lib(real), in addition the latter also requires
lib(b_real). If b_real is present, the second interface becomes the default.
Other options are passed to either gg_bar_plot/2 (if Iface == gg_bar) or to r_call/2 (if Iface == barplot).
?- lib(pepl). ?- sload_pe( coin ). ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ), mlu_frequency_plot( Freqs, [interface(barplot),outputs([pdf]),las=2] ). ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ), mlu_frequency_plot( Freqs, [interface(gg_bar),output(pdf("naku.pdf"))] ). ?- [pack(mlu/examples/grouped_freqs)]. ?- grouped_freqs. % a plot with 9 bars and 3 groups should appear on screen
?- mlu_version( V, D ). V = 0:2:0, D = date(2017, 3, 11).