public class MinHashLSH extends Estimator<T> implements HasSeed
The input can be dense or sparse vectors, but it is more efficient if it is sparse. For example,
Vectors.sparse(10, Array((2, 1.0), (3, 1.0), (5, 1.0)))
means there are 10 elements in the space. This set contains elements 2, 3, and 5. Also, any
input vector must have at least 1 non-zero index, and all non-zero values are
treated as binary "1" values.
References: Wikipedia on MinHash
| Constructor and Description |
|---|
MinHashLSH() |
MinHashLSH(String uid) |
| Modifier and Type | Method and Description |
|---|---|
MinHashLSH |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
T |
fit(Dataset<?> dataset)
Fits a model to the input data.
|
Param<String> |
inputCol()
Param for input column name.
|
static MinHashLSH |
load(String path) |
IntParam |
numHashTables()
Param for the number of hash tables used in LSH OR-amplification.
|
Param<String> |
outputCol()
Param for output column name.
|
static MLReader<T> |
read() |
LongParam |
seed()
Param for random seed.
|
MinHashLSH |
setInputCol(String value) |
MinHashLSH |
setNumHashTables(int value) |
MinHashLSH |
setOutputCol(String value) |
MinHashLSH |
setSeed(long value) |
StructType |
transformSchema(StructType schema)
Check transform validity and derive the output schema from the input schema.
|
String |
uid()
An immutable unique ID for the object and its derivatives.
|
paramsequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwntoStringgetNumHashTables, validateAndTransformSchemagetInputColgetOutputColwritesave$init$, initializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, initLock, isTraceEnabled, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning, org$apache$spark$internal$Logging$$log__$eq, org$apache$spark$internal$Logging$$log_, uninitializepublic static MinHashLSH load(String path)
public static MLReader<T> read()
public final LongParam seed()
HasSeedpublic String uid()
Identifiableuid in interface Identifiablepublic MinHashLSH setInputCol(String value)
public MinHashLSH setOutputCol(String value)
public MinHashLSH setNumHashTables(int value)
public MinHashLSH setSeed(long value)
public StructType transformSchema(StructType schema)
PipelineStage
We check validity for interactions between parameters during transformSchema and
raise an exception if any parameter value is invalid. Parameter value checks which
do not depend on other parameters are handled by Param.validate().
Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.
transformSchema in class PipelineStageschema - (undocumented)public MinHashLSH copy(ParamMap extra)
ParamsdefaultCopy().copy in interface Paramscopy in class Estimator<MinHashLSHModel>extra - (undocumented)public T fit(Dataset<?> dataset)
Estimatorpublic final Param<String> inputCol()
HasInputColinputCol in interface HasInputColpublic final IntParam numHashTables()
LSHParamsLSH OR-amplification can be used to reduce the false negative rate. Higher values for this param lead to a reduced false negative rate, at the expense of added computational complexity.
numHashTables in interface LSHParamspublic final Param<String> outputCol()
HasOutputColoutputCol in interface HasOutputCol