the in-memory sample data object
SampleData
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 6 | Create a new empty sample data object. |
| CheckInvalidNaN | 1 | Check whether an invalid NaN value is exists in the SampleData.features or the SampleData.labels vector? |
| ToString | 1 | Display the sample id in string format. |
| CreateDataSet | 1 | Create a training DataSet object from a collection of the SampleData objects. |
| TransformDataset | 1 | make dataset normalization |
| Save | 1 | Write the sample data collection into a binary Stream. |
| Load | 1 | Read the sample data collection back from a binary Stream which was written by the SampleData.Save()) method. |
03 Properties
04 Members
Create a new empty sample data object.
String, Double(), Double)Create a new sample data object with a single label value.
| Name | Type | Description |
|---|---|---|
id | String | The unique reference id of this sample. |
features | Double() | The sample features vector. |
label | Double | The single label value of this sample. |
make data copy from the given sample object, this constructor will assign the id, features and labels from the given sample data object.
Double())create the dataset for predictions, so no label data
| Name | Type | Description |
|---|---|---|
data | Double() | The input feature vector of this sample. |
Double(), Double)Create a new sample data object with a single label value, and no id is assigned.
| Name | Type | Description |
|---|---|---|
features | Double() | The sample features vector. |
label | Double | The single label value of this sample. |
Double(), Double())Create a new sample data object with multiple label values, and no id is assigned.
| Name | Type | Description |
|---|---|---|
features | Double() | The sample features vector. |
labels | Double() | The label values of this sample. |
Check whether an invalid NaN value is exists in the SampleData.features or the SampleData.labels vector?
True when a NaN value is detected, otherwise False.
Display the sample id in string format.
The SampleData.id value; a string in format like *(NaN!) id will be returned when the sample data contains an invalid NaN value.
IEnumerable(Of SampleData))Create a training DataSet object from a collection of the SampleData objects.
| Name | Type | Description |
|---|---|---|
ds | IEnumerable(Of SampleData) | A collection of the SampleData objects. |
A DataSet object, in which the feature names are generated in format x%d and the output names are generated in format y%d.
make dataset normalization
| Name | Type | Description |
|---|---|---|
trainset | SampleData() | The source sample data collection. |
is_generative | Boolean | Whether the label values should also be normalized? The label normalization is only applied when both this flag and the is_training flag are enabled. |
is_training | Boolean | Whether the trainset is the training data? When it is |
A sequence of the SampleData objects whose feature values are divided by the maximum value of each feature column.
IEnumerable(Of SampleData), Stream)Write the sample data collection into a binary Stream.
The binary layout of the output stream is: the feature vector size (int32), the label vector size (int32), and then each sample is written as its id string buffer, the features vector and the labels vector in network byte order.
| Name | Type | Description |
|---|---|---|
data | IEnumerable(Of SampleData) | A collection of the SampleData objects that will be written. |
file | Stream | The target output |
Stream)Read the sample data collection back from a binary Stream which was written by the SampleData.Save() method.
| Name | Type | Description |
|---|---|---|
file | Stream | The input |
A sequence of the SampleData objects.
the unique id
The unique reference id of this sample data.
The sample features vector, which is the input of the machine learning model.
An array of the feature values.
The sample label values, which is the expected output of the machine learning model.
An array of the label values.