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.
Opts
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.
Jitter
call(Pname,N,Name)
?- [pack(mlu/examples/stoic)]. ?- stoic. % use ?- stoic_ng. % if you do not have library(real).
Opts
?- 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]].
Opts
Pack mlu uses pack pack_errors for throwing errors.
File 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.
Opts
integer(R)
, the V in Pairs is a list of results (length(V)
= R)?- 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].
Data is one of
Opts
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 ). ?- [pack(mlu/examples/grouped_freqs)]. ?- grouped_freqs. % a plot with 9 bars and 3 groups should appear on screen ?- mlu_frequency_plot( [1,1,1,2,2,3], true ). ?- mlu_frequency_plot( [1,1,1,2,2,3], interface(barplot) ).
?- mlu_frequency_plot( [1,1,2,11,12,21,31,33,41], [bins([10,20]),interface(gg_bar)] ).
The plot produced has binned Data into 3 bins.
?- mlu_frequency_plot( [1,1,2,11,12,21,31,33,41], [bins([bin1-10,bin2-20,bin3-inf]),interface(gg_bar)] ).
As previous example, but x tics are custom labelled.
?- mlu_frequency_plot( [1,2,10,11,12,21,31,33,41], [bins([0-10]),interface(gg_bar)] ).
?- lib(pepl). ?- sload_pe( coin ). ?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ), mlu_frequency_plot( Freqs, [interface(barplot),outputs([svg]),las=2] ).
Produces file: real_plot.svg
?- mlu_sample( scall(coin(Side)), 100, Side, Freqs ), mlu_frequency_plot( Freqs, [interface(gg_bar),output(png("naku.png"))] ).
Produces file: naku.png
?- mlu_version( V, D ). V = 0:5:0, D = date(2022, 12, 29).