(x, discrete)
return x
Change non-zero values of discrete attributes to 1.
Change non-zero values of discrete attributes to 1.
Change non - zero values of discrete attributes to 1 .
def discrete_to_indicators(x, discrete):
        """Change non-zero values of discrete attributes to 1."""
        if discrete.any():
            x = x.copy()
            for col, disc in enumerate(discrete):
                if disc:
                    x[:, col].clip(0, 1, out=x[:, col])
        return x
def discrete_to_indicators ( x , discrete ) : if discrete . any ( ) : x = x . copy ( ) for col , disc in enumerate ( discrete ) : if disc : x [ : , col ] . clip ( 0 , 1 , out = x [ : , col ] ) return x