Class CosineSimilarity

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Comparable<org.apache.avro.specific.SpecificRecord>, org.apache.avro.generic.GenericContainer, org.apache.avro.generic.GenericRecord, org.apache.avro.generic.IndexedRecord, org.apache.avro.specific.SpecificRecord

    public class CosineSimilarity
    extends org.apache.avro.specific.SpecificRecordBase
    implements org.apache.avro.specific.SpecificRecord
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.List<java.lang.Float> cosSimilarityParam
      The passed feature vector, which will be used to execute cosine-similarity calculation against the field in the original value record
      java.lang.CharSequence field
      The field in the original value record, which will used to execute cosine-similarity calculation
      java.lang.CharSequence resultFieldName
      The field name used to store the calculated result
      static org.apache.avro.Schema SCHEMA$  
    • Constructor Summary

      Constructors 
      Constructor Description
      CosineSimilarity()
      Default constructor.
      CosineSimilarity​(java.lang.CharSequence field, java.util.List<java.lang.Float> cosSimilarityParam, java.lang.CharSequence resultFieldName)
      All-args constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object get​(int field$)  
      static org.apache.avro.Schema getClassSchema()  
      java.util.List<java.lang.Float> getCosSimilarityParam()
      Gets the value of the 'cosSimilarityParam' field.
      java.lang.CharSequence getField()
      Gets the value of the 'field' field.
      java.lang.CharSequence getResultFieldName()
      Gets the value of the 'resultFieldName' field.
      org.apache.avro.Schema getSchema()  
      org.apache.avro.specific.SpecificData getSpecificData()  
      void put​(int field$, java.lang.Object value$)  
      void readExternal​(java.io.ObjectInput in)  
      void setCosSimilarityParam​(java.util.List<java.lang.Float> value)
      Sets the value of the 'cosSimilarityParam' field.
      void setField​(java.lang.CharSequence value)
      Sets the value of the 'field' field.
      void setResultFieldName​(java.lang.CharSequence value)
      Sets the value of the 'resultFieldName' field.
      void writeExternal​(java.io.ObjectOutput out)  
      • Methods inherited from class org.apache.avro.specific.SpecificRecordBase

        compareTo, customDecode, customEncode, equals, get, getConversion, getConversion, hasCustomCoders, hashCode, put, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.apache.avro.generic.GenericRecord

        hasField
    • Field Detail

      • SCHEMA$

        public static final org.apache.avro.Schema SCHEMA$
      • field

        public java.lang.CharSequence field
        The field in the original value record, which will used to execute cosine-similarity calculation
      • cosSimilarityParam

        public java.util.List<java.lang.Float> cosSimilarityParam
        The passed feature vector, which will be used to execute cosine-similarity calculation against the field in the original value record
      • resultFieldName

        public java.lang.CharSequence resultFieldName
        The field name used to store the calculated result
    • Constructor Detail

      • CosineSimilarity

        public CosineSimilarity()
        Default constructor. Note that this does not initialize fields to their default values from the schema. If that is desired then one should use newBuilder().
      • CosineSimilarity

        public CosineSimilarity​(java.lang.CharSequence field,
                                java.util.List<java.lang.Float> cosSimilarityParam,
                                java.lang.CharSequence resultFieldName)
        All-args constructor.
        Parameters:
        field - The field in the original value record, which will used to execute cosine-similarity calculation
        cosSimilarityParam - The passed feature vector, which will be used to execute cosine-similarity calculation against the field in the original value record
        resultFieldName - The field name used to store the calculated result
    • Method Detail

      • getClassSchema

        public static org.apache.avro.Schema getClassSchema()
      • getSpecificData

        public org.apache.avro.specific.SpecificData getSpecificData()
        Overrides:
        getSpecificData in class org.apache.avro.specific.SpecificRecordBase
      • getSchema

        public org.apache.avro.Schema getSchema()
        Specified by:
        getSchema in interface org.apache.avro.generic.GenericContainer
        Specified by:
        getSchema in class org.apache.avro.specific.SpecificRecordBase
      • get

        public java.lang.Object get​(int field$)
        Specified by:
        get in interface org.apache.avro.generic.IndexedRecord
        Specified by:
        get in class org.apache.avro.specific.SpecificRecordBase
      • put

        public void put​(int field$,
                        java.lang.Object value$)
        Specified by:
        put in interface org.apache.avro.generic.IndexedRecord
        Specified by:
        put in class org.apache.avro.specific.SpecificRecordBase
      • getField

        public java.lang.CharSequence getField()
        Gets the value of the 'field' field.
        Returns:
        The field in the original value record, which will used to execute cosine-similarity calculation
      • setField

        public void setField​(java.lang.CharSequence value)
        Sets the value of the 'field' field. The field in the original value record, which will used to execute cosine-similarity calculation
        Parameters:
        value - the value to set.
      • getCosSimilarityParam

        public java.util.List<java.lang.Float> getCosSimilarityParam()
        Gets the value of the 'cosSimilarityParam' field.
        Returns:
        The passed feature vector, which will be used to execute cosine-similarity calculation against the field in the original value record
      • setCosSimilarityParam

        public void setCosSimilarityParam​(java.util.List<java.lang.Float> value)
        Sets the value of the 'cosSimilarityParam' field. The passed feature vector, which will be used to execute cosine-similarity calculation against the field in the original value record
        Parameters:
        value - the value to set.
      • getResultFieldName

        public java.lang.CharSequence getResultFieldName()
        Gets the value of the 'resultFieldName' field.
        Returns:
        The field name used to store the calculated result
      • setResultFieldName

        public void setResultFieldName​(java.lang.CharSequence value)
        Sets the value of the 'resultFieldName' field. The field name used to store the calculated result
        Parameters:
        value - the value to set.
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Overrides:
        writeExternal in class org.apache.avro.specific.SpecificRecordBase
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException
        Specified by:
        readExternal in interface java.io.Externalizable
        Overrides:
        readExternal in class org.apache.avro.specific.SpecificRecordBase
        Throws:
        java.io.IOException