'Order attributes by Relief if there is a target variable. In case of
ties or without target, order by name.
Add the class variable at the beginning when not coloring by class
distribution.
If `self.attrs` is not `None`, keep the ordering and just add or remove
the class as needed.'

def compute_attr_order(self):

    data = self.master.discrete_data
    class_var = data.domain.class_var
    if (not self.attr_ordering):
        if (class_var is None):
            self.attr_ordering = sorted(data.domain, key=attrgetter('name'))
        else:
            weights = ReliefF(n_iterations=100, k_nearest=10)(data)
            attrs = sorted(zip(weights, data.domain.attributes), key=(lambda x: ((- x[0]), x[1].name)))
            self.attr_ordering = [a for (_, a) in attrs]
