oadds package

Submodules

oadds.oadds module

Main module.

class oadds.oadds.Cluster[source]

Bases: object

Cluster class. Contains the list of the micro-cluster and the number of micro-clusters.

insert(mc)[source]

Inserts a micro-cluster into the cluster

Parameters:mc – the micro-cluster to be added to the list of the micro-clusters that make up the cluster.

Increases the counter of micro-clusters into the cluster by 1.

show()[source]
class oadds.oadds.MicroCluster(currenttimestamp, lamb, clusterNumber)[source]

Bases: object

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.
getCenter()[source]
Returns:the center of the micro-cluster.
getRadius()[source]
Returns:the radius 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() and updateRealTimeLSandSS()

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.

updateIncrementalRadiusTreshold()[source]

Doc update incremental radius

updateRealTimeLSandSS(sample)[source]

Updates the Weighted Linear Sum (WLS), the Weighted Squared Sum (WSS), the center and the radius of the micro-cluster when a new sample is merged.

Parameters:sample – the sample to merge into the micro-cluster.
updateRealTimeWeight()[source]

Updates the Weight of the micro-cluster by the fading factor and increases it by 1.

class oadds.oadds.OADDS(lamb=0.1, epsilon='dynamic', minPts=1, beta=0.4, mu='auto', numberInitialSamples=None, startingBuffer=None, tp=60, k_std=3)[source]

Bases: object

OADDS 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.

nearestCluster(sample, timestamp, kind)[source]
resetLearningImpl()[source]

Initializes two empty Cluster as a p-micro-cluter list and o-micro-cluster list.

If mu is auto computes the value

runInitialization()[source]

Initializes the variables of the main algorithm with the methods resetLearningImpl() and initWithoutDBScan()

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 otherwise True meaning “anomalous” sample.
updateAll(mc)[source]
class oadds.oadds.Sample(value, timestamp: int)[source]

Bases: object

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.
getValue()[source]
Returns:value
setMicroClusterNumber(microClusterNumber: int)[source]

Assign to each sample the microClusterNumber in which was merged.

Set:microClusterNumber
setRealTimestamp(timestamp)[source]
setTimestamp(timestamp: int)[source]
Set:timestamp
oadds.oadds.computeReductionFactor(lamb, steps)[source]

Module contents

Top-level package for oadds.