Contents

randomSplit(by:seed:)

Generates two AnnotatedFeatures by randomly splitting the elements of the sequence, at the same proportion within each unique Annotation.

Declaration

func randomSplit<Feature, Annotation>(by proportion: Double, seed: Int? = nil) -> ([AnnotatedFeature<Feature, Annotation>], [AnnotatedFeature<Feature, Annotation>]) where Annotation : Hashable, Self.Element == AnnotatedFeature<Feature, Annotation>

Parameters

  • proportion:

    A proportion in the range [0.0, 1.0].

  • seed:

    A seed number for a random-number generator.

Return Value

A tuple of arrays.