On this page:
2.1 Types and Predicates
individual?
2.2 Construction
make-individual
data-set-individual
2.3 Partition Generator
no-more-individuals
individuals

2 Module rml/individual

 (require rml/individual) package: rml-core

This module implements a single type, individual, that is simply a constrained hash. The hash is constrained to have keys that are all strings, and should have the same keys as the union of feature and classifier names from the data set it will be used with. This module also provides a generator to return individuals for all rows in a partition.

Examples:
> (require rml/individual)
> (define iris
    (make-individual
     "sepal-length" 6.3
     "sepal-width" 2.5
     "petal-length" 4.9
     "petal-width" 1.5
     "classification" "Iris-versicolor"))
> (displayln (individual? iris))

#t

> (displayln (hash-keys iris))

(sepal-width sepal-length classification petal-width petal-length)

This code block shows the creation of a simple individual matching the Iris data set.

2.1 Types and Predicates

predicate

(individual? a)  boolean?

  a : any/c
Returns #t if the value a is an individual.

2.2 Construction

constructor

(make-individual key    
  val ...    
  ...    
  #:data-set data-set?)  individual?
  key : any/c
  val : any/c
  data-set? : #f
Creates an immutable individual in much the same way as the standard hash procedure, taking an even number of parameters assumed to be a repeating pair of key value. In this case however all keys will be checked to ensure they are strings.

If specified, the value for the keyword parameter #:data-set will be used to validate the names of the individual against the names of features and classifiers in the corresponding data set.

constructor

(data-set-individual dataset)  individual?

  dataset : data-set?
Creates a mutable individual by taking all the names from the features and classifiers from dataset. All values are initialized to #f.

Examples:
> (define blank-iris (data-set-individual dataset))
> (displayln (individual? blank-iris))

#t

> (displayln (hash-keys blank-iris))

(classification sepal-width sepal-length petal-length petal-width)

2.3 Partition Generator

value

no-more-individuals : symbol?

A symbol that acts as the stop-value for individuals.

generator

(individuals dataset partition-id)  generator?

  dataset : data-set?
  partition-id : exact-nonnegative-integer?
This procedure implements a generator and returns each row of a partition as an individual.

Example:
> (for ([row (in-producer (individuals dataset 0) no-more-individuals)])
    (displayln row))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 5.1) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 4.9) (sepal-width . 3.0))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.2) (sepal-length . 4.7) (sepal-width . 3.2))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 4.6) (sepal-width . 3.1))

#hash((classification . Iris-setosa) (petal-length . 1.7) (petal-width . 0.4) (sepal-length . 5.4) (sepal-width . 3.9))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.3) (sepal-length . 4.6) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 5.0) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 4.4) (sepal-width . 2.9))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.1) (sepal-length . 4.9) (sepal-width . 3.1))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 5.4) (sepal-width . 3.7))

#hash((classification . Iris-setosa) (petal-length . 1.6) (petal-width . 0.2) (sepal-length . 4.8) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.1) (sepal-length . 4.8) (sepal-width . 3.0))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.4) (sepal-length . 5.7) (sepal-width . 4.4))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.4) (sepal-length . 5.4) (sepal-width . 3.9))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.3) (sepal-length . 5.1) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.7) (petal-width . 0.3) (sepal-length . 5.7) (sepal-width . 3.8))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.3) (sepal-length . 5.1) (sepal-width . 3.8))

#hash((classification . Iris-setosa) (petal-length . 1.7) (petal-width . 0.2) (sepal-length . 5.4) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.4) (sepal-length . 5.1) (sepal-width . 3.7))

#hash((classification . Iris-setosa) (petal-length . 1.0) (petal-width . 0.2) (sepal-length . 4.6) (sepal-width . 3.6))

#hash((classification . Iris-setosa) (petal-length . 1.7) (petal-width . 0.5) (sepal-length . 5.1) (sepal-width . 3.3))

#hash((classification . Iris-setosa) (petal-length . 1.9) (petal-width . 0.2) (sepal-length . 4.8) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.6) (petal-width . 0.2) (sepal-length . 5.0) (sepal-width . 3.0))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 5.2) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 5.2) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.6) (petal-width . 0.2) (sepal-length . 4.7) (sepal-width . 3.2))

#hash((classification . Iris-setosa) (petal-length . 1.6) (petal-width . 0.2) (sepal-length . 4.8) (sepal-width . 3.1))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.4) (sepal-length . 5.4) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.1) (sepal-length . 5.2) (sepal-width . 4.1))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 5.5) (sepal-width . 4.2))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.1) (sepal-length . 4.9) (sepal-width . 3.1))

#hash((classification . Iris-setosa) (petal-length . 1.2) (petal-width . 0.2) (sepal-length . 5.0) (sepal-width . 3.2))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.2) (sepal-length . 5.5) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.1) (sepal-length . 4.9) (sepal-width . 3.1))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.2) (sepal-length . 4.4) (sepal-width . 3.0))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 5.1) (sepal-width . 3.4))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.3) (sepal-length . 5.0) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.3) (sepal-length . 4.5) (sepal-width . 2.3))

#hash((classification . Iris-setosa) (petal-length . 1.3) (petal-width . 0.2) (sepal-length . 4.4) (sepal-width . 3.2))

#hash((classification . Iris-setosa) (petal-length . 1.6) (petal-width . 0.6) (sepal-length . 5.0) (sepal-width . 3.5))

#hash((classification . Iris-setosa) (petal-length . 1.9) (petal-width . 0.4) (sepal-length . 5.1) (sepal-width . 3.8))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.3) (sepal-length . 4.8) (sepal-width . 3.0))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 4.6) (sepal-width . 3.2))

#hash((classification . Iris-setosa) (petal-length . 1.5) (petal-width . 0.2) (sepal-length . 5.3) (sepal-width . 3.7))

#hash((classification . Iris-setosa) (petal-length . 1.4) (petal-width . 0.2) (sepal-length . 5.0) (sepal-width . 3.3))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.5) (sepal-length . 6.4) (sepal-width . 3.2))

#hash((classification . Iris-versicolor) (petal-length . 4.9) (petal-width . 1.5) (sepal-length . 6.9) (sepal-width . 3.1))

#hash((classification . Iris-versicolor) (petal-length . 4.0) (petal-width . 1.3) (sepal-length . 5.5) (sepal-width . 2.3))

#hash((classification . Iris-versicolor) (petal-length . 4.6) (petal-width . 1.5) (sepal-length . 6.5) (sepal-width . 2.8))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.3) (sepal-length . 5.7) (sepal-width . 2.8))

#hash((classification . Iris-versicolor) (petal-length . 4.7) (petal-width . 1.6) (sepal-length . 6.3) (sepal-width . 3.3))

#hash((classification . Iris-versicolor) (petal-length . 4.6) (petal-width . 1.3) (sepal-length . 6.6) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 3.9) (petal-width . 1.4) (sepal-length . 5.2) (sepal-width . 2.7))

#hash((classification . Iris-versicolor) (petal-length . 3.5) (petal-width . 1.0) (sepal-length . 5.0) (sepal-width . 2.0))

#hash((classification . Iris-versicolor) (petal-length . 4.2) (petal-width . 1.5) (sepal-length . 5.9) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.0) (petal-width . 1.0) (sepal-length . 6.0) (sepal-width . 2.2))

#hash((classification . Iris-versicolor) (petal-length . 4.7) (petal-width . 1.4) (sepal-length . 6.1) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 3.6) (petal-width . 1.3) (sepal-length . 5.6) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 4.4) (petal-width . 1.4) (sepal-length . 6.7) (sepal-width . 3.1))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.5) (sepal-length . 5.6) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.1) (petal-width . 1.0) (sepal-length . 5.8) (sepal-width . 2.7))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.5) (sepal-length . 6.2) (sepal-width . 2.2))

#hash((classification . Iris-versicolor) (petal-length . 4.8) (petal-width . 1.8) (sepal-length . 5.9) (sepal-width . 3.2))

#hash((classification . Iris-versicolor) (petal-length . 4.0) (petal-width . 1.3) (sepal-length . 6.1) (sepal-width . 2.8))

#hash((classification . Iris-versicolor) (petal-length . 4.7) (petal-width . 1.2) (sepal-length . 6.1) (sepal-width . 2.8))

#hash((classification . Iris-versicolor) (petal-length . 4.3) (petal-width . 1.3) (sepal-length . 6.4) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 4.4) (petal-width . 1.4) (sepal-length . 6.6) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.8) (petal-width . 1.4) (sepal-length . 6.8) (sepal-width . 2.8))

#hash((classification . Iris-versicolor) (petal-length . 5.0) (petal-width . 1.7) (sepal-length . 6.7) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.5) (sepal-length . 6.0) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 3.5) (petal-width . 1.0) (sepal-length . 5.7) (sepal-width . 2.6))

#hash((classification . Iris-versicolor) (petal-length . 3.8) (petal-width . 1.1) (sepal-length . 5.5) (sepal-width . 2.4))

#hash((classification . Iris-versicolor) (petal-length . 3.7) (petal-width . 1.0) (sepal-length . 5.5) (sepal-width . 2.4))

#hash((classification . Iris-versicolor) (petal-length . 3.9) (petal-width . 1.2) (sepal-length . 5.8) (sepal-width . 2.7))

#hash((classification . Iris-versicolor) (petal-length . 5.1) (petal-width . 1.6) (sepal-length . 6.0) (sepal-width . 2.7))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.5) (sepal-length . 5.4) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.5) (petal-width . 1.6) (sepal-length . 6.0) (sepal-width . 3.4))

#hash((classification . Iris-versicolor) (petal-length . 4.7) (petal-width . 1.5) (sepal-length . 6.7) (sepal-width . 3.1))

#hash((classification . Iris-versicolor) (petal-length . 4.4) (petal-width . 1.3) (sepal-length . 6.3) (sepal-width . 2.3))

#hash((classification . Iris-versicolor) (petal-length . 4.1) (petal-width . 1.3) (sepal-length . 5.6) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.0) (petal-width . 1.3) (sepal-length . 5.5) (sepal-width . 2.5))

#hash((classification . Iris-versicolor) (petal-length . 4.4) (petal-width . 1.2) (sepal-length . 5.5) (sepal-width . 2.6))

#hash((classification . Iris-versicolor) (petal-length . 4.6) (petal-width . 1.4) (sepal-length . 6.1) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.0) (petal-width . 1.2) (sepal-length . 5.8) (sepal-width . 2.6))

#hash((classification . Iris-versicolor) (petal-length . 4.2) (petal-width . 1.3) (sepal-length . 5.6) (sepal-width . 2.7))

#hash((classification . Iris-versicolor) (petal-length . 4.2) (petal-width . 1.2) (sepal-length . 5.7) (sepal-width . 3.0))

#hash((classification . Iris-versicolor) (petal-length . 4.2) (petal-width . 1.3) (sepal-length . 5.7) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 4.3) (petal-width . 1.3) (sepal-length . 6.2) (sepal-width . 2.9))

#hash((classification . Iris-versicolor) (petal-length . 3.0) (petal-width . 1.1) (sepal-length . 5.1) (sepal-width . 2.5))

#hash((classification . Iris-versicolor) (petal-length . 4.1) (petal-width . 1.3) (sepal-length . 5.7) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 6.0) (petal-width . 2.5) (sepal-length . 6.3) (sepal-width . 3.3))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 1.9) (sepal-length . 5.8) (sepal-width . 2.7))

#hash((classification . Iris-virginica) (petal-length . 5.9) (petal-width . 2.1) (sepal-length . 7.1) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 1.8) (sepal-length . 6.3) (sepal-width . 2.9))

#hash((classification . Iris-virginica) (petal-length . 5.8) (petal-width . 2.2) (sepal-length . 6.5) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 6.6) (petal-width . 2.1) (sepal-length . 7.6) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 6.3) (petal-width . 1.8) (sepal-length . 7.3) (sepal-width . 2.9))

#hash((classification . Iris-virginica) (petal-length . 5.8) (petal-width . 1.8) (sepal-length . 6.7) (sepal-width . 2.5))

#hash((classification . Iris-virginica) (petal-length . 6.1) (petal-width . 2.5) (sepal-length . 7.2) (sepal-width . 3.6))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 2.0) (sepal-length . 6.5) (sepal-width . 3.2))

#hash((classification . Iris-virginica) (petal-length . 5.3) (petal-width . 1.9) (sepal-length . 6.4) (sepal-width . 2.7))

#hash((classification . Iris-virginica) (petal-length . 5.5) (petal-width . 2.1) (sepal-length . 6.8) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.0) (petal-width . 2.0) (sepal-length . 5.7) (sepal-width . 2.5))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 2.4) (sepal-length . 5.8) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 5.3) (petal-width . 2.3) (sepal-length . 6.4) (sepal-width . 3.2))

#hash((classification . Iris-virginica) (petal-length . 5.5) (petal-width . 1.8) (sepal-length . 6.5) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 6.7) (petal-width . 2.2) (sepal-length . 7.7) (sepal-width . 3.8))

#hash((classification . Iris-virginica) (petal-length . 5.0) (petal-width . 1.5) (sepal-length . 6.0) (sepal-width . 2.2))

#hash((classification . Iris-virginica) (petal-length . 5.7) (petal-width . 2.3) (sepal-length . 6.9) (sepal-width . 3.2))

#hash((classification . Iris-virginica) (petal-length . 4.9) (petal-width . 1.8) (sepal-length . 6.3) (sepal-width . 2.7))

#hash((classification . Iris-virginica) (petal-length . 5.7) (petal-width . 2.1) (sepal-length . 6.7) (sepal-width . 3.3))

#hash((classification . Iris-virginica) (petal-length . 6.0) (petal-width . 1.8) (sepal-length . 7.2) (sepal-width . 3.2))

#hash((classification . Iris-virginica) (petal-length . 4.8) (petal-width . 1.8) (sepal-length . 6.2) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 2.1) (sepal-length . 6.4) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 5.8) (petal-width . 1.6) (sepal-length . 7.2) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 6.1) (petal-width . 1.9) (sepal-length . 7.4) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 6.4) (petal-width . 2.0) (sepal-length . 7.9) (sepal-width . 3.8))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 2.2) (sepal-length . 6.4) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 1.5) (sepal-length . 6.3) (sepal-width . 2.8))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 1.4) (sepal-length . 6.1) (sepal-width . 2.6))

#hash((classification . Iris-virginica) (petal-length . 6.1) (petal-width . 2.3) (sepal-length . 7.7) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 2.4) (sepal-length . 6.3) (sepal-width . 3.4))

#hash((classification . Iris-virginica) (petal-length . 5.5) (petal-width . 1.8) (sepal-length . 6.4) (sepal-width . 3.1))

#hash((classification . Iris-virginica) (petal-length . 4.8) (petal-width . 1.8) (sepal-length . 6.0) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.4) (petal-width . 2.1) (sepal-length . 6.9) (sepal-width . 3.1))

#hash((classification . Iris-virginica) (petal-length . 5.6) (petal-width . 2.4) (sepal-length . 6.7) (sepal-width . 3.1))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 2.3) (sepal-length . 6.9) (sepal-width . 3.1))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 1.9) (sepal-length . 5.8) (sepal-width . 2.7))

#hash((classification . Iris-virginica) (petal-length . 5.9) (petal-width . 2.3) (sepal-length . 6.8) (sepal-width . 3.2))

#hash((classification . Iris-virginica) (petal-length . 5.7) (petal-width . 2.5) (sepal-length . 6.7) (sepal-width . 3.3))

#hash((classification . Iris-virginica) (petal-length . 5.2) (petal-width . 2.3) (sepal-length . 6.7) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.0) (petal-width . 1.9) (sepal-length . 6.3) (sepal-width . 2.5))

#hash((classification . Iris-virginica) (petal-length . 5.2) (petal-width . 2.0) (sepal-length . 6.5) (sepal-width . 3.0))

#hash((classification . Iris-virginica) (petal-length . 5.4) (petal-width . 2.3) (sepal-length . 6.2) (sepal-width . 3.4))

#hash((classification . Iris-virginica) (petal-length . 5.1) (petal-width . 1.8) (sepal-length . 5.9) (sepal-width . 3.0))