Programming Affect in Artificial Intelligence: The Possibility of Coding an Affective Organization
by Zeynab Javid

No Abnormalities | Elise Racine | https://betterimagesofai.org / https://creativecommons.org/licenses/by/4.0/ **
If something we regard as a hallmark of human intelligence can be accomplished without human experience, then which part of it, exactly, is human?
The 1997 chess match between Garry Kasparov and Deep Blue, the computer that played against him, was covered by more than 300 journalists from around the world. The event was widely framed as a confrontation between human and machine. Newsweek famously presented the match as “The Brain’s Last Stand,” suggesting that Kasparov’s performance could become an early indication of whether humanity could maintain its identity and superiority in the face of increasingly powerful machines (Levy, 1997).
Yet the deeper question was not simply whether a computer could play chess. It was whether a machine could perform something that had previously been regarded as a distinctive expression of human intelligence and, if so, what this would tell us about the nature of intelligence itself.
Since then, artificial intelligence has moved far beyond chess.
But what is it that gives artificial intelligence a different kind of power? First, there is a memory very different from human memory, one that, unless it encounters a technical failure, can retain enormous amounts of information without the ordinary forms of forgetting, misplacement, and recall error that characterize human memory. Such a memory affects the parameter of time in a significant way: time is economized, processing can accelerate, and a great deal of work can be done in less time.
There appears to be a relationship between memory, processing capacity, and our experience of time, as information can be stored and processed at increasingly greater scales and speeds, the temporal limitations that constrain human cognition become less restrictive for artificial systems. In this sense, artificial intelligence can operate as though it were situated in a temporal environment very different from our own, with enormous capacity for computation and problem-solving and without the biological aging that limits human beings.
The feeling of helplessness and powerlessness in the face of technology is not a new occurrence, but the boundlessness and lack of control we feel today in the face of artificial intelligence may be unprecedented in its speed and scale. The power gained through the development of memory and processing capacity in AI has expanded exponentially in ways that do not correspond to the more gradual limitations we have historically associated with human cognition.
Human questions about machines and technology have, from the beginning until today, been answered progressively:
Could there be a tool that could do muscular work in my place? Yes.
Did this tool, for a period, lead to disorientation and the loss of certain job opportunities? Yes.
Did this period continue? To a large extent, no.
Could this tool do computational work in my place? Yes.
Could this tool, for a period, create the same disorientation again? Yes.
Will this period continue? Probably not.
So now, after passing through these periods, could there be a tool that, after simulating muscular power and computational power and thought to a far greater degree, step into the field of simulating the human nervous and affective system? It does not seem possible to answer this question in the negative. Not, at least, given what has been possible so far.
Can Artificial Intelligence Understand Affect?
We come to understand our own and others’ emotions through the categorization of incoming data – facial signs, the body, and an inner sense of affect that is not necessarily describable. For those reasons, among others, conscious understanding of an affect is a complicated concept, even if we can announce that we feel a particular emotion.
Artificial systems can already be designed to detect or classify emotional information. They can identify facial expressions, analyze language for emotional content – called sentiment analysis — and generate responses that seem empathic or emotionally appropriate. It is often said that the system does not feel but merely simulates feeling – a claim I will return to. What can be said for now is only that recognition does not necessarily mean organization. This distinction is important.
By what mechanism or mechanisms do we recognize that we are angry rather than happy, anxious rather than calm, or sad rather than indifferent? We cannot easily explain the entirety of this process. We may recognize an affective state through a set of bodily sensations, internal signals, memories, perceptions, thoughts, and relational meanings. Some aspects of affect are related to physiological processes; others become meaningful through experience and interaction.
Much of what organizes an affective experience may occur before it becomes available to conscious reflection. The distinction between understanding and simulating affect is therefore not necessarily straightforward.
This does not make the question “does AI really understand, or does it merely simulate?” a false question. Rather, it suggests that answering it may require us to examine more carefully what we mean by understanding, and what kind of organization would have to be present for understanding to be more than the production of an apparently appropriate response.
But I am interested in a question that goes beyond the recognition of affect. What I am concerned with here is not merely the recognition of an emotional state, nor merely its physiological correlate. Rather, I want to investigate affect as something that becomes organized within a relational system: something that takes shape through interaction, finds meaning, is transformed, and is returned within relationships.
Is Affect Codable?
Neurology makes important contributions to the study of the nervous system and its functions. But another kind of knowledge is relevant for understanding affect.
For more than a century, psychoanalysis has examined affect not merely as an isolated, internal event, but as something intertwined with relationships, defenses, meanings, fantasies, unconscious processes, and interactions between minds. The world of affect is vast, and many of its dimensions still remain insufficiently understood.
Defense mechanisms, the displacement of affect, the concealment of one affect behind another, the transformation of one emotional experience into another, and the ways in which affect changes within relationships are all phenomena familiar in psychoanalytic work.
But does affect have a defined and systematic structure? At present, it may seem that it does not. Yet, could it possibly have such a structure? Yes, this possibility exists.
Perhaps affects are not separate structures existing independently of one another but instead form an organized system in which different affective states relate to one another.
If such relationships could be identified, then from a computational and geometric perspective it might be possible to represent them graphically, formulate aspects of their relationships mathematically, and finally ask whether these formulations could be encoded computationally.

Figure 1. Affective Structure (simplified). From a forthcoming book © Zeynab Javid *
This does not mean reducing affect to a number, nor claiming that a mathematical representation could contain the entirety of human emotional life. Rather, it means asking whether there is a level of organization within affect that can be described with sufficient precision to become a subject of further scientific inquiry.
We have achieved an extraordinary degree of knowledge about most other structures of the body. We can describe the musculoskeletal system, organs, blood vessels, the lymphatic and nervous systems, and many other components in terms of their form, dimensions, relationships, and functions. Affect is one domain where our structural description remains less developed.
This raises a larger epistemological question. What would be necessary for psychoanalytic observations about affect to become formalizable enough to enter into dialogue with computation, mathematics, and the sciences of biological systems?
I do not think this question can be answered simply by declaring psychoanalysis scientific or unscientific. The more interesting question may be what kind of formalization would be needed for psychoanalytic observations to become testable, representable, or computationally investigable in a new way. This is where the clinical encounter can provide a useful starting point.
Affect in a Relational Process
In the consulting room, the analyst understands how not to turn personal emotional experience into a basis for judgment or direct action with the patient. This is one of the most important features of psychoanalytic technique, and allows the patient’s feelings and inner life to occupy the center of the therapeutic process. When the patient is not met with a judgmental or defensive reaction from the therapist, space opens for experiencing and expressing a broad range of feelings, ideas, and fantasies.
Bion calls containment (1962). In this conceptualization, the analyst receives the patient’s raw and often unbearable feelings, processes and metabolizes them, and returns them to the patient in a more tolerable and comprehensible form. Over time, this process can gradually lead to the patient’s understanding their feelings and to developing a clearer, healthier way of organizing and metabolizing emotions.
If I want to present this process as a model, I can think of it as a relationship between two cores. Core 1: the patient is the carrier and producer of a complex and largely unorganized set of feelings. These appear within the relationship – typically implicitly, in disjointed fragments, and via behavioral or symbolic displacements — and are projected or transmitted toward Core 2 — the therapist. Core 2 has her or his own independent affective experience but takes a different position toward Core 1’s affective expressions and experiences: receiving them, understanding and digesting them, giving them meaning and a name, and then, perhaps after some time delay, returning them to Core 1 in a form more likely to be digested and integrated.
Projective Identification has been one of the important axes of psychoanalytic theory and technique and remains a subject of extensive discussion and reconsideration in contemporary psychoanalysis. I consider it an important part of this structure and process. In his rereading of this concept, Ogden (1982) understands projective identification not merely as a one-sided intrapsychic fantasy, but as a relational process involving the projection of a part of the self into the other, the recipient’s actual psychological processing of that experience, and the possibility of its transformation and return. In my view it is precisely this relational framework that makes the question of formalization possible to raise. If we consider this process not merely as a clinical phenomenon but as a process with definable relations and transformations, why couldn’t it be formulated in some formalizable way?
Through the process described, Core 1 gradually comes to possess a clearer organization of feelings – an organization that was previously vague, tangled, and difficult to understand. Therefore, what happens in the consulting room can be seen not only as an experience between two people, but as a kind of affective organizing process that takes place within the context of a relationship.
But the question of formalization is open, not a definite conclusion. Is the overall structure that the therapist brings into the consulting room – through a synthesis of training, temperament, experience, and also, to some extent, other less-than-conscious capabilities – fundamentally something that could be mathematically formulated and then coded in a programming language? And if the answer to this question is positive, the possibility of coding such an affective organization in an artificial intelligence system would seem imaginable.
Carrying this speculation further, what would be needed is not simply adding feelings, so-to-speak, to an artificial intelligence; rather, it would be whether it is possible to create a relational and organizing structure within which something like affect could emerge as a consequence of that structure.
A flaw in containment: Artificial Intelligence as a More-Than-Good-Enough Mother
What seems most concerning to me about artificial intelligence is its constant availability. In the psychoanalytic literature, frustration is understood as necessary to healthy psychological development, while a lack or absence of frustration will limit the development of capacities for dealing with what cannot be immediately satisfied. Artificial intelligence is now creating exactly a condition for immediate satisfaction.
In the past decade, the near ubiquity of smart mobile devices has led to a drastic change in relationships where virtuality plays a more prominent role in the routine and everyday events of life than real connection. This has created acute widespread loneliness and disconnection. One of the recurring, iconic images of this phenomenon is a scene of friends sitting next to one another staring at their phones instead of talking to each other.
As complicated and concerning as this situation may be, it is poised to escalate into a crisis of even greater proportions as people increasingly interact with more conversational AI agents. These are, to be clear, systems without any affective organization and which respond in ways that are fundamentally different from a human being.
Returning to the model I have presented, if the function of Core 2 could be formalized, one consequence follows immediately: in principle, its failures could also be formalized. Core 1’s capacity to tolerate its own affects is not something given in advance; this capacity is built gradually, through repeated cycles with a Core 2 that is by definition not perfectly reliable.
Winnicott’s concept of the good-enough mother (1953) – a mother whose failures in meeting her child’s needs are small, timely, and tolerable – points to something structural here: it is this imperfection of containment, namely, the small and tolerable failures that drives Core 1 to cultivate its own capacity to tolerate what Core 2 does not immediately resolve. An artificial Core 2 built on this model would have no biological need to withdraw, would have no fatigue limiting its scope of attention, and would have no independent life that occasionally makes it unavailable – that is, exactly the qualities that, in a human Core 2, create small and partial failures that Core 1 depends on for developing its own capacity for tolerance. Therefore, an AI capable of theoretically total containment might simply function more like a Core 2 whose very completeness removes the friction that would otherwise force Core 1 to cultivate its own capacity for tolerance.
This is not an argument against the possibility of an AI with affective organization. Rather, it is another question that the model itself raises when we take its formalization seriously: if containment can be coded, perhaps its optimal failure must also be codable. An affective organization that succeeds too completely may, structurally, be a different kind of danger from an organization that fundamentally fails.
The Possibility of an Affective Organization
The possibility that matters to me is that affect may not be an unstructured collection of separate emotional states. It may instead have relationships that can be represented and transformed, and perhaps eventually formally formulated. If such a thing is possible, then psychoanalytic concepts could enter into an unexpected dialogue with computational modeling.
In that case, the question would no longer be whether a machine can imitate a human smile, recognize sadness in a face, or produce a reassuring sentence. The questions would be whether the conditions that organize affect can themselves become part of an artificial system. And if this happens, what consequences would it have?
Would such a system merely simulate affect more convincingly? Or could it actually create forms of artificial agency that, rather than relying on purely cognitive computation, depend on affective organization?
Could relational processes such as projection, containment, transformation, and return be represented computationally?
And perhaps most fundamentally: what would it mean for affect to not merely be represented by an artificial intelligence but organized within it?
These questions also bring me back to a concern that psychoanalysis must confront.
The effects of artificial intelligence on human communication, intimacy, dependency, and relationships will only become increasingly important subjects for psychoanalytic research. But as corollary to these vitally impactful matters, artificial intelligence may also challenge psychoanalysis to formally formulate some of the phenomena it has observed for more than a century.
Psychoanalysis has rarely attempted to move toward the world of diagrams and geometry, even though systematic representation has played an important role in many other scientific fields. Perhaps the apparent dispersion and complexity of affect is one reason why its formalization has been difficult. But difficulty does not necessarily mean impossibility. If affect has an organization that can be described, represented, and mathematically examined, then perhaps a new language could take shape between and among psychoanalysis, mathematics, computation, and the study of artificial systems.
I do not know whether affect is ultimately codable or not. That is precisely the question.
The challenges are considerable. Unlike muscles, blood vessels, and nerves, the subject matter of psychoanalysis cannot be seen directly, and so it has not been readily picturable. This lack of representability makes its ideas and phenomena harder to situate within a defined scientific framework. Advances in neuroscience and neuropsychoanalysis notwithstanding, no microscope, telescope, blood test, or CT scan yet exists for probing mental architecture. These limits complicate the work of fortifying psychoanalysis within both the broader disciplines of the hard sciences and technology, but I do not consider it impossible.
I propose we begin with a question: can the organization of affect be described precisely enough to be modeled? If so, coding affect would no longer mean programming an emotion into a machine. It would mean constructing the conditions under which something like affect could emerge from an organized relational system. However distant this possibility may seem, it may be one of the most consequential questions at the boundary between psychoanalysis and artificial intelligence.
References
Bion, W. R. (1962). Learning from Experience. London: Heinemann.
Levy, S. (1997, May 5). The Brain’s Last Stand. Newsweek.
Ogden, T. H. (1982). Projective Identification and Psychotherapeutic Technique. New York: Jason Aronson.
Winnicott, D. W. (1953). Transitional objects and transitional phenomena: A study of the first not-me possession. International Journal of Psycho-Analysis, 34, 89–97.
<><><><><><><>
* Visualization, a geometric orientation toward phenomena, and an inclination to render them in code have always been among my preferred modes of thought. In psychoanalysis, I have come to regard this orientation as a path toward observing and elaborating structures which remain ambiguous and vast. To that end, I have been developing graphical representations to be included in my forthcoming book, Affective Structure: Toward a Relational Psychoanalytic Theory, ideas from which are the basis for this article.
This figure is a simplified representation of what I have called Affective Structure. Affective Structure is my attempt to describe how an affective organization might take shape out of the interactional cycle between Core 1 and Core 2. Over time, through countless interactions between the two cores, the central axis of which emerges from Projective Identification, this process may lead to a structure resembling this diagram.
Each node represents the emergence of a new affect whose formation depends on the preceding nodes and on the interaction with the opposing core. The numbers mark the order in which these affects emerge.
<><><><><><><>
** No Abnormalities by Elise Racine | https://betterimagesofai.org | https://creativecommons.org/licenses/by/4.0/
‘No Abnormalities is part of the artist’s series, ‘Algorithmic Encounters’: By overlaying AI-generated annotations onto everyday scenes, this series uncovers hidden layers of meaning, biases, and interpretations crafted by algorithms. It transforms the mundane into sites of dialogue, inviting reflection on how algorithms shape our understanding of the world. This image shows a blue xray image of a person’s chest – it shows the ribs, the faint outline of a heart, and other organs. The image features yellow squares surrounding the organs (left lung, trachea, right lung, heart, diaphragm) – each of them feature labels such as: normal, midline, normal size. There is text in the right bottom corner in white which states ‘no abnormalities detected’.

