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.