Documentation ¶
Overview ¶
Package inputsample provides an implementation of set.Sample that is read from an io.Reader.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(r io.Reader, features []feature.Feature, featureValueRequester FeatureValueRequester, undefinedValue string) set.Sample
New takes an io.Reader, a slice of features, a FeatureValueRequester and an undefinedValue coding string and returns a Sample.
The returned Sample ValueFor method reads feature values first requesting them with the given FeatureValueRequester and then parsing the values from the reader.
The parsing expects each value to be presented ending with the '\n' character, that is in new lines. Also, the undefinedValue string followed by the '\n' character will be interpreted as an undefined value.
For a feature.ContinuousFeature, lines will be read from the reader until a line containing a valid float64 number is found.
For a feature.DiscreteFeature, lines will be read from the reader until a line with a valid value for the feature is found.
For both kind of feature.Feature, non accepted values will be rejected with the FeatureValueRequester's RejectValueFor method.
Attempting to obtain a value for Feature not in the given features slice, or for another type of feature will return nil.