Class AnomalyInfo
java.lang.Object
org.tribuo.anomaly.AnomalyInfo
- All Implemented Interfaces:
Serializable,OutputInfo<Event>,ProtoSerializable<org.tribuo.protos.core.OutputDomainProto>
- Direct Known Subclasses:
ImmutableAnomalyInfo,MutableAnomalyInfo
The base class for tracking anomalous events.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe number of anomalous events observed.protected longThe number of expected events observed.protected intThe number of unknown events observed (i.e., those without labels).Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a new empty anomaly info.protectedAnomalyInfo(long expectedCount, long anomalyCount, int unknownCount) Deserialization constructor.protectedAnomalyInfo(AnomalyInfo other) Copies the supplied anomaly info. -
Method Summary
Modifier and TypeMethodDescriptionabstract AnomalyInfocopy()Generates a copy of this OutputInfo, including it's mutability.booleanGenerates anImmutableOutputInfowhich has a copy of the data in thisOutputInfo, but also has id values and is immutable.Generates a mutable copy of thisOutputInfo.longThe number of anomalous events observed.Returns the set of possibleEvents.longgetEventCount(Event.EventType type) Gets the count of the supplied EventType.longThe number of expected events observed.intReturns the number of unknownOutputinstances (generated byOutputFactory.getUnknownOutput()) that this OutputInfo has seen.inthashCode()An Iterable over the possible outputs and the number of times they were observed.org.tribuo.protos.core.OutputDomainProtoSerializes this object to a protobuf.intsize()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.
-
AnomalyInfo
protected AnomalyInfo(long expectedCount, long anomalyCount, int unknownCount) Deserialization constructor.Validates that the inputs are non-negative.
- Parameters:
expectedCount- The observed number of expected events.anomalyCount- The observed number of anomalous events.unknownCount- The observed number of unknown events.
-
-
Method Details
-
serialize
public org.tribuo.protos.core.OutputDomainProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
serializein interfaceProtoSerializable<org.tribuo.protos.core.OutputDomainProto>- Returns:
- The protobuf.
-
getUnknownCount
public int getUnknownCount()Description copied from interface:OutputInfoReturns the number of unknownOutputinstances (generated byOutputFactory.getUnknownOutput()) that this OutputInfo has seen.- Specified by:
getUnknownCountin 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
-
getEventCount
Gets the count of the supplied EventType.- Parameters:
type- An EventType.- Returns:
- A non-negative long.
-
outputCountsIterable
Description copied from interface:OutputInfoAn 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:
outputCountsIterablein interfaceOutputInfo<Event>- Returns:
- Lambda wrapping an iterator over Pairs.
-
size
public int size()The number of possible event types (i.e., 2).- Specified by:
sizein interfaceOutputInfo<Event>- Returns:
- The number of possible event types.
-
generateImmutableOutputInfo
Description copied from interface:OutputInfoGenerates anImmutableOutputInfowhich has a copy of the data in thisOutputInfo, but also has id values and is immutable.- Specified by:
generateImmutableOutputInfoin interfaceOutputInfo<Event>- Returns:
- An immutable copy of this OutputInfo.
-
generateMutableOutputInfo
Description copied from interface:OutputInfoGenerates a mutable copy of thisOutputInfo.- Specified by:
generateMutableOutputInfoin interfaceOutputInfo<Event>- Returns:
- A mutable copy of this OutputInfo.
-
toReadableString
Description copied from interface:OutputInfoGenerates a String form of this OutputInfo.This String can contain newlines, tabs and other formatting.
- Specified by:
toReadableStringin interfaceOutputInfo<Event>- Returns:
- A formatted String representing this OutputInfo.
-
toString
-
copy
Description copied from interface:OutputInfoGenerates a copy of this OutputInfo, including it's mutability.- Specified by:
copyin interfaceOutputInfo<Event>- Returns:
- A copy of the OutputInfo.
-
equals
-
hashCode
-