The paper proposes a non-parametrical approach to explainable artificial intelligence based on the compactness postulate, which states that objects of one class in the feature space are, as a rule, located closer to each other than to objects of other classes. Objects are considered similar if they are located close to each other in the feature space. Meanwhile, the properties of objects in real life are often random values. Such objects are not described by a vector of features, but by a random sample or several samples of features, and the postulate of compactness should be replaced by the postulate of statistical homogeneity. Objects are considered statistically homogeneous if their features obey the same distributions. The paper describes a non-parametric measure of homogeneity and an illustration of its use in medical applications, in particular for the diagnosis of breast cancer within the framework of similarity-based explainable artificial intelligence.For comparison, the results of diagnostics of the same data set using deep learning of an artificial neural network are given. We formulate new statistical postulates of machine learning and propose to consider a machine learning algorithm as explanatory and interpretable if it satisfies these postulates.