Machine Learning at the APS March Meeting

aps_2018_lineThis year, the March Meeting of the American Physical Society was in Los Angeles.    There were far more machine learning sessions than in the past.  In fact, one had such interest, that due to the fire code, there was a 30 minute line to get into the room!   So, what’s the status of things?There were a number of talks which were essentially using AI to automate tasks.  For example,  looking at microscopy images and automating detection of grains.  Basically doing tasks that we would now give to an undergrad, graduate student (or poor postdoc :-p).  There were also some talks on better sampling methods--can I learn the same amount of information from fewer samples?  Use less beamtime, less material?  I would classify these as essentially a modern take on DOE (Design of Experiments).  There was another track that was more theory focused.   They asked the question—“Can I look at say a collection of force fields or functionals and get a more "efficient" version?”  For example, if I run a number of DFT calculations, can I train a neural net (NN) on those results and then use the NN to do calculations faster?  The answer seems to be…maybe with lower accuracy, but good enough for screening?  There were also some variations of the inverse problem--if I'm a theorist, can I simulate a few models, train the NN on those and then feed it real data and see if it classifies things as fitting theory 1 or theory 2?  There were also some talks that looked at explorations of a model space---given this model, can I find that there is a vortex state?  There were some geared more at using AI to predict materials with properties.  In some cases, it was clear overfitting.   But, in others, maybe some promise...

One key takeaway is that for the most part, we are not dealing with big data.  As one speaker pointed out, we don’t have enough data to let our machine learning algorithms learn representations—we need to construct them based upon the rich models that we have developed to describe the world.    There were a number of good talks on choosing representations for crystal structures.  

In the hallway, I stumbled into a conversation where a theorist was complaining that he was disappointed.   That we do physics to understand something about how the world works—with the implication that machine learning was not helping there.  I would say that it’s still early days.

Posted by william in data science, machine learning, 0 comments

Machine Learning

I have become interested in the intersection of machine learning with science.  Two of my students will explore this intersection over the summer.    One of our project involves classification, the other involves reinforcement learning.   I’m excited!

Posted by william, 0 comments

Where Good Ideas Come From

I recently read Steven Johnson’s “Where Good Ideas Come From”.   It had some good ideas, even if the biological analogies were a stretch.   The basic ideas are summed up at the end:

  • Go for walks
  • Get some sleep (it wasn’t mentioned in this book, but probably splitting up your night’s sleep would be good)
  • Make Mistakes
  • Have Hobbies
  • Talk to strangers
  • Mix ideas together
  • Take good notes
  • Live in or near a city
Posted by william in books, research, 0 comments

The role of government

I recently read, “The Entrepreneurial State” by Mariana Mazzucato.   It was interesting to read in light of Peter Thiel’s “Zero to One” and Steven Johnson’s “Where Good Ideas Come From”.   Mazzucato’s central theme is that contrary to the idea that government is an impediment to economic development, the US government has actually spurred a lot of the most innovative sectors in the economy.   Beyond simple support of basic research, government has spurred development.   Unfortunately, at times, I think that she is her own worst enemy and at times draws rather tenuous connections between government investment and marketplace results.

To my mind, the government has done and continues to do an excellent job at funding basic research.  In the past, there was more support from industrial research labs such as AT&T Bell Labs, but that was during an era where monopoly profits allowed them to have the funds to do so.  In the US, prizes have also proved stimulating (ex. the X-prize).  DARPA has also been rather successful in funding risky targeted research.  Mazzucato correctly points out that SBIR grants have served to support companies in the development of technology that government needs that later has commercial application (ex. Apple).   But, it’s a stretch to suggest that Apple would not have existed without such investment.   However, she does raise a good suggestion—rather than just paying cash for SBIRs, the government would do well as a long term “venture capitalist” if it actually took on a small stock holding in companies where if they really took off, the funds could be used and reinvested in other research areas.  

Peter Thiel brings up the idea in Zero to One and in his book and talks that Clean tech and thin film solar panels in particular were a disaster for venture capital funds that poured in as a result of funds available from the DOE.   I think the problem here is time horizons—venture capitalists really only have maybe a 10 year time horizon to return a profit for their investors.  There has just been too much uncertainty in this market for them to really win (   At this point, in the lab, single crystal silicon seems to have approached theoretical efficiency limits (   The difficulty at this point is more engineering and finance—namely, making it economical for people to buy panels at those efficiency levels.   At that point, it might be feasible to start thinking more about distributed power.  However, there is a rather disheartening  article in IEEE about what it would really take to reverse climate change, but that’s another topic (…However, here Mazzucato is correct about the need for “patient” capital that can wait for more than 10 years to reap the benefits of investment.  Here, government is not just generally stimulating basic research, but is instead trying to achieve a given goal and allowing companies and labs to try different ways of realizing the goal of developing cleaner sources of energy.

Another point that Thiel brings up is that he believes that the pace of innovation is slowing.   One of his prime examples is the pharmaceutical industry.   Peter Thiel believes that it’s a result of government regulation.   I disagree.  Here, I think the conventional view is actually correct.  We really have eaten a lot of the low lying fruit.   Johnson raises the idea of the “adjacent possible”—a space of ideas that are accessible to a given person at a given time in history.   At this time, we’re waiting for the adjacent possible to sweep the next major wave of innovations.   We’ve discovered that cancer for example, is much more complex than we originally thought.  Rather than just being a simple disease with a simple cure (for example one drug that treats all cancers), it’s more likely that tailored solutions will be necessary.  Who knows, perhaps treatments will have to become on going and adapt to individual patients with time.   We’ve laid a lot of ground with projects such as the Human Genome Project, but it may take some time before it starts to bear major fruit because the problems at this stage are hard.   It’s also important for the government to continue to fund “risky” research where failure is possible.

Besides government directly investing in research, government can try to facilitate the transfer of knowledge from the university to industry (for example, with the Bayh-Dole act.  Or to encourage corporations to work together on hard problems like with Sematech.   It can also try to encourage environments where “random” encounters are likely to result in innovation—for example encouraging technological incubators  in large cities.   

Posted by william in books, research, 0 comments

I went to a pretty exciting meet up last night at George Washington University.  It was by put on my Statistical Programming DC and was my first meet up with them.  The speaker was Matt Sundquist, who is one of the founders of, which is sort of the github of plotting.   The talk was pretty good and I was impressed by the package.  It’s free and they have bindings to Julia, Python, Excel, Matlab, Igor, R, etc.   You can view graphs, edit legends, etc. from within the browser and send them directly from your python scripts, which is really cool!   You can also stream real time data over.  One really nice feature is that you can see the data used to generate a plot and the code (in multiple languages) that will generate it.  This would be really cool to see in journals!   It ties in nicely with the recent posting by Nature about hosted iPython consoles.

Given the variety of graphs, I can understand why they went with d3.js—we went with jqplot for a number of our online plotting solutions because I thought the learning curve would be shallower for our high school/college interns.   Also, I think we started back in the days of Flot, before d3 was out there.    I somehow thought that d3.js was only SVG, but one of my coworkers told me that it now supports canvas as well, so it could be fast—but apparently producing pdf files from canvas is painful...

I hope their company survives and I can definitely see using it for sharing plots with my collaborators.   Because of our use of interactors, I doubt that I will be able to replace a number of existing projects though due to our need for custom interactors.   Hopefully they develop a plugin system in the future!

Posted by william, 0 comments


I went for a jog today and thought back to an insight that I had in graduate school.   During my phD, I studied frustrated magnetism.   In frustrated magnets, you consider a material where the atoms are arranged in triangular motifs.  If these atoms have unpaired spins on them and only nearest neighbor antiferromagnetic interactions, then the interactions will be unable to be simultaneously satisfied and the material will never order, despite having strong interactions.   However, in practice, I found that Nature is tricky and that a number of these materials would order.  In some cases, thermal or quantum fluctuations would result in ordering.  In other cases, order in the system could be stabilized by a structural phase transition which would favor some interactions over others.   However, one thing that gradually became clear was that there were interesting phases near such frustrated magnets and the interesting question is how a small perturbation might result in interesting physics.


I think this could be a general strategy for searching for switchable phenomena.  Find a phase which is subject to an instability through some type of perturbation.  For example, pressure, electric field, etc.   If you can move the system towards the instability using one control parameter you’re half way there.  The next challenge is whether you can use another perturbation to move it back across the boundary using another control parameter.   If so, then you have a chance to build something interesting...

Posted by william, 0 comments

Edge of Tomorrow

So,  I recently watched the movie, “The Edge of Tomorrow”.   It was excellent!  If you haven’t seen it, go watch it now.  Come back afterwards because there are SPOILERS ahead.


Ok, now that you’ve watched the movie, what did you think?  The obvious comparison is to to the movie, "Groundhog Day”, where the main character starts out as a self centered, jaded jerk, but gradually learns to appreciate other people. However, I think an interesting way to think about this movie is in terms of what makes a hero and what is courage.

Major William Cage seems to fit into the mold of the trickster hero. He starts out as a smooth operator who things that he will be able to talk his way out of anything—including an assignment to cover a major battle against the aliens—from the front lines. He learns that it is not possible and is knocked out and finds himself busted down to a new recruit thrown into battle with no training. He quickly dies, but is bathed in alien blood which somehow confers on him the ability to relive the same day over and over. During this episode, he meets the legendary warrior, Rita Vrataski, though it takes some time before he even learns her name.

In the beginning, he is clearly not a warrior. Master Sergeant Farrell tells him,

"You’re a coward and a liar putting your life above theirs. The good news is there’s hope for you, private. Hope in the form of glorious combat. Battle is the great redeemer. The fire and crucible in which the only true heroes are forged. The one place where all men truly share the same rank, regardless of what kind of parasitic scum their were going in. … I envy you, Cage. Tomorrow morning you will be baptized — born again.”

Initially, we take the Sergeant’s words as empty, but gradually, Cage begins to train himself as a warrior and after meeting up with Vrataski, he is trained by her. Dying time after time, he gradually learns to be a warrior. After he gains more proficiency, he at Vrataski set out to try to reach what they believe to be the location of the “Omega” which is the alien which apparently controls all of the others. If the Omega is destroyed, then the invasion will fail. However, I would argue that it isn’t until he stops fighting one time and escapes to London and watches it being invaded by the aliens that he finds something worth fighting for and truly starts walking along the path of the hero. There’s also a point where he hits a wall and in a very touching farm scene reveals that his mentor and friend Vrataski can’t make it any farther. That no matter what he tries, she dies (I would argue that she is a true hero where she puts the lives of others ahead of hers—even though she can’t get close to other people after watching someone she loves die over and over and over again, unable to save them…). Finally, he makes the conclusion that he has to proceed on his own (these two characters show an interesting variation of the American Lone Hero archetype) and discovers the whole mission was a trap.

Later, he finds that he needs to recover a device from the general in order to discover the true plans of the Omega. He succeeds, but loses his ability to loop through time and becomes mortal again. I would argue that this is when he truly becomes a hero. He gathers a team and they decide that they will try to destroy the alien Omega, even though it’s likely to be a one way mission. After their companions heroically sell their lives to help the others advance, Cage and Vrataski enter the alien stronghold. Finally, one of them has to face an “Alpha”, while the other detonates the Omega. Cage feels protective towards Vrataski, and offers to attack the Alpha, but she tells him that neither of them will survive…He realizes this and still proceeds.

Let’s stop here. At this point, Cage believes that he can kill the alien Omega and save humanity, but he will have to die to do it. So will Vrataski, who he has feelings for. Beyond that, he will never be recognized for his bravery. People may never know that it was his mission that led to the alien defeat—likely, he will simply be remembered as a coward and a deserter. Yet, despite this, he does the right thing and sacrifices himself and wins, destroying the Omega.

Afterwards, there are scenes showing that humanity is saved. I think this would have been a great place to stop. He became a hero—he faced his fears, found a cause worth dying for and protected humanity. It reminds me in some ways of Gladiator—a movie with the courage to allow the main character to succeed, but also to die. “Ghost Dog” was another excellent film in which the main character succeeds, but also dies. Instead, I think the movie decides to go with the typical hollywood feel good ending by resurrecting Cage one more time, but this time still in his role as a major, rather than in disgrace (which means that he is leapt back further in time than before—huh?) and to show him meeting Vrataski with the implication that he believes he has a chance to rekindle the possibility of a relationship with her in this version of the timeline that he wasn’t able to realize before.

I think it would have been far more powerful to have him die a forgotten hero, along with the rest of his team. It would have been tragic, but made the point that sometimes, success may mean that you don’t get a happy ending for yourself. That even if there is no personal reward, you still do the right thing—with your only reward being the knowledge that you succeeded and did the right thing—even if no one else will ever know about it.

Posted by william in movies, 0 comments

Some thoughts on Home Ownership

A friend is thinking about buying a house in Maryland, so I decided to think about how the cost of ownership compares to renting.  There was a Washington Post article that I believe looked at this comparison between renting and owning for a townhouse in Arlington and concluded that they were basically the same.  Unfortunately, from what I recall, they neglected taxes, maintenance, etc.

Suppose you bought a new $300,000 townhouse in Maryland.   Let’s think about how much it may cost you (I use the calculators from


Maintenance expenses:

These are usually estimated to be anywhere from 1-4% of the homes value per year.  So, let’s go with 1.5%.   That’s $4000/yr. 

Property tax:

State: 0.1%  $300

Montgomery County 1%  $3000

Waste disposal, Waste connection, etc: $500

Home Owner’s Insurance:  $650


Let’s imagine that you put 20% down and you opt for a 30 year mortgage.   At 4.5%, that would correspond to about $1215/month, so that’s $14,580/year.

Let’s pause for a moment a tally what we have so far:

$23030/yr, or about $1920/month.


Now, usually people attempt to add in the fact that you can deduct the interest/property taxes on your income taxes.  Let’s see how much that saves you. The median income in Montgomery county is ~ $92,000/yr, so let’s round to $100000/yr to make the numbers easier.  Let’s further imagine that you are putting in enough payments to your 401K that you fall in the 25% tax bracket (Montgomery county would seem to charge 3.2% and the state 4.75%, so let’s assume that state tax is 8%).   Then you get to deduct ~$4100 the first year.  So at the end of the day, that puts you at about $18930/yr, or about $1580/month that you’re paying to own.  


So far, I have not included closing costs.  These are estimated at 2-5% of the home’s cost.   So, let’s assume you pay 3%, that’s $9000.  I checked with Bank of America website and the they estimate $11000, so let’s go with $10000.   I’m not sure what the best way is to add this to the calculation.   But, let’s say that you’re normal and hold on to the place for 7 years (it’s a bit complicated to predict this:   So, you have to figure in the cost to sell your house after this of ~6% of the homes value.  Let’s neglect inflation (the value that I think a house should rise at in a sane market) $18,000,  So let’s add this to the closing costs and divide by 7 years to see what you paid per month.   This corresponds to about $333/month!!!   So, This put’s you back up to $1913/month to own.  Finally, throw in $100/month for Home Owner’s association fees and you’re at ~$2000/month to own.

Now, let’s look at rental prices.  If you want to rent a townhouse in the same county, you’re probably paying a comparable rate—perhaps even slightly more.   

So, the long and short of it is that unless I’m missing something terribly obvious, at the end of the day, it would seem that renting and buying are about the same in Md.   So, what are the pros and cons of one over the other?

Some people might argue that homes appreciate in value with time.  This doesn’t seem sane to me.   Over time, it seems like it should index to inflation.   A more detailed  analysis can be found on, but the basic idea is that if appreciation is greater than inflation, eventually nobody can buy a house.   This is in the best case scenario where salaries are indexed to inflation and even that doesn’t necessarily hold true...  

The other reason that a number of people give to suggest that home ownership is better than renting is the idea that you build equity in your house as you pay your mortgage, but with renting, you gain nothing.   However, this argument is a bit simple minded.   Your mortgage is front loaded, so initially, more of your payments go towards interest than towards the principal.   Also, that $70,000 (20% + closing costs) that you paid initially could have been invested instead.   Depending on your assumptions on the rate of returns, this could beat your accumulation of equity in your house (assume that you just get a boring index fund with low fees).

The downside of owning a home is that you simply aren’t flexible if you have to move for work.  Also, if you find yourself with a lowered income, it’s a fixed expense—a number of states, like Maryland, are “Recourse states", where if you are foreclosed upon, you’re still liable for the difference between the loan amount that you took out and what your lender was able to sell the house for.   Another danger of owning a home is the equity risk.  On the one hand, you could win the lottery and sell your home during a time where appreciation has favorably decoupled from inflation.  However, you could also have to sell during a housing bust when the value of the home is far less than what you initially paid for it (even without accounting for inflation), in which case, even if you’ve put equity into the home, if you sell it, you’ll lose money on the sale.  For example, suppose your home’s value drops to $250K.   You will have lost $50K when you sell, even if you’ve put equity in (of course, there are risks to investing as well).    The other risk  to home ownership comes from the fact that a number of states and municipalities have used creative accounting to balance their budgets.   However, at some point, to pay for expenses that they are obligated to (for example pensions) and to continue to provide services, they will have to increase their tax rates.  I would imagine that property taxes will have to go up as well.   


After thinking about this, I found:


Which depending on assumptions, might be a a bit more optimistic about owning.  For them, using similar numbers would suggest that the cross over point is at around $1600/month.   This depends on your assumptions about the rate of returns on the down payment/closing costs money that you could have invested instead of using it to build equity in your home (along with assumptions on inflation/appreciation, rent increases, etc.).


So, the TL; DR is that the question of owning vs renting depends on your assumptions about the relative rates of return on investments and guesses about how appreciation and rent index to inflation.   It also depends on how long you are likely to be in the home and your tolerance to risk.   There are of course intangibles such as whether you want someone else to deal with maintenance or if you want more freedom to decorate.  For the scenario I described, it would seem to be owning by a nose, but it does carry the risks that I mentioned earlier.   So, on pure financial grounds, this doesn’t seem like it’s an obvious risk-adjusted choice to buy instead of renting.  


*This is for informational purposes only.  It is not investment advice and you should consult a professional if you want such advice.  I am also not a lawyer.  All opinions expressed are my own and not my employer’s.


Posted by william in finance

Some light martial arts fiction

On a friend’s recommendation, I just read, the CUHK Series: Fox Valant of the Snowy Mountain by Jin Yang. It starts with some interesting introductions and commentary by the translator (there was also an implication that these were written because the author needed cash...). I’m not sure if this is his only work that’s translated into English, or if this is the only one available on the Kindle. The first thing I noticed was the style of the language. While I’m sadly monolingual, I do have a reasonable command of the one language that I know--however, I found myself glad to read it on the Kindle, where I could look up definitions of words that have fallen out of common usage (or perhaps reflect a more British dialect of the language). I wonder if this was intentional on the translator’s part? Was the Chinese version colloquial, or does it also use an older tone of language. But after awhile, I became accustomed to it and began to enjoy it.

The other thing that I found was that there are a number of movies and novels which I’ve seen and read that owe a silent homage to this author. If you ever get a chance, Sean Russell’s “Brother Initiate” series has a very similar feeling to it. This particular story also has a familiar feeling with recent movies in which we’re told a story from different perspectives and gradually learn more about reality by viewing it from different angles. Here, it’s interesting that the characters we meet first turn out to be villains and it’s only as we meet other characters that we release that some of their opponents are actually the heros…Psychologically, it’s interesting because by introducing them first, we are initially biased in their favor.

One interesting question raised in the story is about the value and danger of pride. At times in my life, my pride has been useful and helped me to push forward despite opposition. But on other occasions, it has got me in trouble. Have you ever had the feeling of meeting the sky above the sky? To feel that you’re at the top of the game and then to meet someone stronger?

In the book, much is made of scrolls. In fact, one of the characters becomes a much stronger martial artist from reading a fragment of a scroll with the secret teachings of a school. But, is this plausible? I remember when I trained, I would read a number of books with pictures and they were useful, but not compared to videos. And even videos were not enough to capture the feelings behind a number of techniques. I think that a scroll could serve to mark ideas, but you’d really need to have a teacher to truly understand...

All in all, it was a good read. The only regret that I had was the open ending...

Posted by william in books, 0 comments


I just finished reading Uncontrolled by Jim Manzi.  He starts the book spending a surprising amount of time in the early chapters of the book trying to give the reader a crash course in the philosophy of science.   The TL; DR is that I’m rather lucky to be a physicist.   The longer answer is that in the hard sciences such as physics and chemistry, we often have basic models of how the world work which we constantly test against new observations.   If we’re lucky, we find that our models don’t describe something in nature and that there is new science to discover.   But, at a deep level, we have a few articles of faith.   For example, we believe that the laws of physics don’t change from place to place.  We also believe that the laws of nature don’t change with time (even if our understanding of them does).   Other fields such as medicine are not so lucky.   We still have a very rudimentary understanding of the human body.  We don’t have strong enough models to say whether a given compound should cure a given disease.   There are also many confounding factors.   So, randomized trials are necessary to see whether the effects observed are intrinsic or accidental.   Even if a randomized trial indicates that an effect is present, it can be difficult to generalize it to a different context or population.   Sociology and economics are even more difficult.   The author brings up a number of cases in economics where authors have overreached and made predictions that really should have been tested in randomized experiments—otherwise, they are far too overreaching with too little support from data.

After this introduction, Manzi delves into perhaps the strongest section of the book where he outlines how he used randomized experiments in business to determine strategy.   When doing this, he looked into the literature of random trials in medicine, as well as random trials in social sciences (for example, leading up to welfare reform in the 90s, the federal government required a number of random trials for states which wanted to try different strategies.).  

There is another section of political trials, which reminded me of Rick Perry and His Eggheads and the better Get Out the Vote, which deal with experimental tests in politics of what strategies work and which don’t in get out the vote efforts.   


Perhaps the weakest section of the book is where the author attempts to make policy suggestions.   But overall, I would recommend reading this book.  If nothing else, it is helpful in increasing skepticism of predictions which lack experimental support.

Posted by william, 0 comments