03 May, 2010

2009 Xizihao "Jingmai"

My day-job is in the area of getting computers to learn.  This could mean classifying human hospital patients as being "at risk" or "healthy" using histories of their vital signs, or perhaps classifying jet engines as being "OK" or "in danger of exploding" using data from engine-mounted sensors, or perhaps classifying masses in mammograms as being either "cancerous" or "not cancerous" using x-ray images.  The field is called "machine learning" - we gave up the name "artificial intelligence" about 15 years ago, as we're not really trying to construct intelligence, but systems that can classify and predict based on data.

The general idea is that you make observations using sensors, and then use those observations to classify the item you've sensed, or to predict its future behaviour based on its history.  Some people like to use their powers for the forces of darkness (financial prediction), while I choose to use mine for the forces of good (medicine). 

Fear is the path to the dark side. 
Fear leads to anger. 
Anger leads to hate. 
Hate leads to suffering.

2009 Xizihao Daxueshan
Yes, it's more Xizihao from Houde.  Some things never change!

Suppose we were to construct a system that could classify pu'er, based on some "sensory data": flavours, scents, textures, etc.  Some progress has been made with sensors that can approximate tastebuds, but the human nose is proving more difficult.  There is an example of this type of machine in the wine world, where a researcher trained an "artificial sommelier" to classify wine types based on chemical data obtained from a prototype of such a sensor.  Given data, we can use statistical methods to classify new examples - that is, we can classify.

What we, as tea drinkers, are up to behind all the drinking, is a similar classification task.  We acquire data by drinking lots of tea, and each tasting becomes an example in our internal  knowledge base.  Sometimes, we have the "labels" corresponding to the data ("this was tieguanyin"), so we can begin to learn what pu'er tastes like, and what wulong tastes like.  We might acquire more data, such that we can distinguish subclasses within one of those classes: we might be able to tell shupu from shengpu, within the "pu'er" class, for example. 

One level further, we start to form finer-grain classifications.  As we acquire data, we can tell young cakes, from middle-aged cakes, from mature cakes.  Given enough data, we can begin to discern old-tree from plantation, or overcooked "drink it now" tea from clean, aggressive tea more suitable for storage.

As we accumulate more data, we can begin to discern regional differences.  Chances are that most of us are around about this stage, give or take.

2009 Xizihao Daxueshan
This Jingmai has pleasant enough leaves - Xizihao always looks good

Discerning regions is easiest when the data are clearly distinguishable.  Tea from the outer regions of Yunnan is among these, I think.  Lincang is quite easy to tell apart from, say, traditional Xishuangbanna teas.  Drink enough, obtain enough data, and the classification begins to take care of itself.

Jingmai is another example of a tea that stands out in a cluster on its own.  There's very little benefit in me attempting to list those features that I ascribe to Jingmai, as they have to be learned and assimilated personally.  However, for what it's worth, I notice a nutty, savoury character common to most cakes labelled "Jingmai" that I have come across, perhaps also containing an almost sour, citrus-like ending.

2009 Xizihao Daxueshan
Some honest leaves if ever I saw them

This Jingmai from Xizihao is more of the same.  I appreciate its bright yellow colour - alongside its bold kuwei [bitter finish], it hasn't been "dumbed down".  It has a tangy, sour citrus-like ending, and tastes rather like a young version of an old tea.  Consequently, it's tempting to extrapolate and imagine how this might turn out in five years.

I found some roughness in this tea, which started out with the almost ragged citric finish, and became a cheek-abrading (yet somehow very nice) brew near the end.  It lasted well, nonetheless.

At half the price (this was $100 / 400g from Houde), this may have begun to tempt me.  As it is, my hard-earned currency is destined to be spent elsewhere, I suspect.

Give us a few years, and we'll have a decent nose-and-throat sensor sorted out...


Ruqyo Highsong said...

I don't think that kind of thing should be left to machines. The human nose is more sensitive, and different people identify aromas differently. What if the machine identified the aroma as one thing, but then a human identified it as something else?

Thus begins accusations of 'poor technology', etc. and so on. And then the supporters of the machine might criticize the human's ability to identify tea aromas, and...

Personally, I'd rather get descriptions from a man like yourself than any 'sophisticated' device. They mean so much more coming from a person. I truly hope no one ever builds a tea sensor.


Hobbes said...

If there is one thing that I have learned, it is that the grandiose claims of A.I. from twenty years ago are just that - grandiose claims. Machines are not going to be taking over from doctors, nurses, engine experts, and surgeons any time soon.

However, humans cannot be everywhere. You cannot have every patient's vital signs watched 100% of the time by a nurse in a hospital. You cannot have the engine designer watching vibration traces from every Eurofighter engine currently in service. You cannot have human analysts tracking every transaction of stocks and shares throughout the world's exchanges. Perhaps more controversially, you cannot have human eavesdroppers processing every e-mail and telephone call transacted through your "terrorist-proof" public communication networks (irony intended).

Machines are very good at performing automated analysis of extremely large quantities of data in real-time. They are also largely deterministic - they don't get better at their jobs on Monday / Tuesday, and worse at their jobs on Friday (as do humans), nor do they vary very much between machines (unlike humans). They are, currently, reliable work-horses suited for crunching data.

There is also one other important thing that machines can do that humans cannot: they can reason in very large numbers of dimensions at once. Given a dataset (perhaps 100 vital signs, for example, or 100 engine parameters), humans typically pick one or two variables to consider in pairs. At best, they look for simple trends or obvious spatial relationships. If you're faced with 100 signals at once, there is very little else you can do - this is typically the case for most doctors, for example, making that call in the ICU about whether or not to perform an emergency procedure.

Machines are much more capable, in a way: they can find statistical relationships between 100s of variables at once. In the jargon, they can reason in high-dimensional data spaces. Humans like to look at either 2-D plots or 1-D time-series, whereas machines can learn relationships in 100-D. This means that machines can spot some statistically-interesting facets in data that humans cannot. They can find patterns that humans cannot.

What does this mean for tea? Maybe, in the far-flung distant future, the artificial nose will be inexpensive, such that Dayi could, for example, use it to create the ultra-stable blends that customers demand each year. Currently, tasters might try a little of a batch in order to determine how to change the processing - machines can perform constant analysis such that your stable ol' 7542 recipe is produced more consistently from blend to blend.

A taster travelling in Yunnan might use a small, mobile "sniffer" to get a flavour profile of every single tea he encounters at a tea market, use it to select the "top twenty" according to some criteria he has set ("most like Lao Banzhang", "most sweet and floral", "most bitter and aggressive with longest huigan") and then try the top twenty himself in more detail.

That's the story at the moment - machines are there for support. Humans are the ultimate arbiters (for now), and we don't aim to replace the expertise of humans - just allow human experts to focus their attention on cases of interest to them (acutely sick patients in need of review, volatile stocks, a dangerous jet engine, etc.)



Evan Meagher said...

Next up: applying Bayes' theorem to detect knockoff pu'er.

oskar said...

You may find some inspiration in the following paper: David Wishart "The flavour of whisky" Significance Vol.6 Issue 1 Pages 20-26. march 2009.
Significance is the "popular scinence" journal of the Royal Statistical Society.
He gives some ideas on the classification of whisky using factor anlysis.
Greetings from a swedish puerdrinking statistician.

Hobbes said...

Dear Evan and Oskar,

As a card-carrying Bayesian, I would definitely take a Bayesian inference any day, in preference to the dirty Maximum Likelihood frequentists!

I've also come across Young's "Clustering Scotch Whiskies using Non-Negative Matrix Factorization", which is more of the same. Automatic whisky classification is an old game, requiring human-labelled inputs! I'm after a robot sniffer...



Anonymous said...

A long time lurker here. Hi!

I would be interested in your findings in the aroma from the cool-downed spent tea leaves after the tea has thinned out. What do you make of it?


flo said...

making such a machine would mean we have understood all about perception, and that is a big issue.

as for limits of machine for processing tasting : when you taste something, you not only go to stored and known references, you do not merely appeal to memory, your perception opens new doors and projects as to read and acquire new "data"/"shapes". it is able to perfectly identify a gustative/olfactive object even though this object is unknown, unpresent and un-named yet (in other words "data" in the process of perception is here AND not here at he same time, and is constantly evolutive once caught in the web). so an alive being does something more/different than "storing".

Just because our perception is structured for this, it does not exist otherwise than as a dynamic "app" and as it works it enriches this capacity of building its web (and not just storing data & processing them).
when you perceive, it seems to me that this part of the brain which works "back" as memory also works "forward" as builder. this is not a predictive capacity, this is a part of us that is able to work on inventio. this inventio is not prediction.

huh, not sure this is very clear, just personal limited view on "what is perception".

machines are but metaphors of nature in a sense. Very poetic. I also like and find interesting this extreme ambition of creating a "second world" that humans have, God Syndrom, very tragic (Sophocle would have loved it).

yet I would have fun with a dedicated 3D tasting heuristic/mindmapping generator on my computer! ;)

Hobbes said...

Dear Flo,

Thanks for the thoughts.

I think we are very close to being able to make a classifier of the kind that I described - indeed, they already exist, just not trained using tea-based data.

The machines we build currently are not based on perception - we are not aiming to recreate human perception, simply because it cannot be defined. This the difference between modern "machine learning" and "good old-fashioned A.I.", where the latter did aim to create a perceptive, reasoning artificial intelligence. As I mentioned, we restrict ourselves to classifiers these days, which is something that can (and has) produced successful implementations in many fields - medicine, industry, finance, etc.

I think we are a long way away from the "singularity" of science fiction! (Something for which we should perhaps be thankful. Advances in CPU complexity will change this.)



Hobbes said...

Dear Anonymous,

The scent of the used leaves can be indicative of their quality, just as can their scent before use (in a different way). It should be no surprise that the content of the leaf be represented in both its flavour and scent, given the close relationship (and overlap) between the two. Plantation leaves can certainly smell "rough and brown" afterwards, for example.



Anonymous said...

I guess I was not clear. I meant the aroma from the JingMai spent tea leaves in this particular tasting. What does it tell you? Anything stands out usually?


Anonymous said...

Sorry, got called off to put our daughter to sleep. The last message was sent in a hurry. (I am sure you would understand it literally soon enough. :))

I meant: Anything stands out un-usually?


Hobbes said...

Dear Anonymous,

I have no recollection of these particular wet leaves, to be honest - I think I was in a hurry to get to work :)

Best wishes,


Nicolaus Mote said...

delurking for a sec, as I'm also a machine-learner-by-dayjob, tea-drinker-by-offtime

This is fun idea but I'm skeptical.

* Depending on what categories you're classifying into... your variable space is so huge, you're going to need a LOT of labeled data if you don't want overfitting. Of course, depending on the tea you're gathering data on, this might be a good thing; I'm happy to help, for Science.

* I'm afraid there are too many variables in the prep of puerh (water type, leaf/water ratio, steep time, steep temperature, drinking temperature) that it'll make the logistics of data gathering a headache. Whisky clustering is a straightforward walk in the park, by comparison.

* Some categories will be much easier to classify into than others. sheng vs shu? probably easy. huigan? a bit harder. cha qi? hmm...

Anonymous said...

Hey Hobbes, turn your dial over to Yunnan Sourcing and check out those new Hai Lang Haos.

A humpin' Yiwu tea king from 2010 for one freakin' hundred effin seventy omg five no way dollars!

Man, and I was ranting about the dang Jimgmai from Sanhetang. It's really good, and I think it belongs in the same quality shelf as the other XZH despite the plantation heritage and bad green tea taste (a successful aging would probably make this truly elite), but the opportunity costs are simply crushing. I sampled from that 2006 NH banzhang brick, and 600gms of that easily outweighs the Jingmai (and I really wish I could buy the cake!) Sleeper quality pick is definitly the semi-cooked jinggu. That sucker is definitly not mispriced to the negative, and this is going to be weighed against whatever Nada brings for the last cake I'll buy.

But back to HLH...W...T....F???!!??!

Only a couple of months ago, some near elite LBZs were still available! That 2006 XZH Yiwu, while you might have to be super carefull in prying out leaves and doing fetishes and curses to get your full 10+ good brews, is still pretty dang good, and was $110 before it sold out. Oh my lord, you can buy a decent 1999 CGT Yiwu for $20 effin' bucks more!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! and eleventy one.

my mind is blown.

That is all.


Hobbes said...

Dear Nicolaus,

A reply from a machine learner! Remarkable, and very welcome.

You refer to the high dimensionality of the problem being of concern, to which I would raise two observations:

(i) One could easily imagine extracting 10-20 features based on the chemical data received by an "electronic nose" sensor. Indeed, this is already performed by the automatic somellier that I mentioned previously.

(ii) Even if one did not choose to perform appropriate feature extraction on the data, machine learning in high-dimensional spaces is a popular problem. There are, for example, many techniques for analysing 1024-element power spectra obtained from transducers. While one would imagine that the "curse of dimensionality" would cause this to be problematic, there are many successful approaches to this. It is quite a popular problem in, for example, equipment condition monitoring, in which one wishes to perform analysis on spectral data without performing feature extraction (or only performing very limited feature extraction).

Concerning the preparatory variables, I imagine that most of us have almost standardised our own approaches. There are many examples (such as caffeine-in-tea studies) in which parameters are held constant such that biochemical content can be determined.

Concerning the classification of huigan, etc. - these are merely labels applied by humans to distinct biochemical effects. One could imagine a non-zero correlation between the chemical compounds that taste "bitter" and the presence of a solid huigan, for example. This is an example of unsupervised learning, in which one might wish to learn approximations of such human-oriented terms from clusterings of a large number of observations.

All food for thought. Similar systems exist in several other application areas, and so I would consider it to be within the realm of the possible to produce such a system - certainly, the objections do not seem insurmountable, at least.



Hobbes said...

Dear Shah,

$175 is quite a price! Not one that I will be paying, I suspect...



Xizihao Taiwan said...

Hi, we 're Xizihao from Taiwan. It's very delighted to brows your blog relating to tea and the comments about our tea by accident. It's amazing! Knowing your approving our quality of tea is a big encouragement for us. Thank you so much. One of our member will go to Leister for further study for about one year. Hopely, there might be a chance that we can talk about tea if you'd like.

Hobbes said...

Welcome! Do let me know if you'd like to come to visit Oxford during your travels - it's just an hour away from Leicester. My e-mail address is hobbesoxon@gmail.com.

Best wishes,