Package org.tribuo.anomaly
Class AnomalyInfo
java.lang.Object
org.tribuo.anomaly.AnomalyInfo
- All Implemented Interfaces:
Serializable
,OutputInfo<Event>
- Direct Known Subclasses:
ImmutableAnomalyInfo
,MutableAnomalyInfo
The base class for tracking anomalous events.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
The number of anomalous events observed.protected long
The number of expected events observed.protected int
The number of unknown events observed (i.e., those without labels). -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructs a new empty anomaly info.protected
AnomalyInfo
(AnomalyInfo other) Copies the supplied anomaly info. -
Method Summary
Modifier and TypeMethodDescriptionabstract AnomalyInfo
copy()
Generates a copy of this OutputInfo, including it's mutability.Generates anImmutableOutputInfo
which has a copy of the data in thisOutputInfo
, but also has id values and is immutable.Generates a mutable copy of thisOutputInfo
.long
The number of anomalous events observed.Returns the set of possibleEvent
s.long
getEventCount
(Event.EventType type) Gets the count of the supplied EventType.long
The number of expected events observed.int
Returns the number of unknownOutput
instances (generated byOutputFactory.getUnknownOutput()
) that this OutputInfo has seen.An Iterable over the possible outputs and the number of times they were observed.int
size()
The number of possible event types (i.e., 2).Generates a String form of this OutputInfo.toString()
-
Field Details
-
expectedCount
protected long expectedCountThe number of expected events observed. -
anomalyCount
protected long anomalyCountThe number of anomalous events observed. -
unknownCount
protected int unknownCountThe number of unknown events observed (i.e., those without labels).
-
-
Constructor Details
-
AnomalyInfo
protected AnomalyInfo()Constructs a new empty anomaly info. -
AnomalyInfo
Copies the supplied anomaly info.- Parameters:
other
- The info to copy.
-
-
Method Details
-
getUnknownCount
public int getUnknownCount()Description copied from interface:OutputInfo
Returns the number of unknownOutput
instances (generated byOutputFactory.getUnknownOutput()
) that this OutputInfo has seen.- Specified by:
getUnknownCount
in interfaceOutputInfo<Event>
- Returns:
- The number of unknown outputs observed.
-
getAnomalyCount
public long getAnomalyCount()The number of anomalous events observed.- Returns:
- The number of anomalies.
-
getExpectedCount
public long getExpectedCount()The number of expected events observed.- Returns:
- The number of normal events.
-
getDomain
Returns the set of possibleEvent
s.Each event has the default score of Double.NaN.
- Specified by:
getDomain
in interfaceOutputInfo<Event>
- Returns:
- The set of possible events.
-
getEventCount
Gets the count of the supplied EventType.- Parameters:
type
- An EventType.- Returns:
- A non-negative long.
-
outputCountsIterable
Description copied from interface:OutputInfo
An Iterable over the possible outputs and the number of times they were observed.Provides similar functionality to an iterator over the entrySet of a Map, though this is a copy of the data and immutable.
- Specified by:
outputCountsIterable
in interfaceOutputInfo<Event>
- Returns:
- Lambda wrapping an iterator over Pairs.
-
size
public int size()The number of possible event types (i.e., 2).- Specified by:
size
in interfaceOutputInfo<Event>
- Returns:
- The number of possible event types.
-
generateImmutableOutputInfo
Description copied from interface:OutputInfo
Generates anImmutableOutputInfo
which has a copy of the data in thisOutputInfo
, but also has id values and is immutable.- Specified by:
generateImmutableOutputInfo
in interfaceOutputInfo<Event>
- Returns:
- An immutable copy of this OutputInfo.
-
generateMutableOutputInfo
Description copied from interface:OutputInfo
Generates a mutable copy of thisOutputInfo
.- Specified by:
generateMutableOutputInfo
in interfaceOutputInfo<Event>
- Returns:
- A mutable copy of this OutputInfo.
-
toReadableString
Description copied from interface:OutputInfo
Generates a String form of this OutputInfo.This String can contain newlines, tabs and other formatting.
- Specified by:
toReadableString
in interfaceOutputInfo<Event>
- Returns:
- A formatted String representing this OutputInfo.
-
toString
-
copy
Description copied from interface:OutputInfo
Generates a copy of this OutputInfo, including it's mutability.- Specified by:
copy
in interfaceOutputInfo<Event>
- Returns:
- A copy of the OutputInfo.
-