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.
|
params
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
toString
getNumHashTables, validateAndTransformSchema
getInputCol
getOutputCol
write
save
$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_, uninitialize
public static MinHashLSH load(String path)
public static MLReader<T> read()
public final LongParam seed()
HasSeed
public String uid()
Identifiable
uid
in interface Identifiable
public 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 PipelineStage
schema
- (undocumented)public MinHashLSH copy(ParamMap extra)
Params
defaultCopy()
.copy
in interface Params
copy
in class Estimator<MinHashLSHModel>
extra
- (undocumented)public T fit(Dataset<?> dataset)
Estimator
public final Param<String> inputCol()
HasInputCol
inputCol
in interface HasInputCol
public final IntParam numHashTables()
LSHParams
LSH 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 LSHParams
public final Param<String> outputCol()
HasOutputCol
outputCol
in interface HasOutputCol