def __init__(self,
                 variable_definition,
                 data_sample=None,
                 num_cores=None):
        self.data_model = datamodel.DataModel(variable_definition)

        if num_cores is None:
            self.num_cores = multiprocessing.cpu_count()
        else:
            self.num_cores = num_cores

        if data_sample:
            self._checkDataSample(data_sample)
            self.data_sample = data_sample
            self.activeLearner = training.ActiveLearning(self.data_sample,
                                                         self.data_model,
                                                         self.num_cores)
        else:
            self.data_sample = []
            self.activeLearner = None

        # Override _loadSampledRecords() to load blocking data from
        # data_sample.
        self._loadSampledRecords(data_sample)

        training_dtype = [('label', 'S8'),
                          ('distances', 'f4',
                           (len(self.data_model), ))]

        self.training_data = numpy.zeros(0, dtype=training_dtype)
        self.training_pairs = OrderedDict({u'distinct': [],
                                           u'match': []})

        self.blocker = None
        self.loaded_indices = False
Initialize from a data model and data sample.
dataset/ETHPy150Open datamade/dedupe/dedupe/api.py/ActiveMatching.__init__