def aitchison_aitken(h, Xi, x, num_levels=None):
 Xi = Xi.reshape(Xi.size)
 if (num_levels is None):
  num_levels = np.asarray(np.unique(Xi).size)
 kernel_value = ((np.ones(Xi.size) * h) / (num_levels - 1))
 idx = (Xi == x)
 kernel_value[idx] = (idx * (1 - h))[idx]
 return kernel_value

def aitchison_aitken ( h , Xi , x , num_levels = None ) : Xi = Xi . reshape ( Xi . size ) if ( num_levels is None ) : num_levels = np . asarray ( np . unique ( Xi ) . size ) kernel_value = ( ( np . ones ( Xi . size ) * h ) / ( num_levels - 1 ) ) idx = ( Xi == x ) kernel_value [ idx ] = ( idx * ( 1 - h ) ) [ idx ] return kernel_value
the aitchison-aitken kernel .