Class ModelProvenance

java.lang.Object
org.tribuo.provenance.ModelProvenance
All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance, com.oracle.labs.mlrg.olcut.provenance.Provenance, Serializable, Iterable<com.oracle.labs.mlrg.olcut.util.Pair<String,com.oracle.labs.mlrg.olcut.provenance.Provenance>>
Direct Known Subclasses:
EnsembleModelProvenance

public class ModelProvenance extends Object implements com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance
Contains provenance information for an instance of a Model.

Made up of the class name of the model object, the date and time it was trained, the provenance of the training data, and the provenance of the trainer.

In addition by default it collects the Java version, OS name and system architecture, along with the running Tribuo version.

See Also:
  • Field Details

    • DATASET

      protected static final String DATASET
      The name of the dataset provenance field.
      See Also:
    • TRAINER

      protected static final String TRAINER
      The name of the trainer provenance field.
      See Also:
    • TRAINING_TIME

      protected static final String TRAINING_TIME
      The name of the training time field.
      See Also:
    • INSTANCE_VALUES

      protected static final String INSTANCE_VALUES
      The name of the instance values field.
      See Also:
    • TRIBUO_VERSION_STRING

      protected static final String TRIBUO_VERSION_STRING
      The name of the Tribuo version string field.
      See Also:
    • JAVA_VERSION_STRING

      protected static final String JAVA_VERSION_STRING
      The name of the Java version field.
      See Also:
    • OS_STRING

      protected static final String OS_STRING
      The name of the OS name field.
      See Also:
    • ARCH_STRING

      protected static final String ARCH_STRING
      The name of the architecture name field.
      See Also:
    • UNKNOWN_VERSION

      protected static final String UNKNOWN_VERSION
      The value returned for models from Tribuo 4.1 and earlier which don't record the Java, OS or architecture.
      See Also:
    • className

      protected final String className
      The name of the host class.
    • time

      protected final OffsetDateTime time
      The time the model was created.
    • datasetProvenance

      protected final DatasetProvenance datasetProvenance
      The dataset provenance.
    • trainerProvenance

      protected final TrainerProvenance trainerProvenance
      Provenance of the trainer which created this model.
    • instanceProvenance

      protected final com.oracle.labs.mlrg.olcut.provenance.MapProvenance<? extends com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance
      Any instance time information supplied by the users.
    • versionString

      protected final String versionString
      The Tribuo version string.
    • javaVersionString

      protected final String javaVersionString
      The Java version string.
    • osString

      protected final String osString
      The OS string.
    • archString

      protected final String archString
      The system CPU architecture string.
  • Constructor Details

    • ModelProvenance

      public ModelProvenance(String className, OffsetDateTime time, DatasetProvenance datasetProvenance, TrainerProvenance trainerProvenance)
      Creates a model provenance tracking the class name, creation time, dataset provenance and trainer provenance.

      Also tracks system details like the os name, os architecture, java version, and Tribuo version.

      Parameters:
      className - The model class name.
      time - The model creation time.
      datasetProvenance - The dataset provenance.
      trainerProvenance - The trainer provenance.
    • ModelProvenance

      public ModelProvenance(String className, OffsetDateTime time, DatasetProvenance datasetProvenance, TrainerProvenance trainerProvenance, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance)
      Creates a model provenance tracking the class name, creation time, dataset provenance, trainer provenance and any instance specific provenance.

      Also tracks system details like the os name, os architecture, java version, and Tribuo version.

      Parameters:
      className - The model class name.
      time - The model creation time.
      datasetProvenance - The dataset provenance.
      trainerProvenance - The trainer provenance.
      instanceProvenance - Provenance for this specific model training run.
    • ModelProvenance

      public ModelProvenance(String className, OffsetDateTime time, DatasetProvenance datasetProvenance, TrainerProvenance trainerProvenance, Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> instanceProvenance, boolean trackSystem)
      Creates a model provenance tracking the class name, creation time, dataset provenance, trainer provenance and any instance specific provenance.

      Also optionally tracks system details like the os name, os architecture, java version, and Tribuo version.

      Parameters:
      className - The model class name.
      time - The model creation time.
      datasetProvenance - The dataset provenance.
      trainerProvenance - The trainer provenance.
      instanceProvenance - Provenance for this specific model training run.
      trackSystem - If true then store the java version, os name and os arch in the provenance.
    • ModelProvenance

      public ModelProvenance(Map<String,com.oracle.labs.mlrg.olcut.provenance.Provenance> map)
      Used by the provenance unmarshalling system.

      Throws ProvenanceException if there are missing fields.

      Parameters:
      map - The provenance map.
  • Method Details

    • getTrainingTime

      public OffsetDateTime getTrainingTime()
      The training timestamp.
      Returns:
      The timestamp.
    • getDatasetProvenance

      public DatasetProvenance getDatasetProvenance()
      The training dataset provenance.
      Returns:
      The training dataset provenance.
    • getTrainerProvenance

      public TrainerProvenance getTrainerProvenance()
      The trainer provenance.
      Returns:
      The trainer provenance.
    • getInstanceProvenance

      public com.oracle.labs.mlrg.olcut.provenance.MapProvenance<? extends com.oracle.labs.mlrg.olcut.provenance.Provenance> getInstanceProvenance()
      Provenance for the specific training run which created this model.
      Returns:
      The instance provenance.
    • getTribuoVersion

      public String getTribuoVersion()
      The Tribuo version used to create this model.
      Returns:
      The Tribuo version.
    • getJavaVersion

      public String getJavaVersion()
      The Java version used to create this model.
      Returns:
      The Java version.
    • getOS

      public String getOS()
      The name of the OS used to create this model.
      Returns:
      The OS name.
    • getArch

      public String getArch()
      The CPU architecture used to create this model.
      Returns:
      The CPU architecture.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getClassName

      public String getClassName()
      Specified by:
      getClassName in interface com.oracle.labs.mlrg.olcut.provenance.ObjectProvenance
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • internalProvenances

      protected List<com.oracle.labs.mlrg.olcut.util.Pair<String,com.oracle.labs.mlrg.olcut.provenance.Provenance>> internalProvenances()
      Returns a list of all the provenances in this model provenance so subclasses can append to the list.
      Returns:
      A list of all the provenances in this class.
    • iterator

      public Iterator<com.oracle.labs.mlrg.olcut.util.Pair<String,com.oracle.labs.mlrg.olcut.provenance.Provenance>> iterator()
      Calls internalProvenances() and returns the iterator from that list.
      Specified by:
      iterator in interface Iterable<com.oracle.labs.mlrg.olcut.util.Pair<String,com.oracle.labs.mlrg.olcut.provenance.Provenance>>
      Returns:
      An iterator over all the provenances.