Class ConvertedModel


  • public class ConvertedModel
    extends java.lang.Object
    A machine learned model imported from the models/ directory in the application package, for a single rank profile. This encapsulates the difference between reading a model - from a file application package, where it is represented by an ImportedModel, and - from a ZK application package, where the models/ directory is unavailable and models are read from generated files stored in file distribution or ZooKeeper.
    Author:
    bratseth
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.yahoo.searchlib.rankingexpression.rule.ExpressionNode expression​(FeatureArguments arguments, RankProfileTransformContext context)
      Returns the expression matching the given arguments.
      java.util.Map<java.lang.String,​com.yahoo.searchlib.rankingexpression.ExpressionFunction> expressions()
      Returns all the output expressions of this indexed by name.
      static ConvertedModel fromSource​(ModelName modelName, java.lang.String modelDescription, RankProfile rankProfile, com.yahoo.search.query.profile.QueryProfileRegistry queryProfileRegistry, ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModel importedModel)  
      static ConvertedModel fromSourceOrStore​(com.yahoo.path.Path modelPath, boolean pathIsFile, RankProfileTransformContext context)
      Create and store a converted model for a rank profile given from either an imported model, or (if unavailable) from stored application package data.
      static ConvertedModel fromStore​(ModelName modelName, java.lang.String modelDescription, RankProfile rankProfile)  
      static java.io.File sourceModelFile​(com.yahoo.config.application.api.ApplicationPackage application, com.yahoo.path.Path sourceModelPath)
      Returns the directory which contains the source model to use for these arguments
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • fromSourceOrStore

        public static ConvertedModel fromSourceOrStore​(com.yahoo.path.Path modelPath,
                                                       boolean pathIsFile,
                                                       RankProfileTransformContext context)
        Create and store a converted model for a rank profile given from either an imported model, or (if unavailable) from stored application package data.
        Parameters:
        modelPath - the path to the model
        pathIsFile - true if that path (this kind of model) is stored in a file, false if it is in a directory
      • fromSource

        public static ConvertedModel fromSource​(ModelName modelName,
                                                java.lang.String modelDescription,
                                                RankProfile rankProfile,
                                                com.yahoo.search.query.profile.QueryProfileRegistry queryProfileRegistry,
                                                ai.vespa.rankingexpression.importer.configmodelview.ImportedMlModel importedModel)
      • expressions

        public java.util.Map<java.lang.String,​com.yahoo.searchlib.rankingexpression.ExpressionFunction> expressions()
        Returns all the output expressions of this indexed by name. The names consist of one or two parts separated by dot, where the first part is the signature name if signatures are used, or the expression name if signatures are not used and there are multiple expressions, and the second is the output name if signature names are used.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • sourceModelFile

        public static java.io.File sourceModelFile​(com.yahoo.config.application.api.ApplicationPackage application,
                                                   com.yahoo.path.Path sourceModelPath)
        Returns the directory which contains the source model to use for these arguments