A brief description of every exported name in every library of the robin namespace of r7rs-libs.
(robin abbrev)
- Definition
-
(abbrev strings [prefix])
- Description
-
-
strings- a list of strings to analyse -
prefix- an optional string prefix, required on output abbreviations
-
Returns a list of (abbreviation . string) dotted pairs, where each string is in the original list of strings, and each abbreviation is a unique abbreviation for that string.
(robin confusion-matrix)
- Definition
-
(make-confusion-matrix [labels])
- Documentation
-
-
labels- optional list of labels to use to create confusion matrix. Defaults to'positive 'negative.
-
Returns a new confusion matrix instance. Labels should be strings or symbols.
- Error
-
If less than two labels are given.
- Definition
-
(confusion-matrix? value)
- Documentation
-
-
value- a value
-
Returns #t if value is a confusion matrix instance.
- Definition
-
(confusion-matrix-add cm predicted observed [total])
- Documentation
-
-
cm- confusion matrix -
predicted- predicted label of instance -
observed- observed label of instance -
total- optional number of instances to add, default value is 1
-
Adds total to the count for given (predicted observed) labels.
- Error
-
If
cmis not a confusion matrix instance or if labels are not part of the confusion matrix.
- Definition
-
(confusion-matrix-count cm predicted observed)
- Documentation
-
-
cm- confusion matrix -
predicted- predicted label of instance -
observed- observed label of instance
-
Returns the count for given (predicted observed) labels.
- Error
-
If
cmis not a confusion matrix instance. or if labels are not part of the confusion matrix.
- Definition
-
(confusion-matrix-display cm)
- Documentation
-
-
cm- confusion matrix
-
Displays given confusion matrix to current-output port.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(confusion-matrix-labels cm)
- Documentation
-
-
cm- confusion matrix
-
Returns the labels for the confusion matrix.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(confusion-matrix-total cm)
- Documentation
-
-
cm- confusion matrix
-
Returns the total number of instances referenced in the confusion matrix.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(cohen-kappa cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns Cohen’s Kappa statistic, which compares observed accuracy with an expected accuracy.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(f-measure cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns harmonic mean of the precision and recall for the given label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(false-negative cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns the number of instances of the given label which are incorrectly observed.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(false-positive cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns the number of incorrectly observed instances of the given label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(false-rate cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns proportion of instances of label incorrectly observed out of all instances not originally of that label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(geometric-mean cm)
- Documentation
-
-
cm- confusion matrix
-
Returns nth root of product of true-rate for each label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(matthews-correlation cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns measure of the quality of binary classifications.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(overall-accuracy cm)
- Documentation
-
-
cm- confusion matrix
-
Returns proportion of instances which are correctly labelled.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(precision cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns proportion of instances of given label which are correct.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(prevalence cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns proportion of instances observed of given label, out of total.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(recall cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns recall value, which is equal to the true-rate, for a given label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(sensitivity cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns sensitivity value, which is another name for the true-rate (recall), for a given label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(specificity cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns specificity, which is 1 - false-rate, for a given label.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(true-negative cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns the number of instances NOT of the given label which are correctly observed.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(true-positive cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns the number of instances of the given label correctly observed.
- Error
-
If
cmis not a confusion matrix instance.
- Definition
-
(true-rate cm [for-label])
- Documentation
-
-
cm- confusion matrix -
for-label- optional class label to use as 'positive' - defaults to first label in definition
-
Returns proportion of instances of given label which are correctly observed.
- Error
-
If
cmis not a confusion matrix instance.
(robin csv)
- Definition
-
(make-csv-reader [port separator quotechar])
- Description
-
-
port- an optional input port, defaults tocurrent-input-port -
separator- an optional separator character, defaults to#\, -
quotechar- an optional quote character, defaults to#\"
-
Returns a CSV reader with given parameters. The caller is responsible for closing the port, when finished.
- Error
-
If
portis not an input-port, orseparatorandquotecharare not characters.
- Definition
-
(csv-read [csv-reader])
- Description
-
-
csv-reader- an optional csv reader, as created withmake-csv-reader, defaults to reading fromcurrent-input-port
-
Returns a list of fields, or eof if the input-port is empty or at end.
- Definition
-
(csv-read-all [csv-reader])
- Description
-
-
csv-reader- an optional csv reader, as created withmake-csv-reader, defaults to reading fromcurrent-input-port
-
Returns a list of lists of fields, read from input-port using csv-read until input-port is empty.
- Definition
-
(make-csv-writer [port separator quotechar])
- Description
-
-
port- an optional output port, defaults tocurrent-output-port -
separator- an optional separator character, defaults to#\, -
quotechar- an optional quote character, defaults to#\"
-
Returns a CSV writer with given parameters. The caller is responsible for closing the port, when finished.
- Error
-
If
portis not an output-port, orseparatorandquotecharare not characters.
- Definition
-
(csv-write line [csv-writer])
- Description
-
-
line- a list of fields to write as a single CSV record -
csv-writer- an optional csv writer, as created withmake-csv-writer, defaults to writing tocurrent-output-port
-
Writes the given line as a CSV record to the writer.
- Definition
-
(csv-write-all data [csv-writer])
- Description
-
-
data- a list of lists of fields to write as separate CSV records -
csv-writer- an optional csv writer, as created withmake-csv-writer, defaults to writing tocurrent-output-port
-
Writes the given data as a series of CSV records to the writer.
(robin disjoint-set)
- Definition
-
(make-disjoint-set comparator)
(make-disjoint-set equality? hash-function) - Description
-
-
comparator- a(scheme comparator)comparator
-
or
-
equality?- an equality procedure -
hash-function- a hash function
Returns a new disjoint-set object.
- Definition
-
(disjoint-set? object)
- Description
-
-
object- some Scheme value
-
Returns #t if the given object is a disjoint-set, or else #f.
- Definition
-
(disjoint-set:find disjoint-set item [default])
- Description
-
-
disjoint-set- a disjoint-set object -
item- the item to locate within the disjoint-set -
default- default value to return if not found
-
Returns a representative item in the disjoint set for the given item. Returns
the optional default value, or the symbol item-not-found, if no set is found.
- Error
-
If an invalid
disjoint-setis provided.
- Definition
-
(disjoint-set:make disjoint-set item)
- Description
-
-
disjoint-set- a disjoint-set object -
item- the item to use as the base for a new group within the disjoint-set
-
Includes the given item in the disjoint set as its own group. No useful return value.
- Error
-
If an invalid
disjoint-setis provided.
- Definition
-
(disjoint-set:size disjoint-set item)
- Description
-
-
disjoint-set- a disjoint-set object
-
Returns the number of distinct groups in the disjoint set.
- Error
-
If an invalid
disjoint-setis provided.
- Definition
-
(disjoint-set:union disjoint-set item-1 item-2)
- Description
-
-
disjoint-set- a disjoint-set object -
item-1- representative of one group in the disjoint set -
item-2- representative of a second group in the disjoint set
-
Modifies the disjoint set so the two represented groups are equivalent.
- Error
-
If an invalid
disjoint-setis provided, or either of the given items is not found.
(robin simulated-annealing)
- Definition
-
(simulated-annealing make-instance evaluate-instance num-iterations [can-stop?])
- Description
-
-
make-instance- a procedure to return a new instance in the search domain. If an optional instance is provided, then the new instance should be a neighbour of the given instance -
evaluate-instance- a procedure of one argument, an instance in the search domain. Returns a positive number evaluating the instance, with 0 representing the best evaluation -
num-iterations- the number of iterations over which the search is performed -
can-stop?- an optional procedure of one argument, the current instance’s evaluation. Returns#tif the search should stop prematurely, e.g. if a solution is found.
-
Returns the best instance found after performing simulated-annealing stochastic search.
- Error
-
If
num-iterationsorevaluate-instanceare not of the appropriate type.
(robin srfi64-utils)
- Definition
-
(test-all-equal proc pairs)
- Description
-
-
proc- a procedure accepting one argument -
pairs- a list of dotted (argument . result) pairs
-
Calls test-equal on each pair, as (test-equal result (proc argument)).
- Definition
-
(test-compare proc item-1 item-2)
- Description
-
-
proc- a comparison procedure accepting two arguments -
item-1- one item to be compared -
item-2- a second item to be compared
-
Calls test-assert on the result of applying proc to the two items.
- Definition
-
(test-no-error code)
- Description
-
-
code- a block of test code to evaluate
-
Test fails if the given code raises an error.
(robin statistics)
- Definition
-
(mean list-numbers)
Same as arithmetic-mean.
- Definition
-
(arithmetic-geometric-mean x y [tolerance])
- Description
-
-
x- first number -
y- second number -
tolerance- optional tolerance, defaults to 1e-8.
-
Returns the arithmetic-geometric mean of the given two numbers.
- Definition
-
(arithmetic-mean list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns the arithmetic mean of given list of numbers.
- Definition
-
(geometric-mean list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns the geometric mean of given list of numbers.
- Definition
-
(harmonic-mean list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns the harmonic mean of given list of numbers.
- Definition
-
(median list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns the median value of given list of numbers.
- Definition
-
(mode list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns the modal value of given list of numbers.
- Error
-
If the given list of numbers is empty.
- Definition
-
(percentile list-numbers percent)
- Description
-
-
list-numbers- list of numbers -
percent- percentile value, integer in range 1 to 99, inclusive
-
Returns the value of given list of numbers at the given percentile.
- Error
-
If the given list of numbers is empty or percent is not in range.
- Definition
-
(population-standard-deviation list-numbers [mean])
- Description
-
-
list-numbers- list of numbers -
mean- optional value of mean, to avoid recalculation
-
Returns population standard deviation of given list of numbers.
- Definition
-
(population-variance list-numbers [mean])
- Description
-
-
list-numbers- list of numbers -
mean- optional value of mean, to avoid recalculation
-
Returns population variance of given list of numbers.
- Definition
-
(standard-deviation list-numbers [mean])
- Description
-
-
list-numbers- list of numbers -
mean- optional value of mean, to avoid recalculation
-
Returns standard deviation of given list of numbers.
- Definition
-
(variance list-numbers [mean])
- Description
-
-
list-numbers- list of numbers -
mean- optional value of mean, to avoid recalculation
-
Returns variance of given list of numbers.
- Definition
-
(coefficient-of-variation list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns coefficient of variation of given list of numbers.
- Definition
-
(standard-error-of-the-mean list-numbers)
- Description
-
-
list-numbers- list of numbers
-
Returns standard-error of the mean of given list of numbers.
- Definition
-
(combinations n k)
- Description
-
-
n- positive integer, size of set -
k- positive integer, number to select
-
Returns the number of ways to take k things from n without replacement when order does not matter.
- Definition
-
(permutations n k)
- Description
-
-
n- positive integer, size of set -
k- positive integer, number to select
-
Returns the number of ways to take k things from n without replacement when order does matter.
- Definition
-
(sign x)
- Description
-
-
x- a number
-
Returns 0 if x is zero, -1 if x is negative, or 1 if x is positive.
Returns () if x is not a number.
- Definition
-
(perlin-noise x-in y-in z-in)
- Description
-
-
x-in- x coordinate in range 0 to 255 -
y-in- y coordinate in range 0 to 255 -
z-in- z coordinate in range 0 to 255
-
Returns a noise value for (x, y, z) value, based on http://mrl.nyu.edu/~perlin/noise/
- Definition
-
(random-normal mu sigma)
- Description
-
-
mu- mean value for Normal distribution -
sigma- standard deviation for Normal distribution
-
Returns a random number, normally distributed with given mean and standard-deviation.
- Definition
-
(random-pick list-items)
- Description
-
-
list-items- list of items
-
Returns a random item from given list, or #f if list is empty or argument is not a list.
- Definition
-
(random-sample n list-items)
- Description
-
-
n- number of items to select -
list-items- list of items
-
Returns two values: a random sample of n items from given list without
replacement, and the remaining items. If n is greater than the size of the
list, returns the items in the list in a random order.
- Example
gosh[r7rs.user]$ (random-sample 3 '(1 2 3 4 5 6)) (6 5 4) (1 2 3) gosh[r7rs.user]$ (random-sample 30 '(1 2 3 4 5 6)) (2 1 5 4 3 6) ()
- Definition
-
(random-weighted-sample n list-items list-weights)
- Description
-
-
n- number of items to select -
list-items- list of items -
list-weights- list of numeric values given weight for each item
-
Returns a random sample of n items from given list without replacement, using
given weighting.
- Definition
-
(shuffle list-items)
- Description
-
-
list-items- list of items
-
Returns the items of the list in a random order.
- Definition
-
(jaccard-index items-1 items-2 [equals?])
- Description
-
-
items-1- list of items, treated as a set -
items-2- list of items, treated as a set -
equals?- optional equals test, defaults toequal?
-
Returns the Jaccard Index comparing the two sets of items.
- Definition
-
(jaccard-distance items-1 items-2 [equals?])
- Description
-
-
items-1- list of items, treated as a set -
items-2- list of items, treated as a set -
equals?- optional equals test, defaults toequal?
-
Returns the Jaccard Distance comparing the two sets of items.
- Definition
-
(sorenson-dice-index items-1 items-2 [equals?])
- Description
-
-
items-1- list of items, treated as a set -
items-2- list of items, treated as a set -
equals?- optional equals test, defaults toequal?
-
Returns the Sorenson Dice Index comparing the two sets of items.
(robin text)
- Definition
-
(word-wrap str width)
- Description
-
-
str- given string to convert into lines, should not contain newline characters. -
width- the maximum length for a returned line.
-
Returns a list of strings, each string up to the given width in length. Words are split on ASCII spaces.
(words→with-commas words [add-comma?])
- Description
-
-
words- a list of strings, each string being a term to join with commas -
add-comma?- optional flag to indicate if there should be a comma before the final "and".
-
Returns a string with each word separated by a comma, except for the last pair which uses "and".
- Definition
-
(string→n-grams str n)
- Description
-
-
str- string to convert to n-grams -
n- size of n-gram
-
Returns a list of strings, each string of size n characters.
- Error
-
If
nis not >= 1.
- Definition
-
(daitch-mokotoff-soundex word [option])
- Description
-
-
word- string representing word to analyse -
option- optional flag to indicate if single or multiple values should be returned, defaults to the symbolsingle, with any other value meaning multiple.
-
Returns one or more phonetic representations of the given word, based on the table at http://www.jewishgen.org/InfoFiles/soundex.html
- Definition
-
(metaphone word)
- Description
-
-
word- string representing word to analyse
-
Returns phonetic representation of the given word, based on the description at http://aspell.net/metaphone/metaphone-kuhn.txt
- Definition
-
(russell-soundex word)
Same as soundex.
- Definition
-
(soundex word)
- Description
-
-
word- string representing word to analyse
-
Returns a phonetic representation of the given word, using the soundex algorithm (from Knuth, Vol. 3 "Sorting and searching", pp 391—2).
- Definition
-
(hamming-distance item-1 item-2 [equals?])
- Description
-
-
item-1- first sequence -
item-2- second sequence -
equals?- optional equality operator for items of sequence
-
Returns the hamming distance between the two given sequences, which is the number of substitutions required to convert the first sequence into the second.
- Error
-
If two given sequences:
-
are not string, list, vector or bytevector,
-
are different types, or
-
are different sizes.
-
- Definition
-
(levenshtein-distance item-1 item-2 [equals?])
- Description
-
-
item-1- first sequence -
item-2- second sequence -
equals?- optional equality operator for items of sequence
-
Returns the levenshtein distance between the two given sequences, which is the number which is the number of substitutions/deletions/insertions required to convert the first sequence into the second.
- Error
-
If two given sequences:
-
are not string, list, vector or bytevector,
-
are different types, or
-
are different sizes.
-
- Definition
-
(optimal-string-alignment-distance item-1 item-2 [equals?])
- Description
-
-
item-1- first sequence -
item-2- second sequence -
equals?- optional equality operator for items of sequence
-
Returns the optimal-string-alignment distance between the two given sequences, which is the number of substitutions/deletions/insertions/transpositions required to convert the first sequence into the second.
- Error
-
If two given sequences:
-
are not string, list, vector or bytevector,
-
are different types, or
-
are different sizes.
-
- Definition
-
(sorenson-dice-similarity string-1 string-2 [n])
- Description
-
-
string-1- the first string -
string-2- the second string -
n- optional n-gram size, defaults to 3
-
Returns the Sorenson Dice Index of the two given strings, when divided into n-grams.
- Definition
-
(porter-stem word)
- Description
-
-
word- a string word, ASCII characters only.
-
Returns the given word reduced to its stem, following the Porter Stem algorithm: https://tartarus.org/martin/PorterStemmer/
- Definition
-
(generate-password size [allow-duplicates? use-lowercase? use-numbers? use-symbols? use-uppercase?])
- Description
-
-
size- length of password to generate -
allow-duplicates?- flag to indicate if duplicates are permitted -
use-lowercase?- flag to include lower case letters -
use-numbers?- flag to include numbers -
use-symbols?- flag to include symbols -
use-uppercase?- flag to include upper case letters
-
Returns two values, a randomly generated password of required size and its entropy. If no options are indicated, then all character groups are included with duplicates permitted.
- Error
-
If options prohibit construction of a password.