DBSCAN
Operation | Computational methods | Programming Interface |
Mathematical formulation
Programming Interface
- template<typenameFloat= float, typenameMethod= method::by_default, typenameTask= task::by_default>classdescriptor
- Template Parameters
- Float– The floating-point type that the algorithm uses for intermediate computations. Can befloatordouble.
- Method– Tag-type that specifies an implementation of algorithm. Can bemethod::brute_force.
- Task– Tag-type that specifies the type of the problem to solve. Can betask::clustering.
Constructors- descriptor(doubleepsilon, std::int64_tmin_observations)
- Creates a new instance of the class with the givenepsilon,min_observations.
Properties- std::int64_tmin_observations
- The number of neighbors.
- Getter & Setter
std::int64_t get_min_observations() const
auto & set_min_observations(int64_t value)
- boolmem_save_mode
- The flag for memory saving mode.
- Getter & Setter
bool get_mem_save_mode() const
auto & set_mem_save_mode(bool value)
- doubleepsilon
- The distanceepsilonfor neighbor search.
- Getter & Setter
double get_epsilon() const
auto & set_epsilon(double value)
- Invariants
epsilon >= 0.0
- result_option_idresult_options
- Choose which results should be computed and returned.
- Getter & Setter
result_option_id get_result_options() const
auto & set_result_options(const result_option_id &value)
- structbrute_force
- structclustering
- Tag-type that parameterizes entities used for solving clustering problem.
- Alias tag-type for the clustering task.
- Template Parameters
- Task– Tag-type that specifies type of the problem to solve. Can betask::clustering.
ConstructorsProperties- A single column table with the weights, where each row stores one weight per observation.
- Getter & Setter
const table & get_weights() const
auto & set_weights(const table &weights)
- An
table with the data to be clustered, where each row stores one feature vector.
- Getter & Setter
const table & get_data() const
auto & set_data(const table &data)
- Template Parameters
- Task– Tag-type that specifies type of the problem to solve. Can betask::clustering.
Constructors- compute_result()
- Creates a new instance of the class with the default property values.
Properties- An
table with the core observations in the input data.
is a number of core observations.
- Getter & Setter
const table & get_core_observations() const
auto & set_core_observations(const table &value)
- constresult_option_id &result_options
- Result options that indicates availability of the properties.Default value: default_result_options<Task>.
- Getter & Setter
const result_option_id & get_result_options() const
auto & set_result_options(const result_option_id &value)
- std::int64_tcluster_count
- The number of clusters found by the algorithm.
- Getter & Setter
std::int64_t get_cluster_count() const
auto & set_cluster_count(std::int64_t value)
- Invariants
cluster_count >= 0
- An
table with the indices of core observations in the input data.
is a number of core observations.
- Getter & Setter
const table & get_core_observation_indices() const
auto & set_core_observation_indices(const table &value)
- An
table with the responses
assigned to the samples
in the input data.
Default value: table{}.- Getter & Setter
const table & get_responses() const
auto & set_responses(const table &value)
- An
table with the core flags
assigned to the samples
in the input data.
- Getter & Setter
const table & get_core_flags() const
auto & set_core_flags(const table &value)
- template<typenameDescriptor> dbscan::compute_resultcompute(constDescriptor &desc,constdbscan::compute_input &input)
- Parameters
- desc– DBSCAN algorithm descriptordbscan::descriptor
- input– Input data for the compute operation
- Preconditions
input.data.has_data == true
!input.weights.has_data || input.weights.row_count == input.data.row_count && input.weights.column_count == 1
Usage example
void run_compute(const table& data,
const table& weights) {
double epsilon = 1.0;
std::int64_t max_observations = 5;
const auto dbscan_desc = kmeans::descriptor<float>{epsilon, max_observations}
.set_result_options(dal::dbscan::result_options::responses);
const auto result = compute(dbscan_desc, data, weights);
print_table("responses", result.get_responses());
}