.. oe:namespace:: OEGraphSim



.. meta::
   :keywords: OETverskySim, TverskySim


.. _OEGraphSim_OETverskySim:

.. oe:class:: OETverskySim

   .. oe:api::

      class OETverskySim : public OEGraphSim::OESimFuncBase

   This class represents :ref:`OETverskySim <OEGraphSim_OETverskySim>` that
   calculates the :oe:const:`Tversky<OEGraphSim::OESimMeasure::Tversky>`
   similarity score.

   **Formula:**

      :math:`Sim_{Tversky}(A,B) = \frac{bothAB}{\alpha * onlyA + \beta * onlyB + bothAB}`

   .. seealso::

      * :ref:`section_measure_tversky` section
      * :oe:func:`OEGraphSim::OETversky` function


   The following methods are publicly inherited from :ref:`OESimFuncBase <OEGraphSim_OESimFuncBase>`:

   ======================================================================= ======================================================================= ========================================================================
   :oe:meth:`operator()<OEGraphSim::OESimFuncBase::operator()>`            :oe:meth:`CreateCopy<OEGraphSim::OESimFuncBase::CreateCopy>`            :oe:meth:`GetSimTypeString<OEGraphSim::OESimFuncBase::GetSimTypeString>`
   ======================================================================= ======================================================================= ========================================================================


   .. ################################################################
      #
      ################################################################

   .. oe:method:: Constructors

      .. oe:language:: c++ java csharp

         .. oe:api::

            OETverskySim(float a = 0.95f)

      .. oe:language:: python

         .. oe:api:: python

            OETverskySim(a: float = 0.95) -> OETverskySim

      Default constructor (:math:`\alpha = 0.95`, :math:`\beta = 1.0 - \alpha = 0.05`)

      .. oe:language:: c++ java csharp

         .. oe:api::

            OETverskySim(float a, float b)

      .. oe:language:: python

         .. oe:api:: python

            OETverskySim(a: float, b: float) -> OETverskySim

      Constructor with arbitrary :math:`\alpha` and :math:`\beta` parameters.


   .. ################################################################
      #
      ################################################################

   .. oe:method:: operator()

      .. oe:language:: c++ java csharp

         .. oe:api::

            float operator()(const OEGraphSim::OEFingerPrint& fpA, const OEGraphSim::OEFingerPrint& fpB) const

      .. oe:language:: python

         .. oe:api:: python

            __call__(fpA: OEFingerPrint, fpB: OEFingerPrint) -> float

      Returns the :oe:const:`Tversky<OEGraphSim::OESimMeasure::Tversky>`
      similarity coefficient of the two given
      :ref:`OEFingerPrint <OEGraphSim_OEFingerPrint>` objects.

   .. oe:method:: CreateCopy

      .. oe:language:: c++ java csharp

         .. oe:api::

            OEGraphSim::OESimFuncBase* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OETverskySim

      Deep copy constructor that returns a copy of the object. The memory
      for the returned :ref:`OETverskySim <OEGraphSim_OETverskySim>` object is
      dynamically allocated and owned by the caller.


   .. ################################################################
      #
      ################################################################

   .. oe:method:: GetAlpha

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetAlpha() const

      .. oe:language:: python

         .. oe:api:: python

            GetAlpha() -> float

      Returns the :math:`\alpha` parameter of the
      :oe:const:`Tversky<OEGraphSim::OESimMeasure::Tversky>` similarity
      calculation.


   .. ################################################################
      #
      ################################################################

   .. oe:method:: GetBeta

      .. oe:language:: c++ java csharp

         .. oe:api::

            float GetBeta() const

      .. oe:language:: python

         .. oe:api:: python

            GetBeta() -> float

      Returns the :math:`\beta` parameter of the
      :oe:const:`Tversky<OEGraphSim::OESimMeasure::Tversky>` similarity
      calculation.


   .. ################################################################
      #
      ################################################################

   .. oe:method:: GetSimTypeString

      .. oe:language:: c++ java csharp

         .. oe:api::

            std::string GetSimTypeString() const

      .. oe:language:: python

         .. oe:api:: python

            GetSimTypeString() -> str

      Returns a string representation of the
      :ref:`OETverskySim <OEGraphSim_OETverskySim>` class.
