aspartik.b3.parameters

class Scalable:

@runtime_checkable
class Scalable(Protocol):
    def scale(self, factor: float) -> int:
        """
        Scales all values of a parameter and returns the number of dimensions.
        """

        ...
#

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

def scale(self, factor: float) -> int

    def scale(self, factor: float) -> int:
        """
        Scales all values of a parameter and returns the number of dimensions.
        """

        ...
#

Scales all values of a parameter and returns the number of dimensions.

class Internals:

@dataclass
class Internals(Scalable):
    tree: Tree

    def scale(self, factor: float) -> int:
        self.tree.scale(factor)

        return self.tree.num_internals
#

tree: aspartik.b3.Tree

#

def scale(self, factor: float) -> int

    def scale(self, factor: float) -> int:
        self.tree.scale(factor)

        return self.tree.num_internals
#

Scales all values of a parameter and returns the number of dimensions.

class ClassVector:

#

def is_changed(self, /)

#

The type of the None singleton.

def load(self, /, bytes)

#

The type of the None singleton.

def dump(self, /)

#

The type of the None singleton.

def accept(self, /)

#

The type of the None singleton.

def reject(self, /)

#

The type of the None singleton.

def into_list(self, /)

#

The type of the None singleton.

class Real:

#

def is_changed(self, /)

#

The type of the None singleton.

def load(self, /, bytes)

#

The type of the None singleton.

def dump(self, /)

#

The type of the None singleton.

def accept(self, /)

#

The type of the None singleton.

def reject(self, /)

#

The type of the None singleton.

def set(self, /, new_value)

#

The type of the None singleton.

def scale(self, /, factor)

#

The type of the None singleton.

class RealVector:

#

def is_changed(self, /)

#

The type of the None singleton.

def load(self, /, bytes)

#

The type of the None singleton.

def dump(self, /)

#

The type of the None singleton.

def accept(self, /)

#

The type of the None singleton.

def reject(self, /)

#

The type of the None singleton.

Node

#

Any node of the phylogenetic tree

Used for type hints in places where there isn't a need to distinguish between internal and leaf nodes.

Parameter

#