Class FeatureVector


  • public class FeatureVector
    extends java.lang.Object
    Stores a feature vector that can be predicted by a Learn model.
    • Constructor Detail

      • FeatureVector

        public FeatureVector​(double[] featureValues)
        Creates the feature vector.
        Parameters:
        featureValues - - the feature values. Not null.
        Throws:
        java.lang.IllegalArgumentException - if featureValues is null, empty, or contains an invalid value. All values must be between 0 and 1, or -1 for an empty feature.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getFeatureValues

        public double[] getFeatureValues()
        Returns:
        a copy of the feature values array.
      • getNFeatures

        public int getNFeatures()
        Returns:
        the number of features in the feature vector.
      • predict

        public RLinkOut predict​(int modelId,
                                PredictOptions predictOpts)
        Calculates prediction using the given model and options.
        Parameters:
        modelId - - ID of an existing RLink model.
        predictOpts - - the options to use for this prediction. If null, uses default uptions.
        Returns:
        the RLink prediction for this feature vector.