(self, other)
Multiply two losses together.

        Parameters
        ----------
        other : Loss or int or float
            If instance of ``Loss`` then creates a new loss that represents the product of `self` and `other`. If a
            number then create a new loss that is equal to `self` times a constant.

        Returns
        -------
        new : Loss
            Instance of a ``Loss`` representing the multiplication operation.
Multiply two losses together.
Multiply two losses together .
def __mul__(self, other):
        """Multiply two losses together.

        Parameters
        ----------
        other : Loss or int or float
            If instance of ``Loss`` then creates a new loss that represents the product of `self` and `other`. If a
            number then create a new loss that is equal to `self` times a constant.

        Returns
        -------
        new : Loss
            Instance of a ``Loss`` representing the multiplication operation.
        """
        if isinstance(other, Loss):
            new_instance = Loss()
            new_instance._call = MethodType(lambda inst, weights, y: self(weights, y) * other(weights, y), new_instance)
            new_instance._repr = MethodType(lambda inst: '{} * {}'.format(self.__repr__(), other.__repr__()),
                                            new_instance)

            return new_instance

        elif isinstance(other, (int, float)):
            new_instance = Loss()
            new_instance._call = MethodType(lambda inst, weights, y: self(weights, y) * other, new_instance)
            new_instance._repr = MethodType(lambda inst: '{} * {}'.format(self.__repr__(), other),
                                            new_instance)

            return new_instance
        else:
            raise TypeError('Unsupported type: {}'.format(type(other)))
def __mul__ ( self , other ) : if isinstance ( other , Loss ) : new_instance = Loss ( ) new_instance . _call = MethodType ( lambda inst , weights , y : self ( weights , y ) * other ( weights , y ) , new_instance ) new_instance . _repr = MethodType ( lambda inst : '{} * {}' . format ( self . __repr__ ( ) , other . __repr__ ( ) ) , new_instance ) return new_instance elif isinstance ( other , ( int , float ) ) : new_instance = Loss ( ) new_instance . _call = MethodType ( lambda inst , weights , y : self ( weights , y ) * other , new_instance ) new_instance . _repr = MethodType ( lambda inst : '{} * {}' . format ( self . __repr__ ( ) , other ) , new_instance ) return new_instance else : raise TypeError ( 'Unsupported type: {}' . format ( type ( other ) ) )