Computational Mindfulness
Author
Philip Maymin, Stella Maymin
Title
Computational Mindfulness
Description
A computational essay version of this published article: https://doi.org/10.22158/sssr.v2n3p88
Category
Academic Articles & Supplements
Keywords
URL
http://www.notebookarchive.org/2021-08-eaw1tw4/
DOI
https://notebookarchive.org/2021-08-eaw1tw4
Date Added
2021-08-31
Date Last Modified
2021-08-31
File Size
2.32 megabytes
Supplements
Rights
Redistribution rights reserved
Download
Open in Wolfram Cloud
This notebook is a computational essay version of the published article: https://doi.org/10.22158/sssr.v2n3p88.
Computational Mindfulness
Computational Mindfulness
Philip Z. Maymin and Stella P. Maymin
We take a computational approach to investigating highly abstract concepts including mindfulness, brain waves, and quantum mechanics. Using Langerian non-meditative mindfulness, defined as the active process of noticing new things, we find that when tested on the authors as subjects in two different ways, induced mindfulness is consistently distinguishable from induced mindlessness, and results in a calmer time series of brain waves as measured on an electroencephalogram. Additional results include a statistical Granger causality analysis of scholarly mindfulness research showing that Langerian mindfulness research causes future mindfulness research but not vice versa, and preliminary results from another study showing substantial differences in responses among subjects induced to view their own faces either mindfully or mindlessly.
Mindfulness
Mindfulness
Langerian Mindfulness
Langerian Mindfulness
“Mindfulness is the very simple process of actively noticing new things.” - Ellen Langer, the mother of mindfulness
Langerian mindfulness requires no meditation or training, and can be achieved instantly by virtually anyone, yet the benefits are enormous, including reductions in chronic pain, depression, anxiety, addiction, and stress, and improvements in immune system response, working memory, inter-personal relationships, vision, longevity, youthfulness, and well-being.
Here we seek to induce Langerian mindfulness using a vision task and exposure to quantum fluctuations and evaluate the resulting brainwaves as measured by an electroencephalograph (EEG) machine.
History of Langerian Mindfulness Research
History of Langerian Mindfulness Research
We can query Google Scholar for a search term and a date range to track scholarly research output over time.
String templates are much easier than manual concatenation:
In[]:=
GoogleScholarURL[year_,topic_:"mindfulness"]:=StringTemplate["https://scholar.google.com/scholar?q=`2`&hl=en&as_sdt=0%2C7&as_ylo=`1`&as_yhi=`1`"][year,topic]
An example URL for mindfulness research in the year 2021:
In[]:=
GoogleScholarURL@2020
Out[]=
https://scholar.google.com/scholar?q=mindfulness&hl=en&as_sdt=0%2C7&as_ylo=2020&as_yhi=2020
Unfortunately, regular Import does not work:
In[]:=
First@StringSplit[Import@GoogleScholarURL@2020,"\n\n"]
Out[]=
Loading...The system can't perform the operation now. Try again later.
Start a web session to allow full Javascript functionality in Google Scholar:
In[]:=
session=StartWebSession[];
Fetch the results for each year (be careful to prove you're not a robot if requested) for both Langerian and overall mindfulness research:
{langerian,mindfulness}=Table[AssociationMap[First[Quiet@StringCases[Last@WebExecute[session,{"OpenPage"GoogleScholarURL[#,StringRiffle[{"mindfulness",t}]],"PageSource"}],"About "~~count:Except[" "]..~~" results"Interpreter["Integer"]@count],0]&,Range[1970,2020]],{t,{"langer",""}}];//AbsoluteTiming
Out[]=
{51.8331,Null}
Close the web session:
In[]:=
DeleteObject@session
Mindfulness has grown exponentially over time and has now become a household word. There are even mindful hamburgers and mindful pizzas.
In[]:=
WebImageSearch["primo thin the mindful pizza",1]
Out[]=
The plot of both Langerian mindfulness research and overall mindfulness research reveals a common trend. Note however that despite initial appearances, these plots are not of cumulative research, but annual research. The cumulative chart would of course be even steeper.
Plot both lists of article counts on a single chart with multiple axes:
In[]:=
ResourceFunction["MultipleAxesListPlot"][List@@@Normal[#]&/@{langerian,mindfulness},JoinedTrue,PlotRangeAll,PlotStyle{Darker@Blue,Darker[Orange,.2]},FrameTicksStyle{{Directive[16,Darker[Blue]],16},{16,Darker[Orange,.2]}},Filling{2Axis,1Axis},PlotMarkers{Automatic,Small},ImageSize450,PlotLegendsPlaced[Style[#,16]&/@{"Langerian","Mindfulness"},Scaled@{.2,.75}]]
Out[]=
How do we know which one causes the ? We can perform a Granger causality test in both directions.
other
Type ">" to insert an R-cell then install and load the package we need:
In[]:=
install.packages("lmtest")
In[]:=
library("lmtest")
Out[]=
{lmtest,zoo,stats,graphics,grDevices,utils,datasets,methods,base}
Transfer our variables to the R environment:
In[]:=
RSet["langerian",Values@langerian];RSet["mindfulness",Values@mindfulness];
Perform a Granger causality test to see if Langerian research causes all mindfulness research.
In[]:=
grangertest(langerian, mindfulness)[["Pr(>F)"]][2]
Out[]=
{0.0000756098}
The highly significant p-value of less than 0.01% means that we can definitively reject the null hypothesis of no causality in favor of the alternative hypothesis that Langerian mindfulness research causes all mindfulness research.
As a check against mutual causality, we can perform the reverse Granger causality test as well.
In[]:=
grangertest(mindfulness, langerian)[["Pr(>F)"]][2]
Out[]=
{0.918179}
The reverse test is highly non-significant. Hence, we can conclude that Langerian mindfulness research causes all future mindfulness research.
Inducing Mindfulness
Inducing Mindfulness
Facial Differences
Facial Differences
If mindfulness involves noticing new things, how can we induce such a state in participants? One possibility is to directly instruct them to notice three new things and specify what they noticed. In ongoing research, Kiruluta, Maymin, Dhawan, Johnson, and Langer (2021) asked 500 people to either notice three new things about their own face or to simply use three words to describe their face. All participants did both tasks, in random order.
Import the list of responses for each condition:
In[]:=
Get
StringJoin[ ] |
Extract a random example from each group:
In[]:=
RandomChoice/@textgroups
Out[]=
mindlesspale, fuzzy, scruffy,mindfulMy hair receeding, how tired I look and how much older I look
The mindful responses were twice the length of the mindless ones, on average.
Compute the average string length of responses in each condition:
In[]:=
N@*Mean/@Map[StringLength,textgroups,{2}]
Out[]=
mindless20.7613,mindful39.2724
Display a word cloud for each condition, without stopwords:
In[]:=
StringRiffle/*DeleteStopwords/*WordCloud/@textgroups
Out[]=
mindless
,mindful
Split each group of words into a training and a test set:
In[]:=
traintest=ResourceFunction["TrainTestSplit"]/@Map[StringTrim,textgroups,{-1}];
Train a classifier on the training set:
In[]:=
c=Classify[traintest〚All,1〛,PerformanceGoal"Quality"]
Out[]=
ClassifierFunction
|
Test the trained classifier on the test set:
In[]:=
cm=ClassifierMeasurements[c,traintest〚All,2〛]
Out[]=
Classifier Measurements | ||||||||||||||||||
|
The Markov classifier was able to achieve approximately a 78% accuracy in predicting whether a response was likely from the mindful or the mindless condition, relative to a baseline accuracy of 50%.
The examples largely distinguish based on string length.
In[]:=
cm["BestPredictedExamples"]
Out[]=
{My eyes are slightly lopsided, I think I also have a lopsided mouth, and I have a couple of wrinkles on my forehead!mindful,My left eye is smaller than my left, I have an irregular hairline and my eyebrows are not symmetricalmindful,One of my eyebrows is higher than the other, I look bloated, I have a blemish on my cheekmindful,That one eye is lower than the other, that my hair is looking greyer (which I like) that maybe I need a new foundation shade.mindful,My glasses are falling off and need to be readjusted for my face, I've never really noticed how large my forehead is and I really should shave soonmindful,head tilted to one side. one eyebrow raised slightly. left eye looks more closedmindful,clearer skin, quite shiny (but in a good way), double chin is getting smaller!mindful,I am looking down, my glasses are reflecting, the picture has slipped down so I am not in framemindful,the light from the window is in my glasses, my hair is wet, my neck has linesmindful,the birthday balloons have fallen behind me, my hair is a mess, my eyes are unevenmindful}
In[]:=
cm["WorstPredictedExamples"]
Out[]=
{colourless, hate being in my 60s, what's the dark shape behind sofa?mindless,am in a messmindless,Tired, serious, unhappymindful,not quite suremindless,tired,sleepy,sickmindful,screen dark, blurry, still boringmindful,good, nice, greatmindful,tired, morning, lookmindful,blotchy, tired, wrinklymindful,Squidgy tired and double chinned!mindless}
However, the model appears to do even better than a naive classification based only on string length.
Plot a histogram of mindless and mindful text lengths:
In[]:=
Histogram[Values@Map[StringLength,textgroups,{-1}]]
Out[]=
In[]:=
PairedHistogram@@Values@Map[StringLength,textgroups,{-1}]
Out[]=
Almost all texts longer than 40 are mindful.
Compute how many of each condition are longer than 40 characters:
In[]:=
Length@Select[#,#>40&]&/@Map[StringLength,textgroups,{-1}]
Out[]=
mindless14,mindful199
In[]:=
Total[Length/@textgroups]-Total[%]
Out[]=
808
If we naively classify text responses longer than 40 characters as mindful, then we will achieve an accuracy of 199/213 = 93.4% on those, and fifty-fifty on the remaining 808, for a net accuracy of 59%, still almost twenty percentage points lower than the machine learning model.
In[]:=
(199+404)/(213+808.)
Out[]=
0.590597
Spot the Difference
Spot the Difference
If mindfulness is the simple act of noticing new things, can we induce mindfulness with a spot-the-difference challenge?
Display a spot-the-difference challenge:
In[]:=
RowShowImport
<>ToString@#<>".png",ImageSize300&/@{1,2},Spacer[10]
Out[]=
As you look across these two images trying to spot the difference, you may not even realize that you are becoming more mindful.
Mindfulness need not be difficult, time-consuming, expensive, or obvious. In a series of studies on hotel chambermaids, Crum and Langer (2007) found that, first of all, none of them considered their daily jobs to be a form of exercise at all, and, second, when half of them were shown how their work was indeed a form of exercise and what muscle groups each activity targeted, that group experienced a decrease in weight, waist-to-hip ratio, and body-mass index over the subsequent month compared to the control group, despite the fact that neither group changed their diet or gym attendance. It was simply the change in mindset that resulted in such amazing improvements.
Similarly, as you notice changes in the images, you begin to realize that there are things you do not know. This causes you to pay attention and be mindful. This approach was later used as part of the process of inducing mindfulness to reduce behavioral biases in Maymin and Langer (2021).
Quantum Randomness
Quantum Randomness
Quantum "Newness"
Quantum "Newness"
Mindfulness results from noticing "new" things. The results of quantum measurements are in a sense entirely physically "new" in a way that pseudo-random measurements are not. Ongoing research by Maymin (2021) in this area tests the hypothesis with subjects online. For this study, only the authors of the present work were used as subjects.
Pseudorandomness
Pseudorandomness
We generate pseudorandomness using the Rule 30 cellular automaton. Randomness will be generated in hexadecimal.
Define a function for generating pseudorandom hexadecimal numbers and display a grayscale array plot of a sample 256x512 result:
In[]:=
Rule30RandomHex[n_]:=(SeedRandom[Method"Rule30CA"];With[{v=RandomInteger[15,n]},v])BigArrayPlot[data_,width_:Automatic,height_:Automatic]:=ArrayPlot[data,PlotRangePadding0,ImagePadding0,ImageSize{Replace[width,AutomaticLength@First@data],Replace[height,AutomaticLength@data]},FrameFalse]
In[]:=
BigArrayPlot[Rule30RandomHex[{256,512}]]
Out[]=
For pseudorandomness, this is effectively equivalent to the built-in function RandomImage:
In[]:=
RandomImage[1,{512,256},ColorSpace"Grayscale"]
Out[]=
Quantum Randomness
Quantum Randomness
Generating quantum randomness requires quantum effects. The quantum random number generator at Australian National University offers a live API by implementing Symul et al. (2011) and Haw et al. (2015).
Generate quantum random hexadecimal numbers from the live ANU API:
In[]:=
ClearAll@QuantumRandomHex;QuantumRandomHex[n_Integer/;n≤10242048]:=First@QuantumRandomHex[{1,n}]QuantumRandomHex[{h_,w_}]:=QuantumRandomHex[{h,w},{Automatic,Automatic}]QuantumRandomHex[{height_,width_},{length_:Automatic,size_:Automatic},constraint_:15]/;width*height≤10242048:=Quiet[Check[Take[Partition[Flatten[IntegerDigits[FromDigits[#,16],16,2Replace[size,Automaticwidth/2]]&/@URLExecute["https://qrng.anu.edu.au/API/jsonI.php",{"length"Replace[length,Automaticheight],"type""hex16","size"Replace[size,AutomaticCeiling[width/2]]},"RawJSON",TimeConstraintconstraint]@"data"],width],height],Rule30RandomHex[{height,width}]]]
Plot an example quantum random image:
In[]:=
BigArrayPlot[QuantumRandomHex[{256,512}]]
Out[]=
EEG
EEG
An EEG (electroencephalogram) measures brain waves, the electrical activity in the brain, using small metal discs placed on the head via a headband. The device records the frequency and patterns of brain waves in different areas of your brain. We used BrainBit. For illustration, here are some example EEG patterns measured from wearing the device for a short period of time.
Semantically import and plot sample EEG data:
In[]:=
ListLinePlotTranspose@SemanticImport@First@FileNames"eeg*.txt",
,ImageSize500,AxesFalse,PlotStyleThickness[.005]
Out[]=
Hypotheses
Hypotheses
Hypothesis 1
Hypothesis 1
The EEGs for difficult spot-the-differences should be different from the EEGs for easy spot-the-differences. We will assume that the difficult ones are the “mindful” state and the easy ones are the “mindless” state.
Hypothesis 2
Hypothesis 2
Quantum random numbers will induce more mindfulness than pseudo random numbers, in the same way that the hard spot-the-differences differed from easy spot-the-differences.
Results
Results
We compare the graphs of the resulting EEG measurements for the two co-authors under the spot-the-difference and the pseudo-vs-quantum-randomness conditions. The thicker green lines represent what is intended to be the mindful condition (difficult spot-the-difference or quantum-randomness), and the thinner blue lines represent the mindless condition (easy spot-the-difference or pseudo-randomness). Both subjects were blind to the treatment they experienced, and both experienced them in a random order.
Plot the average EEG measurements across time:
In[]:=
ClearAll@avgeeg;avgeeg[who_,what_:None]:=Mean@TableMean@SemanticImport[f][Transpose],f,FileNameswho~~If[what===None,"","-"~~what]~~"-*.txt",
In[]:=
GridPrependJoin{Rotate[Style[#,Bold,16],90Degree]}&/@{"Stella","Philip"},PartitionWith{blue=avgeeg@#1,green=avgeeg@#2},ListLinePlot{blue,green},PlotLegends
,PlotStyle{Directive[Thickness[0.005`],Darker[Blue]],Directive[Thickness[0.01`],Darker[Green]]},PlotRangeAll,ImageSize260,AxesFalse&@@@
,2,2,Style[#,Bold,16]&/@
,Spacings{2,1}
Placed[ ] |
Out[]=
Spot the Difference | Random Image | |
Stella | ||
Philip |
Both Stella's and Philip's mindful EEGs were substantially calmer than their mindless EEGs, in both spot-the-difference and pseudo-vs-quantum-randomness conditions.
Conclusion
Conclusion
Mindfulness may sound like an undefinable concept like consciousness, but Langer's long-standing definition provides a clear way to operationalize it: "Mindfulness is the simple process of actively noticing new things."
Under this definition, two completely different ways of inducing mindfulness present themselves.
One is to show pairs of pictures with computationally generated differences between them, making the differences either easy to spot or difficult. In this approach, subjects search for differences, finding things that are new to them.
The other is to show grayscale plots that were generated either from pseudorandom or quantum random number generators. While both pseudo and quantum random numbers are "new" to the subjects simply by virtue of never having been seen before, quantum random numbers are by definition physically "new" information in the sense that observers of the quantum information become entangled with the generating process in a way that observers of pseudorandom information do not.
Under both approaches, the brainwaves measured under the mindful condition were substantially different than those measured under the mindless condition, for both authors. Furthermore, the mindful EEG's were always calmer than the mindless ones.
This paper offers support for a computational approach to studying arguably some of the most abstract concepts ever devised by humanity, including mindfulness, brain waves, and quantum mechanics.
Future research includes extending these experiments to a wider subject pool and presenting the pseudo vs. quantum randomness in a variety of presentations beyond grayscale plots.
References
References
◼
BrainBit.com
◼
Crum AJ, Langer EJ (2007) Mind-set matters: Exercise and the placebo effect. Psychol Sci 18(2):165-171.
◼
Kiruluta AJM, Maymin PZ, Dhawan N, Johnson H, Langer EJ (2021) Facial recognition and mindfulness. In progress.
◼
Haw JW, Assad SM, Lance AM, Ng NHY, Sharma V, Lam OK, Symul T (2015) Maximization of extractable randomness in a quantum random-number generator
Phys. Rev. Applied 3(5).
Phys. Rev. Applied 3(5).
◼
Langer EJ (1989; 2014) Mindfulness. Addison-Wesley (1989), Da Capo Lifelong Books (Anniversary Edition, 2014)
◼
Maymin SP (2019) Automated spot-the-difference. https://community.wolfram.com/groups/-/m/t/1732399
◼
Maymin SP, Maymin PZ (2019) Computational mindfulness. Presentation at Wolfram Technology Conference. https://www.wolfram.com/broadcast/video.php?v=2843
◼
Maymin PZ, Langer EJ (2021) Cognitive biases and mindfulness. Nature: Humanit Soc Sci Commun 8(40)
◼
Maymin PZ (2021) Quantum mindfulness. In progress.
◼
Symul T, Assad SM, Lam PK (2011) Real time demonstration of high bitrate quantum random number generation with coherent laser light. Appl. Phys. Lett. 98(23).
Cite this as: Philip Maymin, Stella Maymin, "Computational Mindfulness" from the Notebook Archive (2021), https://notebookarchive.org/2021-08-eaw1tw4
Download