Introducing a Theory of Anything

Really, here's a downloadable genetic machine learning system I built that looks at a dataset and generates dogma - rules of thumb - convetional wisdom - theoms and hypothesis both tragically obvious and sublimely subtle.

I long time ago I came across a passage by Richard Dawkins and James A. Freeman that demonstrated how one might play the word game Hangman with a genetic algorithm1.  I was fascinated.  It occurred to me, as perhaps was the intent, that equations and code were really just strings of characters.  Solving Hangman or cracking passwords from statistic observables seemed like one of the very least interesting things one could do with such an algorithm. 

So I played a bit and made a script "Nonsensebox" that took data and assigned fitness values based on the statistical fit of model vs data.  Is the data best modeled by a line, a parabola, a fractal, a logical sequence - with adaptation the script would find the best model it could given rather humble code.  

If you had a problem that was a bit beyond the grasp of a human comprehension, as long as you could somehow keep the discovery process pointing in the right direction with a good fitness function, then in principle, this algorithm could find a solution.  For example:  handwriting letter lengths and angles could be compared to coritsol stress hormone levels to build a logistic model that could be applied broadly.   With enough data, lots and lots of robust data, a difficult to discount math and logic solution to nearly anything might emerge.   That wouldn't make the associations true however, just very strong.  

Nonsensebox is far from perfect - coincidence and correlation without cause happen - the theories this thing cranked out are really more like scientifically unvetted dogma.  It can test the wrong types of questions - handwriting for example makes heavy use of just a few parts of the body - the situational 'need for speed' might well be infinitely more important than hormone levels even if it tells you hormone levels can be calculated indirectly from the fatness of P's and height of Q's.

And the code seemed to do many of the things life and evolution itself does - the system seemed to get better the closer I made it to the way real biology works.  I added in old age, roughly followed the rules of sexual reproduction.  Also present genes for data selection, data modifier genes and a gene for model operations.   Nonsensebox was replaced by better scripts called "Plausible" and "Dogma."   I think they offer deep insights into the mathematical underpinnings of evolution - what evolution can and can't accomplish, how biological evolution plays as a numbers game, and it illuminates certain mysteries- for example survival of the fittests isn't about the fittest individual - its almost always about the fittest species or population.  Humans: remarkable luck, you all play on the same team. 

I wrote the code and kept myself privately entertained with small discoveries that I could never quite tell were cooincidence or compelling.  I appoligize for my greed and governance by the second law of thermodynics.  I want to share in an idea that is bigger me.

Ah, yes.  This is ego-ware.  I'm offereing the code for free, but would like a published reference to in exchange.

Click here to download the Mathematica stockmarket relationship program I call "Plausible"

Its still a script style program, manual edits and shift-enter to run code sections are required.  What it does in the demo isn't a great example of what it can do... I think it could make the world a little bit better in the right hands.  Cheers,  Dustan Doud


1.  A reference to "The Blind Watchmaker" 1987 by R. Dawkins found in "Simulating Neural Networks with Mathematica" by J. A. Freeman 1994.  




Hospital Infection Prevention 

Near certain proof that US Hospital infection prevention protocols are not, lets say, uniformly excellent- have arrived this week from Texas.  One nurse, who wished to remain nameless per her HIPPA rights, came down with Ebola this week.   The media has publish names far and wide.  Never mind that patient confidentiality violation, she may be able to sue to reclaim damages should she survive and it all amounts to a side show anyway.  

The CDC reassured American's that effective protocols were used, but that this one nurse must of had a accidental breech of protocol, say when she was undressing.  It was as if the CDC willingly damaged this nurse's reputation.  Way to lead CDC!  One slipshod nurse, sure, I could buy that.  But now with two nurses from Dallas diagnosed, with one feverish and flying on a commercial flight from Dallas to Ohio before testing positive for Ebola?    

Um.  Wow.  That's unbelievable!  I'm going to call that it a pattern.

Never mind that whole Ebola thing: sure Ebola is frightening, but a baysian (historical) analysis sugests that one should be far more afraid of death by common hospital aquired infections.   Things like Flu after open heart surgery, RSV, Pneumonia, MERSA; combined they kill tens of thousands that would of otherwise have recovered.  In 2013 about 440,000 in the US got sicker from a visit to a hospital.  Complications are just so "normal" that 202 extra US hospital deaths every day just seems to excape most peoples notice (source Mercola). 

Gone are the days when the extra billing from complications were quietly seen as a hospital's financial friend.  Today, Medicare and Insurers won't pay! Those infections cost healthcare institutions close to $10 billion per year according to US News and world reports.  But one can argue the cost to the 73,730 dead patients was higher.

So here's the one statistic that's incredibly telling about Dallas Presbyterian Hospital: one Ebola patient in and at least two Ebola patients out.  Clearly, this hospital's infection prevention department has failed in its mission!  It's unfortunate that we need something like Ebola to illustrate the point.  

Perhaps some lasting good will come of the Ebola scare if medical institutions and practicioners finally take preventable hospital aquired infections much more seriously.  I'm going to go out on a limb and say that over the next decade, Ebola won't kill 700,000 americans, but preventable Hospital aquired infections probably will.


Apple and Phone Security

FBI director James Comey is very concerned about Apple's new stance on decryption.  Kidnappers and child porn were dragged out as reasons we should all hate encryption.  I think it should be consider high praise for Apples product.  

Look - If Apple makes it easy for the FBI, they make it easy for every governmental agency, every criminal enterprise and every Rupert Murdoch is-our-moral-compass company in world.  I don't really like that.  The notion that if you aren't guilty you have nothing to hide doesn't ring true in a data theft everywhere world.  I'd like to keep my passwords, credit cards, email, online identities, photos and data safe.

I like that my own photo journals have a complex truth not seen in the web or only-celebrate-success-facebook.  Few images I own I intend for public consumption, I'm kinda a out of the lime light private guy.  The ones I hang on the web are my life - but with way better lighting and image composition than any normal person can expect day to day.  The logo-girl is my T, one day after we collided skiing and my ski cut her wrist to the bone... my greatest failure.  Accidents happen and she's 99% better.  It's hung on the web to remind me to be the best father I can, but someone else might see evidence of child abuse. 

My wife has taken pictures of me sleep-deprived napping shirtless chest to chest with a toddler in a rocking chair- not remotely sexual or pornographic in my mind.  All the same I suspect the image would get some people deeply hot and bothered or invoke the recall of painful personal victimizations.

My point is that the divergent context is troubling legally, especially when mounting an effective legal defense against errant charges can bankrupt the majority of otherwise innocent Americans.  Should we really want every media outlet, crime enterprise and law enforcement agency on the planet looking for indecency in every photo we've every taken?  

I hope the answer is no.  Portraits after a death, intimate family moments, emergency room visits, happy couples long since divorced - I don't think I live in a world where they should be public. But I'd kind of like to carry some of them on a phone, even if I think the technology isn't quite there yet.


A Bit Less Blur in Google Street View

I came across a child on Google Street View while touring the pyramids of Giza.  Something about him captivated me, and I decided to pull out mathematica's ImageDeconvolve feature to get a better look.

Theoretically one should be able to reverse the facial privacy blur if the algorithm emulates optics and you know the algorithm. But I did not know and had to resort to a bit of random guess work and "best of" choices in nested tables.  

The code is below- it will likely work widely against google street view blur.  It gave me a better look at his face too.  This child looks like Orion G, a small friend of mine that has visited the pyramids.  But it's not him.  This particular kid could something in his mouth or perhaps cleft-palet, I can't quite tell.  More likely, my image sharpening algorithm is haufen mist.  Either way it made me feel crappy, although clearly the kid had a job to do in a public area.  Focus on the facial details.


matrix = 6.28 (GaussianMatrix[15]^3.5*ShenCastanMatrix[15]^3.5)^(1/
     3.5); psf = 1/40 Rescale[{matrix, matrix, matrix}]; z = 
 Table[ImageDeconvolve[img, psf, Method -> {"DampedLS", loop}], {loop,
    0.1, 1, 0.05}]; z

matrix = 6.28 (GaussianMatrix[15]^3.5*ShenCastanMatrix[15]^3.5)^(1/     3.5); psf = 1/40 Rescale[{matrix, matrix, matrix}]; z =  Table[ImageDeconvolve[img, psf, Method -> {"DampedLS", loop}], {loop,    0.1, 1, 0.05}]; 

Gave me a bit of a look at him in the table of z images.  Well, just his face.  Everything else went wobbly. 

z = Table[ ImageDeconvolve[img, psf, 

   Method -> {"DampedLS", loop}], {loop, {2^-2.5, 2^-3.5, 2^-4, 

    2^-4.5, 2^-5}}];

zz = ImageMultiply[#, 0.2] & /@ z; y =  ImageAdd[zz]

Worked somewhat too.

Control, control, I must have a control.   Since I didn't know what the kid really looked like I used Google Street View to go to Times Square in New York and look at broadway billboards with faces that had google blur.  I can report that mathematica's ImageDeconvole exclusively up to the task. 

Mama Mia poster with matrimonial bliss IN --> Blured to protect the poster's privacy --> unblur methods similar to above --> Mama Mia poster output  that takes the expression of bliss and widens it to encompase agony. 





Stupid Party Tricks

My brother R threw a great party this last weekend.  Yep, I'm adverse to precise dates - deal.  Oddly enough he asked me to participate with stupid fire tricks I've learned from that interweb thing.   Nobody died (resounding success!)  

Your results may vary.

Keep a running hose handy.

Big human firework:

Bend coat hanger straight or use galvinized fencing wire.  Manually expand 3 pads of fine steel wool so that they are about 3x longer than tall.  Thread coat hanger through center of expanded spiral pad.  Bend end of coat hanger to hold wool 2' away.  Bend other end into 8" short handle.  Practice spinning it overhead in a 4-5 foot diameter loop with the steel wool outside and refine design as needed before you light.  If the intended victim spinner can't spin fast enough they will burn and may die a horrible death, if they spin too fast bystanders will burn and may die a horrible death.  Some control and heavy fresh dew are key.   Ignite center and spin by hand fast enough that welding sparks fall outward in 20-30' diameter without landing on the spinner or burning bystanders with 2500F sparks.  Anyone willing to risk third degree burns by spinning the firework will be the center of attention at a party for thirty seconds or so - unless they catch fire and then the attention may last a bit longer.  Even if everyone survives unscathed, expect a slightly blemished lawn.


This is all about playing with fire.    Mix 2 small containers of Joy dishsoap with 1 container of water.  Add 2 tsp methocellulose for extra viscosity.  Have participants strip naked or wet clothes so as not to ignite (highly recommended for comedic effect but optional.)   Bubble propane gas through soap mix and collect EGG SIZED foam fluff.    Ignite by candle with a FULLY OUTSTRECHED ARM with the foam egg at tips of fingers and fingers slightly open.   Respect the fire, after all fire is fire, even if ballenced with water so as not to cause discomfort.  It is fun to play with fire in your fingertips, but all the same someone always trys a softball+ sized wad of foam or holds it close the their face and has to explain why they have sunburn, a unusual hair cut, no eyelashes and one arm that looks like was treated with Nair.  


Start with a 8" square of coarse COTTON or T-shirt Cotton.  Crumble into a ball and hand stich to it stays a TIGHT FIRM little ball.  Partially saturate with butane and juggle or hot potato with a friend.  The butane release is slow, and the flames are above the ball.  As long as you hold the ball momentarily and hold it from underside rather than top side, your chances of a first degree burn or worse aren't even 100%  These little guys are dangerous - easy to make, easy to play with, fun, and so seemingly safe as a candle that "OMG - serious mistakes were made!" is a certainty.  Take my advice, quit before it all goes up in flames.