def approximate(self, domain=None): ''' Approximate a pessimistic and sound mapping for a given input *domain*. ''' bounds = _mk_bounds(self.nb_inputs, domain) ptr = _lib.vote_ensemble_approximate(self.ptr, bounds) return _ffi.gc(ptr, _lib.vote_mapping_del)
def mapping_new(input_dim, output_dim): ''' Create a new mapping with the given input/output dimensions. Input bounds are initialized to [-∞, ∞], and output bounds are initialized to [0, 0]. ''' mapping = _lib.vote_mapping_new(int(input_dim), int(output_dim)) return _ffi.gc(mapping, _lib.vote_mapping_del)
def mapping_copy(mapping): ''' Create a (deep) copy of a mapping. ''' mapping = _lib.vote_mapping_copy(mapping) return _ffi.gc(mapping, _lib.vote_mapping_del)