Interpretable machine learning model. Part 1


Interpretive methods (approaches)

Even more than organizational methods, these methods deserve the name of approaches, since they are, first of all, explanatory principles that predetermine the direction of interpretation of research results. In scientific practice, genetic, structural, functional, complex and systemic approaches have been developed. Using one method or another does not mean cutting off others. On the contrary, a combination of approaches is common in psychology. And this applies not only to research practice, but also to psychodiagnostics, psychological counseling and psychocorrection.

Genetic method

The genetic method is a way of studying and explaining phenomena (including mental ones), based on the analysis of their development in both ontogenetic and phylogenetic terms. This requires establishing:

  1. initial conditions for the occurrence of the phenomenon,
  2. main stages
  3. main trends in its development.

The purpose of the method is to identify the connection of the phenomena being studied over time, to trace the transition from lower to higher forms.

So wherever it is necessary to identify the temporal dynamics of mental phenomena, the genetic method is an integral research tool for the psychologist. Even when the research is aimed at studying the structural and functional characteristics of a phenomenon, the effective use of this method cannot be ruled out. Thus, the developers of the well-known theory of perceptual actions in the microstructural analysis of the perception of o. Naturally, the genetic method is especially characteristic of various branches of developmental psychology: comparative, developmental, historical psychology. It is clear that any longitudinal study presupposes the use of the method in question.

The genetic approach, in fact, can be considered as a methodological implementation of one of the basic principles of psychology, namely the principle of development. With this vision, other options for implementing the principle of development can be considered as modifications of the genetic approach. For example, historical and evolutionary approaches.

Structural method

The structural approach is a direction focused on identifying and describing the structure of objects (phenomena). It is characterized by: in-depth attention to the description of the current state of objects; clarification of their inherent timeless properties; interest not in isolated facts, but in the relationships between them. As a result, a system of relationships is built between the elements of the object at various levels of its organization.

Usually, with a structural approach, the relationship between parts and the whole in an object and the dynamics of the identified structures are not emphasized. In this case, the decomposition of the whole into parts (decomposition) can be carried out in various ways. An important advantage of the structural method is the relative ease of visual presentation of results in the form of various models. These models can be given in the form of descriptions, lists of elements, graphic diagrams, classifications, etc.

An inexhaustible example of such modeling is the representation of the structure and types of personality: the three-element model according to Z. Freud; Jung's personality types; "Eysenck circle"; multifactorial model by R. Assagioli. Our domestic science has not lagged behind foreign psychology in this matter: endo- and exopsychics according to A.F. Lazursky and the development of his views in V.D. Balin; personality structure of four complex complexes according to B. G. Ananyev; individual-individual scheme of V. S. Merlin; lists of personality components by A. G. Kovalev and P. I. Ivanov; dynamic functional structure of personality according to K. K. Platonov; personality diagram according to A.I. Shcherbakov, etc.

The structural approach is an attribute of any research devoted to the study of the constitutional organization of the psyche and the structure of its material substrate - the nervous system. Here we can mention the typology of GNI by I. P. Pavlov and its development by B. M. Teplov, V. D. Nebylitsyn and others. The models of V. M. Rusalov, reflecting the morphological, neuro- and psychodynamic constitution of a person, have received wide recognition. Structural models of the human psyche in spatial and functional aspects are presented in the works. Classic examples of the approach under consideration are the associative psychology of F. Hartley and its consequences (in particular, the psychophysics of “pure sensations” of the 19th century), as well as the structural psychology of W. Wundt and E. Titchener. A specific concretization of the approach is the method of microstructural analysis, which includes elements of genetic, functional, and systemic approaches.

Functional method

Functional approach , naturally, is focused on identifying and studying the functions of objects (phenomena). The ambiguity of the interpretation of the concept of “function” in science makes it difficult to define this approach, as well as to identify with it certain areas of psychological research. We will adhere to the opinion that a function is a manifestation of the properties of objects in a certain system of relations, and properties are a manifestation of the quality of an object in its interaction with other objects. Thus, a function is the realization of the relationship between an object and the environment, and also “the correspondence between the environment and the system.”

Consequently, the functional approach is mainly interested in the connections of the object being studied with the environment. It is based on the principle of self-regulation and maintaining the balance of the objects of reality (including the psyche and its carriers).

Examples of the implementation of the functional approach in the history of science are such well-known directions as “functional psychology” and “behaviorism”. A classic example of the embodiment of a functional idea in psychology is the famous dynamic field theory of K. Lewin. In modern psychology, the functional approach is enriched with components of structural and genetic analysis. Thus, the idea of ​​the multi-level and multi-phase nature of all human mental functions, operating simultaneously at all levels as a single whole, has already been firmly established. The above examples of personality structures, the nervous system, and the psyche can rightfully be taken as an illustration of the functional approach, since most authors of the corresponding models also consider the elements of these structures as functional units that embody certain connections of a person with reality.

Complex method

An integrated approach is a direction that considers the object of research as a set of components to be studied using an appropriate set of methods. Components can be both relatively homogeneous parts of the whole, and its heterogeneous sides, characterizing the object under study in different aspects. Often, an integrated approach involves studying a complex object using the methods of a complex of sciences, i.e., organizing interdisciplinary research. Obviously, an integrated approach involves the use, to one degree or another, of all previous interpretive methods.

A striking example of the implementation of an integrated approach in science is the concept of human science, according to which man, as the most complex object of study, is subject to a coordinated study of a large complex of sciences. In psychology, this idea of ​​the complexity of the study of man was clearly formulated by B. G. Ananyev. A person is considered simultaneously as a representative of the biological species Homo sapiens (individual), as a bearer of consciousness and an active element of cognitive and reality-transforming activity (subject), as a subject of social relations (personality) and as a unique unity of socially significant biological, social and psychological characteristics (individuality). . This view of a person allows us to study his psychological content on two levels: subordination (hierarchical) and coordination. In the first case, mental phenomena are considered as subordinate systems: more complex and general ones subordinate and include simpler and more elementary ones. In the second, mental phenomena are considered as relatively autonomous formations, but closely connected and interacting with each other. Such a comprehensive and balanced study of man and his psyche essentially merges with a systems approach.

System method

The systems approach is a methodological direction in the study of reality, considering any fragment of it as a system.

The most tangible impetus for the understanding of the systems approach as an integral methodological and methodological component of scientific knowledge and for its strict scientific formulation was the work of the Austro-American scientist L. Bertalanffy (1901-1972), in which he developed a general theory of systems. A system is a certain integrity that interacts with the environment and consists of many elements that are in certain relationships and connections with each other. The organization of these connections between elements is called structure. Sometimes the structure is interpreted broadly, bringing its understanding to the volume of the system. This interpretation is typical of our everyday practice: “commercial structures”, “state structures”, “political structures”, etc. Occasionally, such a view of structure is found in science, although with certain reservations. An element is the smallest part of a system that retains its properties within a given system. Further dismemberment of this part leads to the loss of the corresponding properties. Thus, an atom is an element with certain physical properties, a molecule is with chemical properties, a cell is an element with the properties of life, a person (personality) is an element of social relations. The properties of elements are determined by their position in the structure and, in turn, determine the properties of the system. But the properties of the system are not reduced to the sum of the properties of the elements. The system as a whole synthesizes (combines and generalizes) the properties of parts and elements, as a result of which it possesses properties of a higher level of organization, which, in interaction with other systems, can appear as its functions. Any system can be considered, on the one hand, as a combination of simpler (small) subsystems with their own properties and functions, and on the other, as a subsystem of more complex (larger) systems. For example, any living organism is a system of organs, tissues, and cells. It is also an element of the corresponding population, which, in turn, is a subsystem of the animal or plant world, etc.

System research is carried out using system analysis and synthesis. In the process of analysis, the system is isolated from the environment, its composition (set of elements), structure, functions, integral properties and characteristics, system-forming factors, and relationships with the environment are determined. In the process of synthesis, a model of a real system is created, the level of generalization and abstraction of the description of the system is increased, the completeness of its composition and structures, the patterns of its development and behavior are determined.

Descriptions of objects as systems, i.e. system descriptions, perform the same functions as any other scientific descriptions: explanatory and predictive. But more importantly, system descriptions perform the function of integrating knowledge about objects.

A systematic approach in psychology makes it possible to reveal the commonality of mental phenomena with other phenomena of reality. This makes it possible to enrich psychology with ideas, facts, and methods of other sciences and, conversely, to penetrate psychological data into other areas of knowledge. It allows you to integrate and systematize psychological knowledge, eliminate redundancy in accumulated information, reduce the volume and increase the clarity of descriptions, and reduce subjectivity in the interpretation of mental phenomena. Helps to see gaps in knowledge about specific objects, detect their incompleteness, determine tasks for further research, and sometimes predict the properties of objects about which there is no information, by extrapolating and interpolating available information.

In educational activities, systematic methods of description make it possible to present educational information in a more visual and adequate form for perception and memorization, to give a more holistic picture of the illuminated objects and phenomena, and, finally, to move from an inductive presentation of psychology to a deductive-inductive one.

The previous approaches are actually organic components of the systems approach. Sometimes they are even considered as its varieties. Some authors compare these approaches with the corresponding levels of human qualities that constitute the subject of psychological research.

Currently, most scientific research is carried out in line with a systems approach. The systems approach found the most complete coverage in relation to psychology in the following works.

Interpretable machine learning model. Part 1

Hi all. There is just over a week left before the start of the “Machine Learning” course. In anticipation of the start of classes, we have prepared a useful translation that will be of interest to both our students and all blog readers. Let's begin.

It's time to get rid of the black boxes and strengthen your faith in machine learning!
In his book “Interpretable Machine Learning,” Christophe Molnar perfectly captures the essence of the interpretability of Machine Learning with the following example: Imagine that you are a Data Scientist, and in your free time you are trying to predict where your friends will go on vacation in the summer based on their data from Facebook and twitter. So, if the prediction turns out to be correct, then your friends will consider you a wizard who can see the future. If the forecasts are wrong, it will not harm anything except your reputation as an analyst. Now let’s imagine that this was not just a fun project, but that investments were attracted to it. Let's say you wanted to invest in a property where your friends would likely vacation. What happens if the model's predictions fail? You will lose money. As long as a model does not have a significant impact, its interpretability does not matter much, but when there are financial or social consequences associated with the model's predictions, its interpretability takes on a completely different meaning.

Explainable Machine Learning

To interpret means to explain or show in understandable terms.
In the context of an ML system, interpretability is the ability to explain its operation or show it in a human-readable way. Many people have dubbed machine learning models “black boxes.” This means that although we can get an accurate forecast from them, we cannot clearly explain or understand the logic behind their compilation. But how can you extract insights from the model? What things should we keep in mind and what tools will we need for this? These are important questions that come to mind when talking about model interpretability.

The Importance of Interpretability

The question that some people ask is, why not just be happy that we get a specific result from the model, why is it so important to know how a particular decision was made?
The answer lies in the fact that the model can have a certain influence on subsequent events in the real world. For models that are designed to recommend movies, interpretability will be much less important than for those models that are used to predict the outcome of a drug.

“The problem is that a single metric, such as classification accuracy, is an insufficient description of most real-world problems.” (Doshi-Velez and Kim 2017)

Here's a big picture about explainable machine learning. In a sense, we are capturing the world (or rather, information from it) by collecting raw data and using it to make further predictions. In essence, interpretability is just another layer of the model that helps people understand the whole process.

Text in the picture from bottom to top: World -> Information Retrieval -> Data -> Learning -> Black Box Model -> Extraction -> Interpretation Methods -> People
Some of the benefits that interpretability brings:

  • Reliability;
  • Ease of debugging;
  • Trait Engineering Awareness;
  • Manage data collection for features;
  • Informing decision making;
  • Building trust.

Model Interpretation Methods

Theory is only meaningful as long as we can apply it in practice.
In case you really want to understand this topic, you can try taking the Machine Learning Explainability course from Kaggle. In it you will find the right balance of theory and code to understand the concepts and be able to apply in practice the concepts of interpretability (explainability) of models to real cases. Click on the screenshot below to go directly to the course page. If you want a quick overview of the topic first, continue reading.

Insights that can be gleaned from models

To understand the model we need the following insights:

  • The most important features in the model;
  • For any specific model prediction, the influence of each individual feature on the specific prediction.
  • The influence of each feature on a large number of possible predictions.

Let's discuss a few methods that help extract the above insights from the model:

Permutation Importance

What features does the model consider important?
Which signs have the greatest impact? This concept is called feature importance, and Permutation Importance is a method widely used to calculate feature importance. It helps us see when the model produces unexpected results, and it helps us show others that our model works exactly as it should. Permutation Importance works for many scikit-learn evaluations. The idea is simple: Randomly rearrange or shuffle one column in the validation dataset, leaving all other columns untouched. A feature is considered “important” if the accuracy of the model decreases and its change causes an increase in errors. On the other hand, a feature is considered “not important” if shuffling its values ​​does not affect the accuracy of the model.

How it works?

Consider a model that predicts whether a football team will win the “Man of the Game” award or not, based on certain parameters.
This award is given to the player who demonstrates the best skills in the game. Permutation Importance is calculated after the model is trained. So let's train and prepare a RandomForestClassifier model, denoted my_model, on the training data. Permutation Importance is calculated using the ELI5 library. ELI5 is a library in Python that allows you to visualize and debug various machine learning models using a unified API. It has built-in support for several ML frameworks and provides ways to interpret a black-box model.

Calculation and visualization of importance using the ELI5 library: (Here val_X, val_y denote validation sets, respectively)

Interpretation

  • The signs at the top are the most important, at the bottom the least. For this example, the most important attribute was goals scored.
  • The number after the ± reflects how performance changed from one permutation to the next.
  • Some weights are negative. This is because in these cases, the predictions from the shuffled data were more accurate than the real data.

Practice

Now, to look at the full example and check if you understood everything correctly, go to the Kaggle page here.
So the first part of the translation has come to an end. Write your comments and let's meet on the course!

Read part two.

Rating
( 2 ratings, average 4.5 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]