src/whylogs/core/statistics/numbertracker.py
def from_protobuf(message: NumbersMessage):
        """
        Load from a protobuf message

        Returns
        -------
        number_tracker : NumberTracker
        """
        theta = None
        if message.theta is not None and len(message.theta) > 0:
            theta = ThetaSketch.deserialize(message.theta)
        elif message.compact_theta is not None and len(message.compact_theta) > 0:
            theta = ThetaSketch.deserialize(message.compact_theta)

        opts = dict(
            theta_sketch=theta,
            variance=VarianceTracker.from_protobuf(message.variance),
            histogram=dsketch.deserialize_kll_floats_sketch(message.histogram),
            frequent_numbers=dsketch.FrequentNumbersSketch.from_protobuf(
                message.frequent_numbers
            ),
        )
        if message.HasField("doubles"):
            opts["floats"] = FloatTracker.from_protobuf(message.doubles)
        if message.HasField("longs"):
            opts["ints"] = IntTracker.from_protobuf(message.longs)
        return NumberTracker(**opts)

        Load from a protobuf message

        Returns
        -------
        number_tracker : NumberTracker
        
Load from a protobuf message
Returns


Load from a protobuf message Returns
def from_protobuf(message: NumbersMessage):
        theta = None
        if message.theta is not None and len(message.theta) > 0:
            theta = ThetaSketch.deserialize(message.theta)
        elif message.compact_theta is not None and len(message.compact_theta) > 0:
            theta = ThetaSketch.deserialize(message.compact_theta)
        opts = dict(
            theta_sketch=theta,
            variance=VarianceTracker.from_protobuf(message.variance),
            histogram=dsketch.deserialize_kll_floats_sketch(message.histogram),
            frequent_numbers=dsketch.FrequentNumbersSketch.from_protobuf(
                message.frequent_numbers
            ),
        )
        if message.HasField("doubles"):
            opts["floats"] = FloatTracker.from_protobuf(message.doubles)
        if message.HasField("longs"):
            opts["ints"] = IntTracker.from_protobuf(message.longs)
        return NumberTracker(**opts)
def from_protobuf ( message : NumbersMessage ) : theta = None if message . theta is not None and len ( message . theta ) > 0 : theta = ThetaSketch . deserialize ( message . theta ) elif message . compact_theta is not None and len ( message . compact_theta ) > 0 : theta = ThetaSketch . deserialize ( message . compact_theta ) opts = dict ( theta_sketch = theta , variance = VarianceTracker . from_protobuf ( message . variance ) , histogram = dsketch . deserialize_kll_floats_sketch ( message . histogram ) , frequent_numbers = dsketch . FrequentNumbersSketch . from_protobuf ( message . frequent_numbers ) , ) if message . HasField ( "doubles" ) : opts [ "floats" ] = FloatTracker . from_protobuf ( message . doubles ) if message . HasField ( "longs" ) : opts [ "ints" ] = IntTracker . from_protobuf ( message . longs ) return NumberTracker ( ** opts )
Load from a protobuf message
Returns
Load from a protobuf message Returns
"""
        Load from a protobuf message

        Returns
        -------
        number_tracker : NumberTracker
        """
message
NumbersMessage