org.apache.ignite.ml.structures

## Class LabeledVectorSet<Row extends LabeledVector>

- java.lang.Object
- - org.apache.ignite.ml.structures.Dataset<Row>
  - - org.apache.ignite.ml.structures.LabeledVectorSet<Row>

- All Implemented Interfaces:
    Externalizable, Serializable, AutoCloseable

      public class LabeledVectorSet<Row extends LabeledVector>
      extends Dataset<Row>
      implements AutoCloseable

  The set of labeled vectors used in local partition calculations.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.structures.Dataset

      `colSize, data, meta, rowSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LabeledVectorSet()` Default constructor (required by Externalizable).
    `LabeledVectorSet(double[][] mtx, double[] lbs)` Creates new local Labeled Dataset by matrix and vector of labels.
    `LabeledVectorSet(double[][] mtx, double[] lbs, String[] featureNames)` Creates new Labeled Dataset by matrix and vector of labels.
    `LabeledVectorSet(int rowSize, int colSize)` Creates new Labeled Dataset and initialized with empty data structure.
    `LabeledVectorSet(int rowSize, int colSize, String[] featureNames)` Creates new Labeled Dataset and initialized with empty data structure.
    `LabeledVectorSet(Row[] data)` Creates new Labeled Dataset by given data.
    `LabeledVectorSet(Row[] data, int colSize)` Creates new Labeled Dataset by given data.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes LabeledDataset.
    `LabeledVectorSet` | `copy()` Makes copy with new Label objects and old features and Metadata objects.
    `static Vector` | `emptyVector(int size)`
    `double` | `label(int idx)` Returns label if label is attached or null if label is missed.
    `double[]` | `labels()` Returns new copy of labels of all labeled vectors NOTE: This method is useful for copying labels from test dataset.
    `void` | `setLabel(int idx, double lb)` Fill the label with given value.

    - ### Methods inherited from class org.apache.ignite.ml.structures.Dataset

      `colSize, convertStringNamesToFeatureMetadata, data, equals, features, generateFeatureNames, getFeatureName, getRow, hashCode, meta, readExternal, rowSize, setData, setMeta, writeExternal`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LabeledVectorSet

          public LabeledVectorSet()

      Default constructor (required by Externalizable).

    - #### LabeledVectorSet

          public LabeledVectorSet(int rowSize,
                                  int colSize)

      Creates new Labeled Dataset and initialized with empty data structure.
      Parameters:
        `rowSize` - Amount of instances. Should be > 0.
        `colSize` - Amount of attributes. Should be > 0.

    - #### LabeledVectorSet

          public LabeledVectorSet(int rowSize,
                                  int colSize,
                                  String[] featureNames)

      Creates new Labeled Dataset and initialized with empty data structure.
      Parameters:
        `rowSize` - Amount of instances. Should be > 0.
        `colSize` - Amount of attributes. Should be > 0
        `featureNames` - Column names.

    - #### LabeledVectorSet

          public LabeledVectorSet(Row[] data)

      Creates new Labeled Dataset by given data.
      Parameters:
        `data` - Should be initialized with one vector at least.

    - #### LabeledVectorSet

          public LabeledVectorSet(Row[] data,
                                  int colSize)

      Creates new Labeled Dataset by given data.
      Parameters:
        `data` - Should be initialized with one vector at least.
        `colSize` - Amount of observed attributes in each vector.

    - #### LabeledVectorSet

          public LabeledVectorSet(double[][] mtx,
                                  double[] lbs)

      Creates new local Labeled Dataset by matrix and vector of labels.
      Parameters:
        `mtx` - Given matrix with rows as observations.
        `lbs` - Labels of observations.

    - #### LabeledVectorSet

          public LabeledVectorSet(double[][] mtx,
                                  double[] lbs,
                                  String[] featureNames)

      Creates new Labeled Dataset by matrix and vector of labels.
      Parameters:
        `mtx` - Given matrix with rows as observations.
        `lbs` - Labels of observations.
        `featureNames` - Column names.

  - ### Method Detail

    - #### label

          public double label(int idx)

      Returns label if label is attached or null if label is missed.
      Parameters:
        `idx` - Index of observation.
      Returns:
        Label.

    - #### labels

          public double[] labels()

      Returns new copy of labels of all labeled vectors NOTE: This method is useful for copying labels from test dataset.
      Returns:
        Copy of labels.

    - #### setLabel

          public void setLabel(int idx,
                               double lb)

      Fill the label with given value.
      Parameters:
        `idx` - Index of observation.
        `lb` - The given label.

    - #### emptyVector

          public static Vector emptyVector(int size)

    - #### copy

          public LabeledVectorSet copy()

      Makes copy with new Label objects and old features and Metadata objects.

    - #### close

          public void close()
                     throws Exception

      Closes LabeledDataset.
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `Exception`

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021