/usr/share/octave/packages/ga-0.10.0/fitscalingrank.m is in octave-ga 0.10.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | ## Copyright (C) 2008, 2009 Luca Favatella <slackydeb@gmail.com>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; If not, see <http://www.gnu.org/licenses/>.
## Author: Luca Favatella <slackydeb@gmail.com>
## Version: 1.3.3
function expectation = fitscalingrank (scores, nParents)
nr_scores = rows (scores);
r(1, 1:nr_scores) = ranks (scores(1:nr_scores, 1));
#TODO
#ranks ([7,2,2]) == [3.0,1.5,1.5]
#is [3,1,2] (or [3,2,1]) useful?
expectation_wo_nParents(1, 1:nr_scores) = arrayfun (@(n) 1 / sqrt (n), r);
expectation(1, 1:nr_scores) = \
(nParents / sum (expectation_wo_nParents)) * \
expectation_wo_nParents;
endfunction
## number of input arguments
# TODO
## number of output arguments
# TODO
## type of arguments
# TODO
# TODO
%!shared scores, nParents, expectation
%! scores = rand (20, 1);
%! nParents = 32;
%! expectation = fitscalingrank (scores, nParents);
%!assert (sum (expectation), nParents, 1e-9);
%!test
%! [trash index_min_scores] = min (scores);
%! [trash index_max_expectation] = max (expectation);
%! assert (index_min_scores, index_max_expectation);
%!test
%! [trash index_max_scores] = max (scores);
%! [trash index_min_expectation] = min (expectation);
%! assert (index_max_scores, index_min_expectation);
|