DBSCANModel#

class spark_rapids_ml.clustering.DBSCANModel(n_cols: int, dtype: str, verbose: Union[int, bool])#

Methods

clear(param)

Reset a Spark ML Param to its default value, setting matching cuML parameter, if exists.

copy([extra])

cpu()

Return the equivalent PySpark CPU model

explainParam(param)

Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.

explainParams()

Returns the documentation of all params with their optionally default values and user-supplied values.

extractParamMap([extra])

Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.

getFeaturesCol()

Gets the value of featuresCol or featuresCols

getFeaturesCols()

Gets the value of featuresCols or its default value.

getIdCol()

Gets the value of idCol.

getOrDefault(param)

Gets the value of a param in the user-supplied param map or its default value.

getParam(paramName)

Gets a param by its name.

getPredictionCol()

Gets the value of predictionCol or its default value.

hasDefault(param)

Checks whether a param has a default value.

hasParam(paramName)

Tests whether this instance contains a param with a given (string) name.

isDefined(param)

Checks whether a param is explicitly set by user or has a default value.

isSet(param)

Checks whether a param is explicitly set by user.

load(path)

Reads an ML instance from the input path, a shortcut of read().load(path).

read()

save(path)

Save this ML instance to the given path, a shortcut of 'write().save(path)'.

set(param, value)

Sets a parameter in the embedded param map.

setFeaturesCol(value)

Sets the value of featuresCol or featuresCols.

setFeaturesCols(value)

Sets the value of featuresCols.

setIdCol(value)

Sets the value of idCol.

setPredictionCol(value)

Sets the value of predictionCol.

transform(dataset[, params])

Transforms the input dataset with optional parameters.

write()

Attributes

algorithm

calc_core_sample_indices

cuml_params

Returns the dictionary of parameters intended for the underlying cuML class.

eps

featuresCol

featuresCols

idCol

max_mbytes_per_batch

metric

min_samples

numFeatures

Returns the number of features the model was trained on.

num_workers

Number of cuML workers, where each cuML worker corresponds to one Spark task running on one GPU.

params

Returns all params ordered by name.

predictionCol

Methods Documentation

clear(param: Param) None#

Reset a Spark ML Param to its default value, setting matching cuML parameter, if exists.

copy(extra: Optional[ParamMap] = None) P#
cpu() Model#

Return the equivalent PySpark CPU model

explainParam(param: Union[str, Param]) str#

Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.

explainParams() str#

Returns the documentation of all params with their optionally default values and user-supplied values.

extractParamMap(extra: Optional[ParamMap] = None) ParamMap#

Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.

Parameters:
extradict, optional

extra param values

Returns:
dict

merged param map

getFeaturesCol() Union[str, List[str]]#

Gets the value of featuresCol or featuresCols

getFeaturesCols() List[str]#

Gets the value of featuresCols or its default value.

getIdCol() str#

Gets the value of idCol.

getOrDefault(param: Union[str, Param[T]]) Union[Any, T]#

Gets the value of a param in the user-supplied param map or its default value. Raises an error if neither is set.

getParam(paramName: str) Param#

Gets a param by its name.

getPredictionCol() str#

Gets the value of predictionCol or its default value.

hasDefault(param: Union[str, Param[Any]]) bool#

Checks whether a param has a default value.

hasParam(paramName: str) bool#

Tests whether this instance contains a param with a given (string) name.

isDefined(param: Union[str, Param[Any]]) bool#

Checks whether a param is explicitly set by user or has a default value.

isSet(param: Union[str, Param[Any]]) bool#

Checks whether a param is explicitly set by user.

classmethod load(path: str) RL#

Reads an ML instance from the input path, a shortcut of read().load(path).

classmethod read() MLReader#
save(path: str) None#

Save this ML instance to the given path, a shortcut of ‘write().save(path)’.

set(param: Param, value: Any) None#

Sets a parameter in the embedded param map.

setFeaturesCol(value: Union[str, List[str]]) P#

Sets the value of featuresCol or featuresCols.

setFeaturesCols(value: List[str]) P#

Sets the value of featuresCols. Used when input vectors are stored as multiple feature columns.

setIdCol(value: str) P#

Sets the value of idCol. If not set, an id column will be added with column name unique_id. The id column is used to specify dbscan vectors by associated id value.

setPredictionCol(value: str) P#

Sets the value of predictionCol.

transform(dataset: DataFrame, params: Optional[ParamMap] = None) DataFrame#

Transforms the input dataset with optional parameters.

New in version 1.3.0.

Parameters:
datasetpyspark.sql.DataFrame

input dataset

paramsdict, optional

an optional param map that overrides embedded params.

Returns:
pyspark.sql.DataFrame

transformed dataset

write() MLWriter#

Attributes Documentation

algorithm = Param(parent='undefined', name='algorithm', doc='The algorithm to be used by for nearest neighbor computations.')#
calc_core_sample_indices = Param(parent='undefined', name='calc_core_sample_indices', doc='Indicates whether the indices of the core samples should be calculated.Setting this to False will avoid unnecessary kernel launches')#
cuml_params#

Returns the dictionary of parameters intended for the underlying cuML class.

eps = Param(parent='undefined', name='eps', doc='The maximum distance between 2 points such they reside in the same neighborhood.')#
featuresCol: Param[str] = Param(parent='undefined', name='featuresCol', doc='features column name.')#
featuresCols = Param(parent='undefined', name='featuresCols', doc='features column names for multi-column input.')#
idCol = Param(parent='undefined', name='idCol', doc='id column name.')#
max_mbytes_per_batch = Param(parent='undefined', name='max_mbytes_per_batch', doc='Calculate batch size using no more than this number of megabytes for the pairwise distance computation.This enables the trade-off between runtime and memory usage for making the N^2 pairwise distance computations more tractable for large numbers of samples.If you are experiencing out of memory errors when running DBSCAN, you can set this value based on the memory size of your device.')#
metric = Param(parent='undefined', name='metric', doc="The metric to use when calculating distances between points.Spark Rapids ML does not support the 'precomputed' mode from sklearn and cuML, please use those libraries instead.")#
min_samples = Param(parent='undefined', name='min_samples', doc='The number of samples in a neighborhood such that this group can be considered as an important core point (including the point itself).')#
numFeatures#

Returns the number of features the model was trained on. If unknown, returns -1

num_workers#

Number of cuML workers, where each cuML worker corresponds to one Spark task running on one GPU.

params#

Returns all params ordered by name. The default implementation uses dir() to get all attributes of type Param.

predictionCol: Param[str] = Param(parent='undefined', name='predictionCol', doc='prediction column name.')#