Class AnomalyFactory
java.lang.Object
org.tribuo.anomaly.AnomalyFactory
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable,com.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>,Serializable,OutputFactory<Event>,ProtoSerializable<org.tribuo.protos.core.OutputFactoryProto>
A factory for generating events.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventThe anomalous event.static final EventThe expected event.static final EventThe unknown event.Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconstructInfoForExternalModel(Map<Event, Integer> mapping) Creates anImmutableOutputInfofrom the supplied mapping.static AnomalyFactorydeserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.booleanGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.<V> EventgenerateOutput(V label) Parses theVand generates the appropriateOutputvalue.Gets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Generate provenance for this anomaly factory.Gets the output class that this factory supports.Returns the singleton unknown output of type T which can be used for prediction time examples.inthashCode()org.tribuo.protos.core.OutputFactoryProtoSerializes this object to a protobuf.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfigMethods inherited from interface org.tribuo.OutputFactory
generateOutputs
-
Field Details
-
UNKNOWN_EVENT
The unknown event. Used at inference time. -
EXPECTED_EVENT
The expected event. Used for things which are not anomalous. -
ANOMALOUS_EVENT
The anomalous event. It's anomalous.
-
-
Constructor Details
-
AnomalyFactory
public AnomalyFactory()Create an AnomalyFactory.
-
-
Method Details
-
deserializeFromProto
public static AnomalyFactory deserializeFromProto(int version, String className, com.google.protobuf.Any message) Deserialization factory.- Parameters:
version- The serialized object version.className- The class name.message- The serialized data.- Returns:
- The deserialized object.
-
serialize
public org.tribuo.protos.core.OutputFactoryProto serialize()Description copied from interface:ProtoSerializableSerializes this object to a protobuf.- Specified by:
serializein interfaceProtoSerializable<org.tribuo.protos.core.OutputFactoryProto>- Returns:
- The protobuf.
-
generateOutput
Description copied from interface:OutputFactoryParses theVand generates the appropriateOutputvalue.Most implementations call toString on the label before parsing it, but this is not required.
- Specified by:
generateOutputin interfaceOutputFactory<Event>- Type Parameters:
V- The type of the input value.- Parameters:
label- An input value.- Returns:
- The parsed Output as an instance of
T.
-
getUnknownOutput
Description copied from interface:OutputFactoryReturns the singleton unknown output of type T which can be used for prediction time examples.- Specified by:
getUnknownOutputin interfaceOutputFactory<Event>- Returns:
- An unknown output.
-
generateInfo
Description copied from interface:OutputFactoryGenerates the appropriateMutableOutputInfoso the output values can be tracked by aDatasetor other aggregate.- Specified by:
generateInfoin interfaceOutputFactory<Event>- Returns:
- The appropriate subclass of
MutableOutputInfoinitialised to zero.
-
constructInfoForExternalModel
Description copied from interface:OutputFactoryCreates anImmutableOutputInfofrom the supplied mapping. Requires that the mapping is dense in the integers [0,mapping.size()) and each mapping is unique.This call is used to import external models, and should not be used for other purposes.
- Specified by:
constructInfoForExternalModelin interfaceOutputFactory<Event>- Parameters:
mapping- The mapping to use.- Returns:
- The appropriate subclass of
ImmutableOutputInfowith a single observation of each element.
-
getEvaluator
Description copied from interface:OutputFactoryGets anEvaluatorsuitable for measuring performance of predictions for the Output subclass.Evaluatorinstances are thread safe and immutable, and commonly this is a singleton stored in theOutputFactoryimplementation.- Specified by:
getEvaluatorin interfaceOutputFactory<Event>- Returns:
- An evaluator.
-
getTypeWitness
Description copied from interface:OutputFactoryGets the output class that this factory supports.- Specified by:
getTypeWitnessin interfaceOutputFactory<Event>- Returns:
- The output class.
-
hashCode
-
equals
-
getProvenance
Generate provenance for this anomaly factory.- Specified by:
getProvenancein interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<OutputFactoryProvenance>- Returns:
- The provenance.
-