Thursday, April 11, 2019

Consciousness in organisms without brains?

Epistemic status: very speculative

As far as I know, there are basically four mainstream theories out there as to what things posses consciousness:
  1. Only humans
  2. Only organisms with brains (or at least nervous systems)
  3. Everything (panpsychism)
  4. Any system fulfilling certain informational or physical properties (IIT, Tegmark, etc.)
I've been inclined toward an intermediate position, that consciousness is a property of all (or many) biological organisms, not necessarily limited to the ones with nervous systems.The central problem of defining what is 'in' and what is 'out' with respect to consciousness is that we are always generalizing from ourselves; we know that we are conscious because of cogito ergo sum, other humans look and behave sufficiently similar to ourselves so we assume that they are conscious even though they might be philosophical zombies. Dogs also seem to behave autonomously and respond to stimuli in a similar manner to how we do, so we (everyone in group 2 and below) add them to the 'in' group as well. As we move further out the taxonomy of organisms, things start to look less like us, so we doubt whether they have consciousness. Plants don't move, so we tend not to think they're conscious, even though there's no a priori reason to believe that movement is a criteria for conscious experience. At the same time, we can look at a single-cell microorganism which uses chemical sensing to find food, move toward it, and consume it, and it's easy to attribute human-like thought to it just like we would to a dog.

I don't know what it's like to be plankton or an amoeba or a cactus, but it's not inconceivable that it might be feel like something to be like them. I don't think that organisms without brains and organisms with brains are that different from each other. In other words, while the brain has a particular way of going about computing and whatever else it does, biology had mechanisms of sensing, locomoting, processing information, making decisions, and so on long before brains existed, using various sorts of molecular machinery. Our brains still rely on much of this molecular machinery, and while our brains may be more 'advanced' in some sense, brains are just one solution that evolution found to surviving and reproducing in a changing environment. People who study cell and molecular biology will tell you that even a single cell has an extremely intricate and complex stucture; cells are basically cities of molecules, complete with a government, transportation of products, an economy, specialized professions, and so on. So if the complexity of the brain is what drives people to a brain-centric view of consciousness, I think the complexity of the cell could inspire a biology-centric view of consciousness. It could also inspire a cell-centric view of consciousness, as some have argued, but I think this runs into the same combination\binding problem as panpsychism -- in other words, if each of our individual cells are conscious, what accounts for our unified conscious experience? My intuition is thus that while complexity exists at the level of the single cell, somehow the organism as a biological whole - whether it be a single-celled amoeba or a tens-of-billions-of-cells human - comprises a complete entity with a unified conscious experience. The nature of that experience can vary widely, depending on the sensory, motor, and information processing capabilities that the organism has, but we already know that consciousness is diverse; there are blind people, people with synesthesia, people with autism, and so on. Extrapolating from our experience to that of rocks is difficult because rocks don't have sensing, processing, or decision-making capabilities, but extrapolating to a sniper plankton isn't inconceivable. My preference for this approach is also guided by the idea that there seems to be some kind of phase transition between non-living matter and biological organisms that doesn't seem to exist between organisms with brains and those that don't. The brain seems to have evolved rather smoothly via normal evolutionary processes, whereas the emergence of life from inorganic matter remains one of the great mysteries of science despite the Miller-Urey experiments. I am thus inclined to speculate that whatever mysterious process sparked the emergence of life may have also sparked consciousness, and the brain, while important for certain kinds of fancy computation, is not necessary for conscious experience. (In organisms which already have brains, of course, the brain is an integrated and necessary part of our conscious experience, but brainless organisms may implement their conscious experience differently.) If this view is correct, the scientific side of the hard problem of consciousness is no longer strictly a neuroscience question but rather a general systems biology question and deeply tied to questions regarding the origin of life on Earth. Addendum: There are some interesting questions on this view pertaining to the definition of a 'complete organism' which I'm not sure are easy to answer. For example are viruses conscious? Mitochondria? Are individual ants conscious, or perhaps the entire colony can be considered conscious? What about human societies? To the latter question I'm inclined to say 'no' because my strong feeling is that consciousness really is only present at the single-organism level, but for some reason organisms that are very colony-like such as ants or colony-forming bacteria make me suspect that the boundaries between organisms are not trivial to define. Humans may also be able to form a collective conscious experience, which Haidt discusses a bit in The Righteous Mind; I'm not sure how far I want to take that though.

Friday, February 1, 2019

Book Review: The Conquest of Happiness (Bertrand Russell)

Image result for on the conquest of happiness

I.

The Conquest of Happiness, first published in 1930, is a book written by Bertrand Russell on the topic of living a happy and fulfilling life. Russell may most prominently be known for his contributions to mathematics and logic in the Principia Mathematica, where he (in)famously takes over 300 pages to prove the statement 1 + 1 = 2. Perhaps the stereotypic expectation of such a mathematically-minded person would be that questions pertaining to emotional satisfaction would hold no interest. The stereotype is of course erroneous, emotions are as relevant to logicians and mathematicians as they are to anyone else. Particularly in the case of Russell, who wrote extensively and with great insight on wide range of subjects, it should come as no surprise that the subject of happiness did not elude his wit or his pen.

Writing at the turn of the 20th century, Russell had to contend with a social, political, and economic landscape that was changing in radical ways. The first World War, which Russell vociferously and famously opposed, had upended thinking about international politics. Women were beginning to enter the workplace, and slavery was starting to be seen as a universal moral evil. There were also upheavals taking place in the class structure of English society, which Russell, as a member of the upper class, observed firsthand. Russell generally saw the movement of society in a "democratic" (we might use the word "egalitarian") direction to be a positive development, but he was also concerned with the consequences this would have on people who would find themselves disoriented as the world transitioned from pre-modernity to modernity.

Russell was also dealing with a world that was slowly starting to shed religion in favor of science. Russell himself was an embodiment of this process, having been raised in a staunchly Christian home but becoming an atheist at the age of 18. The struggle between religious ideas and secular ones are explicit in this book; Russell generally prefers secular philosophy, but there are a number of points where he implicitly or explicitly takes up a perspective which is more religious or mystical than one would expect from a man with a purely scientific background.

Russell's central thesis (although he has several) is that the key to happiness is the focus of conscious attention on external objects, not on internal thoughts and feelings. The more a person is engrossed with things outside of himself -- including work, hobbies, social relationships, raising a family, and so on -- the less time he spends in the prison (his word) of his own mind. The quest for happiness is thus a "conquest" in the sense that it entails a sustained effort to find external things to become engaged in and to engage with them.

A person's vocation is one of the primary objects that a person should concern himself with and find happiness in. There are differences in types of work in terms of how easy it is for a person to find the work enjoyable, but any kind of work that involves an improvable skill will allow a person to find fulfillment in increasing his abilities. Moreover, work that involves advancement, either in terms of improving one's reputation in the field or in terms of pay, has the potential to allow a person to feel a sense of progress. Work that involves a challenge - Russell here anecdotally mentions his gardener, who was continually beleaguered by rabbits who would eat the vegetables in the gardens - will tend to provide a sense of satisfaction upon surmounting obstacles. Constructive work - work that involves the production of some final product that one can directly observe - can also bring about feelings of satisfaction and pride.

However, a person should not focus solely on his work, because oftentimes work can become bound up in feelings of frustration and anxiety. Russell therefore recommends that people take interest in as many extra-vocational things as possible, regardless of what they are. In this vein he mentions a fellow mathematician who enjoyed stamp-collecting; whenever he found that that he was not making progress in proving theorems, he would always be able to take solace in the calming task of cutting and pasting stamps. Being interested in people and social interaction also has this benefit; if one enjoys spending time with friends as well as meeting new people, he is given plentiful opportunities to focus his attention externally.

The notion of "zest" is an important concept here. In order to enjoy life, a person should take a positive emotional attitude to everything that he does and make an effort to actively enjoy every aspect of experience, whether it is work, play, eating, socializing, or family life. Russell denounces the depressive view, perhaps best characterized by the biblical book of Ecclesiastes, that the joys which life has to offer all eventually become stale and that "there is nothing new under the sun." On the contrary, it is possible for a person to find new excitement and challenge even in routine, day-to-day existence, and if one has the attitude that life is exciting, one can indeed find excitement in it. In addition to this critique of Ecclesiastes, Russell warns in general against pessimistic philosophies which claim that to be wise is to be sad and that knowledge brings with it unhappiness. Rather, the wise man who knows how to be happy is wiser than the wise man who thinks that life is endemically miserable.

Russell takes on other aspects of Judeo-Christian philosophy as well. He regards the idea of sin, which plays a prominent role in both Judaism and Christianity, as almost wholly harmful. Children are taught concepts of "right" and "wrong" by their parents at a very young age, but these rigid notions of what constitutes proper behavior carry with them a psychological need for perfectionist attainment of virtue, which Russell regards as incredibly harmful to the psyche (he was likely speaking from personal experience here), especially with respect to sexuality. While prosocial behavior is important, Russell seems to recommend that people not worry too much about morality in their daily lives; just don't behave in a way that will piss people off too much or get you thrown in jail and you'll be fine.

Much self-defeating moral thinking involves people feeling obligated to do things for others beyond what would be expected naturally. Russell strongly advocates for setting boundaries - "No person should be expected to distort the main lines of his life for the sake of another individual." Similarly, Russell is a proponent of developing a healthy self-image and ego. Rather than being detrimental, a strong sense of self-worth can reduce conflict. Peacocks are peaceful birds because each peacock thinks that he is more beautiful than the others; thus they have no reason to be jealous and fight with others.

Russell acknowledges that it is often difficult to contend with deep-seated anxieties, including fears that stem from a childhood inculcation with religious or religious-like attitudes pertaining to "fear of sin." Russell has a practical technique for dealing with anxiety - if a thought is troubling you, he says, first analyze it rationally to the fullest extent possible in order to determine if there is any action that you should take. Once you have analyzed it consciously, hand it off to your subconscious mind to do the rest of the work, and don't bring it back to conscious attention unless new information comes to light which will change your analysis or if you need to make an immediate decision. While this approach may be easier said than done, Russell is insistent that the development of a well-ordered mind - in the sense of only thinking about things when they are relevant - is crucial to achieving happiness.

There is one aspect of religion which Russell does seem to appreciate, which is the concept of "resignation", or leaving things to the hands of God (though Russell himself was of course an atheist). Russell recommends finding a golden mean between effort and resignation. On the one hand, life requires work and an expenditure of energy. A person who doesn't put effort into his life will not be happy, and a society where people resign themselves entirely to fate will never become civilized. On the other hand, people should live the attitude that not everything is within man's control; do what you can and leave the rest up to God/chance/fate. The desire to control everything will only lead to unhappiness.

 A large portion of The Conquest of Happiness book deals with love, raising children, and the role of women in the new modern society. With respect to romantic love, Russell has a positive disposition, although he cautions against the religious attitude toward love, which treats love as a pure, sacred object - an attitude needed to redeem marriage from the sinfulness associated with sex. Instead, Russell recommends a more grounded approach, treating love as an important part of human experience rather than something mystical. Consistent with Russel's emphasis on the importance of focusing on objects external to one's self, love allows a person to extend his or her natural sense of self-interest beyond the immediate self, which is a generally positive thing. Moreover, certain experiences can only be optimally appreciated in the context of romantic love, such as the appreciation of a beautiful sunset. Love should not come from a sense of neediness, but rather from a sense of appreciation; the experience should be more like appreciating a coastline from the deck of a cruise ship rather than desperately seeking land after being stranded at sea. While the act of love involves no small amount of selflessness, love must contain a selfish component too; your partner won't be too happy if they find out that you don't selfishly enjoy their presence.

When it comes to children, Russell realizes that modernity has made parenthood much more complicated than in days past. The old attitude of raising children was in a sense tyrannical; parents expected complete obedience from their children. With the advent of psychology and scientific advances pertaining to early childhood education, the world has come to realize that this is not a healthy way to create well-adjusted adults. While it is of course necessary for parents to exercise some level of power over their children, Russell cautions against parents who are overprotective of their children, instead recommending that parents give up their need to control their child for the sake of the child's wellbeing. The sense of satisfaction from bearing children, in the absence of complete obedience, should come from the fact that children allow one to participate in the future, via their offspring, long after their own demise (Russell here mentions the model of Abraham in the Bible as an attitude that is worthwhile to adopt.)

The idea of being part of a narrative larger than one's self is another crucial concept for people to apprehend. Russell recommends the study of history, which enables a person to see himself as a link in a chain, rather than as an independent entity with cosmic significance. Although seeing oneself as an largely unimportant piece of a large story  can seem disheartening, it can also be reassuring, as it means that your problems are also not cosmic problems; they likely would not even make footnote status in the grander historical narrative. Russell here recommends that when one finds himself anxious about some challenge in their life, he should see himself as a single portrait among the many portraits of people who have lived over the course of history. Often, one may find that one's own problems are not that dissimilar to some notable person who lived in years past; he may thus draw comfort from the fact that the vicissitudes he faces are no worse than those face by other characters over the course of time. Similarly, caring about the future of humanity beyond one's self allows a person to think positively about the world even if his own life is difficult.

As a final point that may be interesting to modern readers: the question of women balancing family and work life was as much of an issue in Russel's day as it is today. Russell takes a progressive stance on this question, arguing that for the most part, an educated woman will generally find more happiness and satisfaction in a career where her talents are utilized, rather than in focusing on housework where her talents will be squandered. Moreover, a woman's relationship with her husband will be better if they both have the opportunity to work outside the home. Russell thus advocates that  mothers should remain at home with their infants until they reach 9 months of age, at which point it is perfectly appropriate to let them be taken care of by professional caretakers\educators who have been trained with the latest scientific knowledge of child psychology and education, which can be presumed to be superior to the knowledge of an untrained parent.

II.

The Conquest of Happiness was a fascinating read, not just because of Russel's insights - which I found to be quite valuable, even almost a century later - but also because he is coming from an personal angle which I very much identify with. Having been raised religious and came to secularism on his own, Russell had to create a life philosophy which worked for him, which involved, in many cases, making an explicit decision whether the religious attitude or the secular attitude was the correct one to adopt. In many cases, it is seems that Russell had to come up with his own solutions to certain problems, when neither religion nor the prevailing popular wisdom (or previous philosophy, for that matter) could provide an answer.

It is also seems apparent that Russell wrote this book as the culmination of a struggle to find happiness in his own life. Russell writes that he himself was suicidal in his teenage years, his only solace being the pursuit of mathematics. As he left the confines of religious life and began to make a name for himself in mathematics and philosophy, it would seem that his disposition improved, following  his own advice to focus on external goals, especially work-related ambitions. It is unclear whether Russel's advice in this respect is equally applicable to everyone, or if it is mainly relevant to people like himself, who are perhaps uniquely talented and driven. Becoming more at peace with one's internal self, as opposed to focusing on external aims, might an important talent for many kinds of people, though Russell rejects that approach in a wholesale manner. This puts Russell at odds with the Buddhist/mindfulness view of contentment as well as some of the more modern psychological psychological approaches which place a high value on becoming in touch with one's own feelings. The advantage of internally-directed approaches, among other things, is that they don't require external factors in order to be efficacious.

Russell may have been too flippant on the role of morality and virtue in leading a happy life, perhaps overcorrecting for a rigid religious upbringing. This is another instance where his advice may be correct for a person of his own background, but for people who were brought up in lawless and chaotic environments, the opposite approach may be indicated. There are many in the world who could stand to benefit from a more firm grounding in ethical and virtuous behavior, but Russell either assumes that such people are not his audience or that ethical education is simply not as effective at producing happy and well-adjusted citizens as his other recommendations about finding external goals to dedicate onesself to.

While The Conquest of Happiness covered many aspects of hardship and happiness, Russel, perhaps due his position of economic and social privilege, did not go to great lengths in this work to cover questions of happiness for the oppressed and indigent suffering extreme hardship. At several points Russell simply says that these are important questions outside the scope of the work, but it is nevertheless something to be noted.

A final point to consider is how psychology has changed from the time of Russell to today. Russell was working with Freudian psychology; many of his references to psychology thus relate to the relationship of young children to their parents, especially the mother. Notably absent from the book is any mention of key factors in happiness that modern psychology and medicine take for granted - a good night's sleep, a proper diet, time spent outdoors, and regular exercise. Russell does mention the importance of social relationships and friendship, in that people can become much happier when they move to an environment where people are more congenial, but little emphasis was placed on friendship qua friendship. Perhaps Russell thought these were so obvious to his readers that they didn't bear mentioning, but it would have perhaps been worth a few pages to discuss 'the basics' when it comes to physically healthy habits, because they can explain much of the variance in people's dispositions.

Overall, The Conquest of Happiness is a quality contribution to the self-help genre (as Daniel Dennet put it in the preface to the Kindle edition), and is quite the treasure in that it was written by a brilliant mathematician and Nobel Laureate, which is far more than can be said for other books of the same sort, despite the advancements of our knowledge during that time. His central thesis about external focus is non-trivial and likely controversial in some circles, but if the book didn't rustle at least a few feathers it wouldn't be worth reading.




Tuesday, January 8, 2019

Multiple regression demo

I've been doing some data science work recently, and I've found myself in a position where I need to understand the effects of multiple independent variables on a single dependent variable. One of the most commonly-used techniques to accomplish view the relationships is multiple regression, but I've found surprisingly few good tutorials online that explain how it works.

For this demonstration, I will focus on the relationship between height, weight, and blood pressure. I created a completely artificial data set for illustrative purposes. The demonstration uses Statsmodels and Python, your mileage may vary with other packages. First, let's import the relevant packages:

import pandas as pd
import numpy as np 
import statsmodels.api as sm
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import pyplot as plt
from pylab import rcParams
plt.ion()

The first thing I want do do is create the dataset. I am intentionally forcing height and weight to be correlated in order to demonstrate the performance of multiple regression on correlated data.

N = 100
xName1 = 'Height cm'
xName2 ='Weight kg'
yName = 'Blood Pressure (sys)'
df = pd.DataFrame(columns = [xName1, xName2, yName])
df[xName1] = [np.random.randint(140, 200) for i in range(N)]
df[xName2] = df[xName1]/2 + 8 * (np.random.randn(N)-0.5)
df[yName] = -1*df[xName1]+1.5*df[xName2] + 5*(np.random.randn(N)-0.5) + 160
X1 = df[xName1] 
X2 = df[xName2]
XBoth = df[[xName1, xName2]]
y = df[yName] 

Note that I initialize the first column, X1 (height) as a set of 100 random numbers from 140 to 200. The second column, X2 (weight) is the height divided by 2 plus some Gaussian noise. The final column, y (blood pressure) is created by applying the formula:
-1 * height + 1.5 * weight + noise + 160
To show that the height and weight are correlated, I wrote a custom function, plot2D, which we'll use later.

def plot2D(model, dataX, dataY, color):
    xName = dataX.name
    yName = dataY.name
    params = [float(x) for x in model.params]
    intercept = params[0]
    slope = params[1]
    prediction = slope*dataX + intercept
    plt.plot(dataX, prediction, color)
    plt.scatter(dataX,dataY, color = 'k', facecolors='none')
    plt.xlabel(xName)
    plt.ylabel(yName)
    pvaldict = model.pvalues
    paramdict = model.params
    l1 = ['p_' + str(x) + ' = ' + str('{:0.0e}'.format(pvaldict[x])) + ' ' for x in pvaldict.keys() ]
    l2 = ['Coef_' + str(x) + ' = ' + str(round(paramdict[x],2)) + ' ' for x in paramdict.keys()]
    l3 = 'R^2 = ' + str(round(model.rsquared,3)) + ' f_p = ' + str('{:0.0e}'.format(model.f_pvalue))
    plt.title(' '.join(l1) + '\n' + ' '.join(l2) + '\n' + l3)

Then I created a two-variable regression model in statsmodels to predict the height from the weight and plot the regression line and data points using the above plot2D function:

modelcorr = sm.OLS(X2, sm.add_constant(X1)).fit()
plt.figure('Corr')
plot2D(modelcorr, X1, X2, 'gray')
plt.tight_layout()
plt.show()

Note that I have to add a constant to X1 in order to get a regression with an intercept. I obtain the following plot:


Note the high R^2 value (0.554) in the title. I created the 'weight' variable by diving 'height' by a constant and adding a bit of noise, so this is what we should expect. The p-value of the model (f_p)  is also quite low, indicating that we can reject the null hypothesis that Height and Weight are uncorrelated. The coefficient of the regression that we obtained here (coeff_Height cm) is 0.53, which is very close to the coefficient we used when creating the weight from the height - as it should be. (For the moment, ignore the other variables on top, we'll get back to those.)

What we want to do now is see how Height and Weight affect blood pressure. First, we'll perform separate single regressions for Height vs. Blood pressure (model1) and Weight vs. Blood pressure (model2). Then we'll perform a multiple regression, predicting blood pressure from both weight and height together. To create the models:

model1 = sm.OLS(y, sm.add_constant(X1)).fit()
model2 = sm.OLS(y, sm.add_constant(X2)).fit()
model3 = sm.OLS(y, sm.add_constant(XBoth)).fit()

Now we want to visualize these models and look at their stats. We'll start with the single-variable models, model1 and model 2.

color1 = 'r'
color2 ='b'

fig = plt.figure('Demo', figsize = (24,15))
ax = fig.add_subplot(2, 3, 1)
plot2D(model1, X1, y, color1)

ax = fig.add_subplot(2, 3, 4)
plot2D(model2, X2, y, color2)

We obtain these plots:

Note that while we do observe some single-variable correlation between the Height vs. Blood Pressure and Weight vs. Blood Pressure, the R^2 here is relatively low (0.091 and 0.14, respectively). 

Because our data is, in fact, 3-dimensional, I'll show the same data and regression lines on a 3-D plot. When we plot the regression lines on a 3-D plot, the lines will actually be planes which have a slope only in the direction of a single variable. To plot the 3D data, we'll need a new function.

def plot3D(ax, model, dataX1, dataX2, dataY, coeffs, color):
    xName1 = dataX1.name
    xName2 = dataX2.name
    yName = dataY.name
    meshx = np.linspace(min(dataX1),max(dataX1),55)
    meshy = np.linspace(min(dataX2),max(dataX2),55)
    X,Y = np.meshgrid(meshx,meshy)
    Z = coeffs[0] + coeffs[1]*X +  + coeffs[2]*Y
    ax.plot_surface(X, Y, Z, color = color, alpha = 0.75)
    ax.scatter3D(dataX1, dataX2, dataY, color = 'black')
    ax.set_xlabel(xName1)
    ax.set_ylabel(xName2)
    ax.set_zlabel(yName)
    pvaldict = model.pvalues
    paramdict = model.params
    l1 = ['p_' + str(x) + ' = ' + str('{:0.0e}'.format(pvaldict[x])) + ' ' for x in pvaldict.keys() ]
    l2 = ['Coef_' + str(x) + ' = ' + str(round(paramdict[x],2)) + ' ' for x in paramdict.keys()]
    l3 = 'R^2 = ' + str(round(model.rsquared,3)) + ' f_p = ' + str('{:0.0e}'.format(model.f_pvalue))
    plt.title(' '.join(l1) + '\n' + ' '.join(l2) + '\n' + l3, y=1.08)

In addition to taking the model itself as a parameter, we need to specify the coefficients of the plane in 3-D space, because the 2-D models (model1 and model2) will only give us coefficients in 2 dimensions; we need to add a 0 to create a slope in the missing dimension. So we have:

coeffs1 = [model1.params[0], model1.params[1], 0]
coeffs2 = [model2.params[0], 0, model2.params[1]]
coeffs3 = [model3.params[0], model3.params[1], model3.params[2]]

Finally, we plot model1 and model2 in 3D space:

ax = fig.add_subplot(2, 3, 2, projection='3d')
plot3D(ax, model1, X1, X2, y, coeffs1, color1)

ax = fig.add_subplot(2, 3, 5, projection='3d')
plot3D(ax, model2, X1, X2, y, coeffs2, color2)

And we obtain:

 Note that the 3-D plots here are the same as the 2-D plots above; we're simply showing the regression line in 3-D. On the top, for example, we see that blood pressure is predicted to decrease with height, but this prediction doesn't care about weight at all - for any given value of height, traversing along the data in the 'Weight' direction won't change the prediction. Same thing for the graph on  bottom. Moving along the 'weight' direction will change your prediction, but not moving along the 'Height' direction.

Finally, the multivariate regression:

ax = fig.add_subplot(2, 3, 3, projection='3d')
plot3D(ax, model3, X1, X2, y, coeffs3, 'green')

ax = fig.add_subplot(2, 3, 6, projection='3d')
plot3D(ax, model1, X1, X2, y, coeffs1, color1)
plot3D(ax, model2, X1, X2, y, coeffs2, color2)
plot3D(ax, model3, X1, X2, y, coeffs3, 'green')
plt.tight_layout()
plt.show()

And we obtain:



The top plot shows the prediction of the multivariate regression by itself, the bottom plot shows the multivariate prediction overlayed with the two single-variable predictions from the graphs above. Note, first of all, that the multivariate prediction is *very* different than each of the single variable predictions. Because the mutlivariate model can cave a slope in both the 'Weight' and 'Height' directions, the model that minimizes the mean squared error (MSE) with two variables gives us a drastically different fit than a model that uses only a single variable. Also note the R^2 here: 0.89, very close to a perfect fit. And, incredibly, the coefficients obtained for the prediction are almost the same as the coefficients we used when producing our data! When we originally made our data, we created it with an intercept of 160, a coefficient for height of -1, and a coefficient for weight of +1.5. The multiple regression model predicts these on the nose (intercept: 161.73, height: -0.99, weight: 1.42) despite the fact that the two independent variables were initially correlated with an R^2 of 0.55! Of course, when you have correlated independent variables the results won't always be this good, because multicolinearity is still a concern for multiple regression, but this model did a very good job despite the high correlation between height and weight.

Monday, January 7, 2019

Maharal on Study vs. Practice

In classical rabbinic sources, one can find a tension between the value of the study of Torah vs. the value of practice - i.e. the observance of commandments. The Talmud (Moed Katan 9b) discusses the question of whether a person should interrupt the study of Torah in order to perform one of the commandments, if such an opportunity presents itself. The Talmud concludes that in general, one should only pause his study for the performance of a religious obligation that he can only do himself, but not for an obligation which can be done by others. So you shouldn't interrupt your Torah study to run outside and help an old lady cross the street if there are other people around, but if you're the only one there then you are obligated to get up from your desk and go outside.

The reason for this, Maharal writes, is that - on the one hand - engagement with the Torah is an encounter with the intellectual/eternal/divine, which is far superior to any sort of interaction in the temporal physical world. On the other hand, when a person is faced with an obligation that only he can fulfill, he must fulfill it, otherwise he is lacking in something basic to his humanity. Here Maharal references the Talmudic maxim that the 248 positive commandments correspond to the "248 limbs of the human body". Failure to fulfill one's obligation is tantamount to missing a limb, which is something that a person has to rectify before they engage with higher spiritual realms through the study of Torah.

Maharal cites another passage about the tension between study and practice, this time from Kiddushin 30b. The Talmud relates three views pertaining to the question: "which is greater, study or practice"?

Rabbi Tarfon: Practice is greater.
Rabbi Akiva: Study is greater.
The sages: Study is greater, because study leads to practice.



The Talmud then cites the view of Rabbi Yossi, who seemingly agrees with Rabbi Akiva:

"Rabbi Yossi said: Great is the value of Torah, because the Torah was given 40 years before [the relevance of the commandment of] separating challah (a portion of the dough that is set aside and given to a priest when baking bread), 54 years before the commandment of taking tithes (portions of raw grain that need to be given to the priest, Levite, or poor people), and 104 years before  the Jubilee year (the 50th year after 7 cycles of 7 sabbatical years, at which point slaves are freed and land returns to its ancestral owners)." 
In other words, the Torah was given in the dessert, long before many of the commandments were relevant from the standpoint of practical observance, because many commandments assume the presence of the agriculture economy in the land of Israel, which wasn't in full swing until many years after the people of Israel left the dessert and entered Canaan.

Maharal explains each of the views presented, starting with Rabbi Tarfon. Similar to his comment before, Maharal explains Rabbi Tarfon's view as relating to the fact that the observance of commandments is a basic need; something man needs to do in order to attain completion as a human being. What about Torah study? Maharal here gives an analogy, comparing the observance of commandments to bread and Torah to wine. Even though wine is the more expensive and a more highly-prized product, says the Maharal, bread is still the basic staple of human sustenance. In the same way, even though Torah study may be more valuable in that it allows man to attain intellectual heights, the observance of commandments is more essential. Rabbi Akiva, on the other hand, thought to attribute  more importance to the "wine" - the study of Torah - which connects man to the world of the eternal.

The view of the sages, in the Maharal's interpretation, is simply that the Torah has two benefits: not only does it connect man to the spiritual/intellectual plane, it also teaches him the proper way to act in terms of the observance  of the commandments. So in this sense Torah study isn't just "wine", it has elements of the "bread" as well.

Finally we arrive at the view of Rabbi Yossi, which the Maharal elaborates upon in greater detail. Maharal first notes that all the commandments mentioned by Rabbi Yossi have the element of "sanctity", that is, challah, tithes, and the Jubilee year are all called "holy" at various points in the written Torah. Maharal claims that these commandments are exemplars of different aspects of the physical world that can attain sanctity.

Challah, which is an obligation that pertains to flour and water that have mixed together to become dough, is analogous to the matter we encounter on a regular basis - that is, complex matter, combined of multiple atomic parts. Food, paper, trees, humans, etc. all consist of multiple "simples" combined together, just like dough consists  of flour and water. The Midrash explicitly compares man to dough, in fact; God's making of man from the earth in Genesis is seen by Bereishit Rabbah as akin to a woman kneading flour and water together to make dough. However, man is more than just a complex object; he is a sanctified complex object, comparable to the challah which is separated from the dough after it is kneaded and declared holy.

Tithing, which is an obligation pertaining to raw grain, corresponds to simple, atomic objects, just like raw grain. The commandment to separate tithes demonstrates the ability of atomic objects to also become sanctified.

Finally, the Jubilee year is an example of temporal - as opposed to material - sanctification. The Jubilee comes as the 50th year after 7 of the 7-year sabbatical cycles, the sabbatical cycles representing temporal existence and the 50th year representing something that connects to temporal existence but also surpasses it, as the Jubilee year is not considered part of the 7-year cycle. So the Jubilee year has one foot inside of time and one foot outside of time, so to speak.

According to Maharal, Rabbi Yossi has moved from complex objects (challah) to simple\atomic objects (tithes) to the edge of temporal existence itself (the Jubilee year). However, Torah precedes all of these things, because it exists entirely in the intellectual domain, and is thus superior to anything that is constrained by matter and time.



Sunday, November 4, 2018

In Defense of non-Realist Morality

Some people are terrified of non-realist positions on morality. The reasoning goes as follows: if there is no objective morality, then what makes ISIS wrong? Why can't we behead people, or vivisect babies in a bathtub? Shouldn't there be some sort of objective standard that we can use to prove, on a rational basis, what is right and wrong?
On the one hand, I sympathize with the sentiment, but on the other hand, I think it is misguided. First of all, of course, the fact that something doesn't sit with us emotionally doesn't mean that it's not true. But I'm not even sure that the concern itself is well-founded. Consider: do you think that, if you were to engage an ISIS member in a levelheaded conversation about morality, you would be able to convince him that <insert your favorite moral system here> is the objectively true moral system, and not radical Islam? Radical Islam (like most religions) also has a realist understanding of morality, and their realist interpretation includes beheading infidels. So in order to convince them to adopt your realist system, you'd have to convince on the basis of...what, exactly? If you don't have a shared moral epistemology - that is to say, if you don't agree on a way to discover objective moral truth - then there's no way to convince the ISIS member not to behead people.
The worst case scenarios of non-realist views of morality, I think, are far less scary than those of the realist views. If no one believes in objective morality you tend toward an Ayn Rand-type world where everyone acts in what they believe to be their own self-interest. While it is possible to get stuck in suboptimal equilibria here and have complete anarchy, it's also quite likely that - without any moral realism anywhere - people will cooperate and create prosocial social norms which people perceive to be in their self-interest. And people can also be motivated - simply via self-interest - to create a government that passes laws, again for the common good. You can have strongmen who act in their own interest to harm everyone else, but in the long term the strength of numbers will always overpower the strength of a single person. And when the people don't overpower the strongman, there's often some sort of realist ideology (e.g. communism) which is preventing the natural emergence of opposition to an individual who ruins things for everyone else.
The worst case scenario for realist views of morality are far more scary, especially when there is no agreement on moral epistemology. That's how you get ISIS.
Societies have become less cruel over time (if you are of the view that things are getting better) not because we have discovered better moral principles, but simply because - via trial and error - we have figured out systems and social contracts that are more suited to people's preferences, and because people have figured out how to effectively utilize their power in numbers in order to acheive the preferences of the masses.
What about the individual? For the most part, if you live in a healthy society, social norms and laws will be sufficient to ensure that the individual behaves himself. The incentives in the system should be sufficient, in 99% of cases, to constrain individual behavior to be prosocial. And in the other 1% of cases, people will have to contend with their own conscience. But there are almost always consequences to anti-social behavior. Eventually.

Monday, October 22, 2018

Consciousness and Information (or: Why I am a Cartesian Dualist)

I.
One of the major points of confusion I see in many modern theories of consciousness, including Integrated Information Theory (IIT), Global Neuronal Workspace theory (GNW) and others is an unjustified jump from information and the processing thereof to conscious, subjective experience of that information. The strong versions of these theories tend to make the mistake of saying once you have the right type of information processed in the right way, subjective experience will emerge. On these theories, the brain, which processes a lot of information and combines different kinds of information with each other (IIT) or selectively focuses on a particular subset of information (GNW) thus produces consciousness.

I think that underlying these ideas is a fundamental misconception of what information is and what it can do. Information is a mathematical concept, not a physical one. We can use physical systems to represent information, like we can use a pair of gloves to represent the number "two". But that is just a matter of cognitive convenience; if I wanted, the pair of gloves could represent the number "ten" by counting the number of fingers on the gloves. Information is the same in this respect; Information is a property of random variables, not matter.  I can use a coin to represent a random variable by saying "this coin has two states, heads and tails, and flipping the coin assigns a Bernoulli distribution to the random variable with p = 0.5, and the side on which the coin lands after being flipped determines the outcome of the random variable after the experiment." But this is, again, a matter of convention. I could, for example, consider the number of times the coin flips in the air as the random variable, which would then have a different number of states (in principle, the set of all natural numbers) and a different probability distribution. So the coin itself doesn't contain information intrinsically, the information depends on what we, as observers, choose the coin to represent. (Things become a bit more nuanced with subatomic particles, which have physical states that seem to be at least somewhat well-defined and restricted in terms of the information that they convey, and there's also the issue of Landauer's principle which needs to be addressed, but I'll leave those aside for the moment.)

Image result for gloves
A primitive computer

In addition to physical objects being able to represent different information depending on the how the observer chooses to define the state space, information is substrate independent; in other words, you can store the same information in a variety of physical media and it will be identical from a mathematical standpoint. Two rocks and two socks can both convey the number "two". Let's take another example: the string "Hello" is equivalent to the binary string 01001000 01100101 01101100 01101100 01101111 in ASCII encoding, where every letter in the English letter is assigned an 8-bit binary code. A printer can convert the above binary string stored in transistors on your computer to the English string written in ink on a piece of paper. Different physical media, same information.

Let us posit, for the sake of argument, that ASCII was never invented. In other words, no one ever created a mapping between English and 8 digit-numbers. Does 01001000 01100101 01101100 01101100 01101111 still mean the same thing as "Hello"? Well, this is kind of a trick question. In information theory, entropy, the standard measure of information, doesn't answer questions of the form "does A mean the same thing as B". Instead, entropy measures the amount of information in a probability distribution, but it doesn't tell you anything about "meaning." So, for example, the average letter in English language has about 2-3 bits of entropy (after compressing via word-frequency and so forth) meaning that if you want to have a binary system that can represent any arbitrary string in English, you'd need, say, 15 bits to encode all 5 letters of hello. So entropy tells us that 01001000 01100101 01101100 01101100 01101111 could represent "Hello" with some bits to spare if we wanted it to; we would just need to create the encoding scheme that performs the appropriate mapping. But there's no (lossless) mapping from the English language to binary that could produce the word "Hello" with a single bit.

II.

Information theory can actually do a bit more for us though. There's a measure called mutual information, which does indeed tell us how much information A contains about B (and vice versa, mutual information happens to be symmetric). However, mutual information requires some additional knowledge about A and B, namely the joint probability, or the probability that in a given experiment A will have value x and B will have value y. So, for example, there is a non-zero mutual information between a person's height and weight, because height is at least somewhat predictive of weight. In this sense, mutual information is similar to correlation, but it is a stronger measure because correlation only captures linear relationships between A and B whereas mutual information tells you the maximum information you can extract from A about B using an optimal function.

If we go back to our ASCII example if we already have a computer that translates binary to English,  we can calculate the joint probability between the binary code stored in its memory and the words that it prints on its screen or on a piece of paper, and from there we can determine that the mutual information between the ASCII code and English is maximal. If we don't already have such a computer, though, then the joint probability between ASCII and English is simply not defined and the mutual information can't be calculated.

Our mutual information measure also doesn't really approach anything resembling "meaning". All we've said is that it is possible to convert from one string of symbols into another string of symbols without losing information. Because I know that my computer uses a well-defined mapping from bits to letters, I can reconstruct text from documents stored on a hard drive. That's great. But if English-speaking humans weren't around to understand the semantics of English, this would be a pointless exercise; a meaningless conversion of one string of symbols to another. The same is true, by the way, when it comes to information processing. By performing a mathematical operation on some data, I'm simply converting one string of symbols to another string of symbols by means of a function (i.e. via a Turing Machine algorithm). I could have a string of symbols a trillion trillion bits long, and I could perform a trillion trillion operations on it (if you want, I can even make the operations behave like a network, because that seems to be something that people think is important), and at the end I'd still be left with...a string of symbols. There is no Turing function of which I am aware which can take a string of symbols, perform a mathematical operation on it, and return something other than a string of symbols.

III.



If you want to get something other than a string of symbols out of another string of symbols, you have to leave the realm of mathematics and return to the world of physics, with particles that bump into each other and that sort of thing. The best example here is from molecular biology. In the classic (extremely simplified) central dogma of molecular biology, DNA is transcribed into RNA which is then translated into a protein. DNA is a system equivalent to binary except with a base-4 system (A,T,G,C) instead of binary's base-2 system or our more commonly used base-10 system. All of these systems are of course basically the same, the differences are merely representational. DNA is translated to RNA, which has the same bases as DNA except T is converted to U. The RNA strand is complementary to the DNA strand, which means that wherever G appears in the DNA strand a C appears in the RNA strand, but the two strands are informationally equivalent, because there is a simple algorithm to reconstruct the DNA string from the RNA string and vice versa. The string of As, T, Gs, and Cs, only matters, though, when the RNA is translated into amino acids, which create proteins, because proteins actually do stuff in the cell. Proteins help to catalyze chemical reactions, transfer materials within and between cells, and so on. So the DNA only has "meaning", once it's converted into a protein. And, for what it's worth, information is actually lost when RNA is translated into a protein, because multiple RNA trigrams can code for the same amino acid, meaning that you can't tell from looking at a protein exactly what RNA sequence created it.

Image result for ribosome video
RNA Translation

If I were to create a DNA strand a trillion trillion sequences long by randomly concatenating base pairs and transfecting it to your genome, it probably wouldn't do anything especially useful (actually there's a good chance it would kill you). And again, same goes for if I would process the information in that strand a trillion trillion times. The amount of information or information processing that occurs to a string of information is not highly correlated with the usefulness and/"meaning" of that information. The important step for "meaning" is the translation of the information to a physical substrate, not the symbolic representation itself. The choice of symbolic represenation is arbitrary; it just has to be long enough to compress whatever physical information you need to "read out".

IV.

So far I've been tossing around the word "meaning" without defining it, because this is where consciousness comes in. When we look at the word "Hello" written on a screen and we see it -- I mean experientially -- that cannot be information processing. Information processing can turn "Hello" into "Cello" or it can translate "Hello" into 01001000 01100101 01101100 01101100 01101111 (in the case of the brain, into the code of firing neuronal action potentials). It can associate "Hello" with other strings of information, such as an image of a waving hand - and by "associate" I mean "perform some mathematical operation whereby the symbolic representation of the waving hand and the symbolic representation of the word "hello" are combined to produce a new string of symbols. But information processing - even in network structures - cannot remove "Hello" from the world of strings of symbols to the world of conscious experience. And if it can, you have to explain how, because such a claim very much looks like a category error.

In my view, if consciousness is anything, it is unlikely to be information or to emerge from information, because we have no examples of things that are not strings of symbols emerging from strings of symbols. Consciousness (or perhaps more precisely, qualia) is a substrate which interacts with information, it is not the information itself. And what is interesting about consciousness is not the information that it reads, but rather the fact that it can read anything at all, even if the information it reads is simplistic. The brain does a lot of processing, but the purpose of this is not to create consciousness, it is simply to prepare the information for consciousness's interaction with it.



Consciousness is not necessarily a physical substrate, though I find the view of a "consciousness particle" a lot more plausible than the idea that consciousness is something that spontaneously emerges from information processing. I also believe that attempts to ground consciousness in the combination of information processing and "causal networks" of physical interactions in which that information is stored (as exists in IIT) are misguided. The best approach, in my view, is to view consciousness as a categorically independent object of inquiry and to distinguish consciousness from the information with which it interacts, the latter lending itself to network computation-related explanations.

Once we divorce consciousness from information, we are left with something very small; a consciousness that does not contain memory, personality, or anything that could be considered persistent. Persistent information is stored in the brain and may be projected to consciousness, but consciousness does not store information for more than a negligible amount of time. This version of consciousness is so small that, in the absence of information, it is indistinguishable (as far as we know) from being absent. To sharpen this point, consider the following question - is a sleeping person actually unconscious or is his brain simply not projecting any information to the conscious substrate? If consciousness is synonymous with information and the processing thereof, the question is meaningless. But if consciousness is a substrate of information; consciousness can be present in the absence of information, just like a computer can be on in the absence of data held in memory. You might not see anything on the screen, but it's still there, awaiting informational input.

Wednesday, October 10, 2018

Netivot Olam: Torah as Teleology

In the last post, we discussed the view of the Maharal of the Torah as a teleological text;  the Torah contains instructions for how the universe and man ought to be. Maharal is careful to distinguish between chochma, or knowledge, and Torah,  which literally means "instruction." The Torah says how things should be; it provides order. It is not necessarily a description of how things are.

To the Maharal, this is not simply an abstract philosophical claim. He believes that there are practical, real-world implications for the Torah being an organizing force in the universe. To this end, he cites the Talmud (Eruvin 54a) which states that if a man walks alone on a road (i.e. between cities, where it is uninhabited) and he is not accompanied by anyone, he should study Torah. Moreover, if a person has pain in his head, throat, internal organs, bones, or even his whole body, he should study Torah, as the Torah will heal him. Rabbi Yehuda the son of Rabbi Chiya adds to this that God is not like man, because when man gives a medical treatment, the treatment might be helpful in one way and harmful in another (i.e. medicine has side effects) but God's treatment, the Torah, is equally good for everything; it heals a person completely.

Maharal first focuses on the statement about walking alone on a road. Rabbinic tradition has it that "all roads are assumed to be dangerous" (Kohelet Rabba, 3:3). On Maharal's view, this isn't just because of the presence of highwaymen and dangerous animals and whatnot. Rather, there is a metaphysical sense in which uninhabited parts of the Earth are incomplete, or not fulfilling their teleological duty. [An aside: one of the interpretations of the story of the Tower of Babel is that the sin of the creators of the Tower of Babel was that they wanted to build a city to unify all of mankind in a single place, instead of spreading out over the entire world and inhabiting it.] The source text for this is Isaiah 45:18, "he did not create [the world] to be empty, but formed it to be inhabited."  Parts of creation that are not in their teleologically optimal state, such as uninhabited roads, have a sort of inherent danger associated with them. A person thus either needs to travel with someone else (when multiple people travel together, they form a social entity, and are thus considered as turning an uninhabited place into an "inhabited" one) or to study Torah, which itself has the power to bring the world to its optimal state.

Image result for road less traveled
Fig 1. Here there be dragons.

The same reasoning applies, says the Maharal, to diseases of the body. The teleological state of the body is a healthy body, and bringing the Torah in contact with a sick body brings the body back to its optimal state. This is easier to understand with pain of the head, which is the seat of the intellect and thus would more naturally attuned to the Torah's healing powers, but it is true for the rest of the body also. In this context, Maharal mentions two kinds of intellect, the analytic intellect (שכל עיון) which resides in the head and the linguistic intellect (שכל דיבור) which is associated with the throat.

Regarding the difference between Godly medicine (the Torah) and man-made medicine, Maharal notes that all man-made medicine has some sort of physical properties, and those physical properties will necessarily be harmful for some things even if they are helpful for others. He gives the example of a "hot" medicine being good for limbs which are "hot" but bad which are for limbs which are supposed to be cold. The Maharal is working with outdated medical science and terminology here, but one can easily think of many examples of drugs with side effects due to the drug's adverse reactions with non-targeted organ systems. The Torah, in the sense of it being an organizing force that brings matter to its teleological state, doesn't have any of the downsides of physical drugs because it is not a physical substance, rather it simply reorients matter to its teleologically optimal state. (Evidence that this occurs and an explanation of the mechanism by which this occurs are conveniently not mentioned.)

Interestingly, Maharal emphasizes that the Torah has the same healing powers for psychological ailments as it does for physical ailments. The particular psychological issues that the Maharal mentions are "jealousy" and "desire", which are associated with the heart and liver, respectively. In other words, all of the body parts that the Talmud mentioned also have some association with a psychological ailment. While this may seem far-fetched, there is growing evidence that the enteric nervous system and the microbiome play an important role in psychological health, so at least in the case of the digestive system, there is an element of truth in the mind-body connection. In any event, it is worthwhile to note that the Maharal considered psychological ailments sufficiently important for them to warrant medical attention in an age where clinical psychology and psychiatry did not exist as medical disciplines.