Different Loaders.
More...
#include <mknn_dataset_loader.hpp>
|
static Dataset | Custom (DatasetCustom *custom_dataset, bool delete_custom_dataset_on_dataset_release, Domain domain) |
| Creates a new custom dataset. More...
|
|
static Dataset | PointerArray (void **object_array, long long num_objects, Domain domain) |
| Creates a new dataset from an array of objects. More...
|
|
static Dataset | PointerCompactVectors (void *vectors_header, long long num_vectors, long long vector_num_dimensions, const std::string vector_dimension_datatype) |
| Creates a new dataset from a data array. More...
|
|
static Dataset | ParseVectorFile (std::string filename, const std::string datatype) |
| Creates a new dataset by reading a text file with vectors. More...
|
|
static Dataset | ParseStringsFile (std::string filename) |
| Creates a new dataset by reading a text file with strings. More...
|
|
static DatasetConcatenate | Concatenate (const std::vector< Dataset > &subdatasets) |
| Creates a new dataset which is the concatenation of one or more datasets. More...
|
|
static Dataset | SubsetSegment (Dataset &superdataset, long long position_start, long long length) |
| Creates a new dataset which is a subset of a bigger dataset. More...
|
|
static Dataset | SubsetPositions (Dataset &superdataset, long long *positions, long long num_positions) |
| Creates a new dataset which is a subset of a bigger dataset. More...
|
|
static Dataset | UniformRandomVectors (long long num_objects, long long dimension, double dimension_minValueIncluded, double dimension_maxValueNotIncluded, const std::string datatype) |
| Creates a new dataset with random vectors of the given datatype. More...
|
|
static DatasetMultiObject | MultiObject (const std::vector< Dataset > &subdatasets) |
| Creates a new dataset where each object is a multi-object. More...
|
|
static Dataset | Empty (Domain domain) |
| Creates a new empty dataset that can dynamically grow as new objects are added. More...
|
|
Creates a new dataset which is the concatenation of one or more datasets.
- Parameters
-
subdatasets | the array of datasets |
delete_subdatasets_on_dataset_release | all subdatasets [i] must be released (by calling delete) during delete of the new dataset. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::Custom |
( |
DatasetCustom * |
custom_dataset, |
|
|
bool |
delete_custom_dataset_on_dataset_release, |
|
|
Domain |
domain |
|
) |
| |
|
static |
Creates a new custom dataset.
The custom dataset must implement the DatasetCustom abstract class.
- Parameters
-
custom_dataset | the object that stores and is used to obtain objects |
delete_custom_dataset_on_dataset_release | binds the lifetime of custom_dataset to the new dataset object |
domain | the domain for the objects returned by custom_dataset . |
delete_domain_on_dataset_release | binds the lifetime of domain to this dataset. |
- Returns
- a new dataset object
Creates a new empty dataset that can dynamically grow as new objects are added.
The new objects are added by Dataset::pushObject.
- Parameters
-
domain | the domain for the objects that will be added to this dataset. |
delete_domain_on_dataset_release | binds the lifetime of domain to this dataset. |
- Returns
- a new empty dataset (it must be released with delete).
Creates a new dataset where each object is a multi-object.
Each multi-object is created by combining one object of each subdataset. All datasets must contain the same number of objects.
- Parameters
-
subdatasets | the datasets from which multi-objects will be created. |
delete_subdatasets_on_dataset_release | all subdatasets [i] must be released (by calling delete) during delete of the new dataset. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::ParseStringsFile |
( |
std::string |
filename | ) |
|
|
static |
Creates a new dataset by reading a text file with strings.
The format is one string per line.
- Parameters
-
filename | the filename to read. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::ParseVectorFile |
( |
std::string |
filename, |
|
|
const std::string |
datatype |
|
) |
| |
|
static |
Creates a new dataset by reading a text file with vectors.
The format is one vector per line, each dimension separated by tab.
- Parameters
-
filename | the filename to read. |
datatype | the datatype of the objects. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::PointerArray |
( |
void ** |
object_array, |
|
|
long long |
num_objects, |
|
|
Domain |
domain |
|
) |
| |
|
static |
Creates a new dataset from an array of objects.
The objects are read from object_array
in the following order:
- first object:
object_array[0]
- second object:
object_array[1]
- ...
- last object:
object_array[num_objects - 1]
- Parameters
-
object_array | pointer to an array of objects. |
num_objects | number of object to read from the array. |
domain | the domain for the objects in the array. |
delete_domain_on_dataset_release | binds the lifetime of domain to this dataset. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::PointerCompactVectors |
( |
void * |
vectors_header, |
|
|
long long |
num_vectors, |
|
|
long long |
vector_num_dimensions, |
|
|
const std::string |
vector_dimension_datatype |
|
) |
| |
|
static |
Creates a new dataset from a data array.
The objects are read from vectors_header
in the following order:
- first object:
vectors_header
- second object:
vectors_header + vector_size
- ...
- last object:
vectors_header + (num_objects - 1) * vector_size
.
The value of vector_size
is determined by vector_num_dimensions
and vector_dimension_datatype
(see mknn::Domain::newVector and mknn::Domain::getVectorSizeInBytes).
- Parameters
-
vectors_header | pointer to the header of the set of vectors. |
num_vectors | number of object to read from vectors_header . |
vector_num_dimensions | number of dimensions of the vectors. |
vector_dimension_datatype | datatype for the vector values. See constants in mknn::Datatype. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::SubsetPositions |
( |
Dataset & |
superdataset, |
|
|
long long * |
positions, |
|
|
long long |
num_positions |
|
) |
| |
|
static |
Creates a new dataset which is a subset of a bigger dataset.
- Parameters
-
superdataset | the dataset to extract objects |
positions | each position of the objects to extract from superdataset . The positions are copied to an internal array. |
num_positions | length of array positions . it must be greater than zero. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::SubsetSegment |
( |
Dataset & |
superdataset, |
|
|
long long |
position_start, |
|
|
long long |
length |
|
) |
| |
|
static |
Creates a new dataset which is a subset of a bigger dataset.
- Parameters
-
superdataset | the dataset to extract objects |
position_start | position of the first objects to extract. |
length | number of consecutive objects to extract, starting from position_start . it must be greater than zero. |
- Returns
- a new dataset (it must be released with delete).
static Dataset mknn::DatasetLoader::UniformRandomVectors |
( |
long long |
num_objects, |
|
|
long long |
dimension, |
|
|
double |
dimension_minValueIncluded, |
|
|
double |
dimension_maxValueNotIncluded, |
|
|
const std::string |
datatype |
|
) |
| |
|
static |
Creates a new dataset with random vectors of the given datatype.
Each dimension is bounded in [0, dimension_max_value)
.
- Parameters
-
num_objects | desired size of the dataset. |
dimension | number of dimensions to generate. |
dimension_minValueIncluded | the minimum value for each dimension (included). |
dimension_maxValueNotIncluded | the maximum value for each dimension (not included). |
datatype | the datatype of the generated vectors. See constants in mknn::Datatype. |
- Returns
- a new dataset (it must be released with delete).
The documentation for this class was generated from the following file: