Documentation¶
Sample¶
-
class
outlierdenstream.
Sample
(value, timestamp: int)[source]¶ Each record of the stream has to be declared as a Sample class.
Parameters: - value – the values of the current sample.
- timestamp – the timestamp of current sample.
Micro-Cluster¶
-
class
outlierdenstream.
MicroCluster
(currenttimestamp, lamb, clusterNumber)[source]¶ Micro-Cluster class
Parameters: - currenttimestamp – the timestamp in which the cluster is created.
- lamb – the lamb parameter used as decay factor.
- clusterNumber – the number of the micro-cluster.
-
insertSample
(sample, timestamp=0)[source]¶ Adds a sample to a micro-cluster. Updates the variables of the micro-cluster with
updateRealTimeWeight()
andupdateRealTimeLSandSS()
Parameters: - sample – the sample object
- timestamp – deprecated, not needed anymore. Will be removed in the next versions.
-
noNewSamples
()[source]¶ Updates the Weighted Linear Sum (WLS), the Weighted Squared Sum (WSS) and the weight of the micro-cluster when no new samples are merged.
Cluster¶
OutlierDenStream¶
-
class
outlierdenstream.
OutlierDenStream
(lamb, epsilon=1, minPts=1, beta=1, mu=1, numberInitialSamples=None, startingBuffer=None, tp=60, radiusFactor=1)[source]¶ OutlierDenStream class.
Parameters: - lamb – the lambda parameter - fading factor
- epsilon – the epsilon parameter
- beta – the beta parameter
- mu – the mu parameter
- numberInitialSamples – samples to use as initial buffer
- startgingBuffer – initial buffer on which apply DBScan or use it as unique class.
- tp – frequency at which to apply the pruning strategy and remove old micro-clusters.
-
initWithoutDBScan
()[source]¶ Produces a micro-cluster merging all the samples passed into the initial buffer
If epsilon is auto computes epsilon as the maxium radius obtained from these initial samples.
-
resetLearningImpl
()[source]¶ Initializes two empty Cluster as a p-micro-cluter list and o-micro-cluster list.
If mu is auto computes the value
-
runDBSCanInitialization
()[source]¶ Initializes the variables of the main algorithm with the methods
resetLearningImpl()
andinitDBScan()
-
runInitialization
()[source]¶ Initializes the variables of the main algorithm with the methods
resetLearningImpl()
andinitWithoutDBScan()
-
runOnNewSample
(sample)[source]¶ Performs the basic DenStream procedure for merging new samples.
- Try to merge the sample to the closest core-micro-cluster (or)
- Try to merge the sample to the closest outlier-micro-cluster (or)
- Generate new outlier-micro-cluster by the sample
Parameters: sample – the new available sample in the stream Returns: False
if the sample is merged to an existing core-micro-cluster otherwiseTrue
meaning “anomalous” sample.