Home Reference Source Repository
public class | source

Classifier

Extends:

events~EventEmitter → Classifier

Calculates packet and station scores. Not an AI classifier. Packet scores are calculated based on the CRC checksum(60%) and simple heuristics(min/max value, variation between packets)(40%). The heuristics used are configured in the packet-heuristics.js map. Station scores are calculated based on the average packet score. The weight of each packet score is determined by the racional function 1/2x where x is a positive non-zero integer that represents how recent the packet is (1 being the most recent packet).

Constructor Summary

Public Constructor
public

constructor(logger: Bunyan)

Constructor.

Member Summary

Public Members
public

The station score.

Private Members
private

The last data received (all packets merge in here).

private

_log: Bunyan

Logger instance.

Method Summary

Public Methods
public

classifyPacket(packet: Object, updateStationClassification: Boolean): Number

Classifies one packet and updates the station score (unless told otherwise).

public

Updates the station score(incrementally).

Public Constructors

public constructor(logger: Bunyan) source

Constructor.

Params:

NameTypeAttributeDescription
logger Bunyan

Logger instance.

Public Members

public stationScore: Number source

The station score.

Private Members

private _lastData: Object source

The last data received (all packets merge in here). Used for heuristic algorithms.

private _log: Bunyan source

Logger instance.

Public Methods

public classifyPacket(packet: Object, updateStationClassification: Boolean): Number source

Classifies one packet and updates the station score (unless told otherwise). Packet scores are calculated based on the CRC checksum(60%) and simple heuristics(min/max value, variation between packets)(40%).

Params:

NameTypeAttributeDescription
packet Object

The packet to classify.

updateStationClassification Boolean
  • optional
  • default: true

Whether to update the station score.

Return:

Number

Packet score.

Emit:

*

stationScore(stationScore): when updateStationClassification is true, the station score is updated and the event is fired.

public classifyStationInc(packetScore: Number): Number source

Updates the station score(incrementally). Station scores are calculated based on the average packet score. The weight of each packet score is determined by the racional function 1/2x where x is a positive non-zero integer that represents how recent the packet is (1 being the most recent packet).

Params:

NameTypeAttributeDescription
packetScore Number

The score of the previously unnacounted packet.

Return:

Number

New station score.

Emit:

*

stationScore(stationScore): because the station score was updated.