Record Class Bag
java.lang.Object
java.lang.Record
smile.validation.Bag
- Record Components:
samples- the random samples.oob- the out of bag samples.
- All Implemented Interfaces:
Serializable
A bag of random selected samples.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.int[]oob()Returns the value of theoobrecord component.int[]samples()Returns the value of thesamplesrecord component.static Bagsplit(int n, double holdout) Splits samples into random train and test subsets.Splits a data frame into random train and test subsets.Stratified splitting a data frame into random train and test subsets.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Bag
-
-
Method Details
-
split
Splits samples into random train and test subsets.- Parameters:
n- the number of samples.holdout- the proportion of samples in the test split.- Returns:
- the sample split.
-
split
-
stratify
public static Tuple2<DataFrame, DataFrame> stratify(DataFrame data, String category, double holdout) Stratified splitting a data frame into random train and test subsets.- Parameters:
data- the data frame.category- the column as the strata label.holdout- the proportion of samples in the test split.- Returns:
- the data splits.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
samples
-
oob
-