Live data from Hacker News

How can one manage thousands of IF…THEN…ELSE rules?

programmers.stackexchange.com

71–80 of 86 posts

Re: How can one manage thousands of IF…THEN…ELSE rules?

#72
post #61

Earlier quoted context omitted.

Ooh, espresso. There was also a tool called eqntott for converting boolean logic expressions in a human-readable form into the truth tables that Espresso takes as input. The source code was written in an archaic dialect of C, but here's a resurrected version that should compile on modern compilers: http://code.google.com/p/eqntott/ I haven't touched this code since 2008, so beware of grues, but I remember it being a…

"This program was originally written at Berkeley in the early 80s" This phrase gives me the same feeling I'd get from finding an old Thomas Bangalter track or something.

Trivia - some core parts of espresso are/were part of specmarks, which are used to evaluate computer designs and implementations.

Re: How can one manage thousands of IF…THEN…ELSE rules?

#73
post #42

Earlier quoted context omitted.

If you had samples of cow behavior such as videos, you could then simulate behavior at each step and optimize for a genetic algorithm that produces similar behaviors. In this case it's probably not the right solution, but it's not that hard to swap out different learning algorithms when things don't seem to jell.

Maybe, but classification and optimization are two different problems. There's no function for the poster to optimize here.

[deleted]

Re: How can one manage thousands of IF…THEN…ELSE rules?

#74
post #42

Earlier quoted context omitted.

If you had samples of cow behavior such as videos, you could then simulate behavior at each step and optimize for a genetic algorithm that produces similar behaviors. In this case it's probably not the right solution, but it's not that hard to swap out different learning algorithms when things don't seem to jell.

Maybe, but classification and optimization are two different problems. There's no function for the poster to optimize here.

I have already explained in the post above why optimization is very a much a part of machine learning. Now, you say that that classification and optimization are two different things and that is true. But really, it can be more fruitful to look at supervised learning as a special case of unsupervised learning [1]. It is best to seek the most general framework from which to understand things as it leads to a deeper understanding, broader applicability of concepts and easier cross fertilization across fields.

For example, understanding the spectral theorem makes SVD (hence PCA) and the DFT class of algorithms much clearer. Understand the notion of Lp-Norms, convexity, adjoints, loss functions and regularization and a whole bunch of seemingly different algorithms collapse into facets of the same thing. Hook it up to automatic differentiation then some optimization algorithms and you can write anything from Neural networks, SVMs, regularized logistic regression to Non negative tensor factorization in a few lines. You stop making arbitrary divisions between classification or optimization. Much the same kind of collapse can be done for the dual [2] notion of probabilistic algorithms by thinking in terms of graphs, simplices, parametrizations, families and conjugacy.

The best thing from all this is you stop thinking of which algorithm should I use and start thinking of what do I want to do? What is the best mathematical model for this? What would really be great would be a machine learning language. Where one could work with things akin to folds and maps on various structures and manifolds and disappear the incidental complexity. Stuff like [3] is really encouraging for that direction.

[1] The problem of learning a distribution usually is called unsupervised learning, but in this case, supervised learning formally is a special case of unsupervised learning; if we admit that all the functional relations or associations that we are trying to learn have any element of noise or stochasticity, then this connection between supervised and unsupervised problems is quite general.

http://www.princeton.edu/~wbialek/our_papers/bnt_01a.pdf

[2] http://golem.ph.utexas.edu/category/2007/01/duality_between_...

[3] http://www.ipam.ucla.edu/publications/gss2012/gss2012_10605....

Re: How can one manage thousands of IF…THEN…ELSE rules?

#75
post #74

Earlier quoted context omitted.

Maybe, but classification and optimization are two different problems. There's no function for the poster to optimize here.

I have already explained in the post above why optimization is very a much a part of machine learning. Now, you say that that classification and optimization are two different things and that is true. But really, it can be more fruitful to look at supervised learning as a special case of unsupervised learning [1]. It is best to seek the most general framework from which to understand things as it leads to a deeper un…

I agree with everything you said. I never said optimization isn't a part of ML, it was very much a part of my ML masters, in fact. I was just saying that, in this case, the OP doesn't have an explicit function to optimize, hence why he didn't need optimization...

Re: How can one manage thousands of IF…THEN…ELSE rules?

#76
post #70

I suggested using Prolog in the comments. His problem description was not quite good enough for me to assess whether or not Prolog will be a good choice, but at least it's a candidate. A Prolog program is essentially a list of rules that are written as an implication. Something like: moves_to(Cow, Location) :- hungry(Cow), current_location(Cow, OldLoc), food_in(OldLoc, OldFood), food_in(Location, Food), Food > OldFoo…

And we're waiting for a link.

Re: How can one manage thousands of IF…THEN…ELSE rules?

#77
post #74

Earlier quoted context omitted.

I have already explained in the post above why optimization is very a much a part of machine learning. Now, you say that that classification and optimization are two different things and that is true. But really, it can be more fruitful to look at supervised learning as a special case of unsupervised learning [1]. It is best to seek the most general framework from which to understand things as it leads to a deeper un…

I agree with everything you said. I never said optimization isn't a part of ML, it was very much a part of my ML masters, in fact. I was just saying that, in this case, the OP doesn't have an explicit function to optimize, hence why he didn't need optimization...

Oh cool =) I don't really think in terms of classification and optimization anymore and don't really see much distinction between minimizing a loss or objective function. But I did rant on because I am really passionate about how much unnecessary complexity (hehe) is in much of machine learning. And am always eager to talk about promising unifying approaches. If you haven't read up on semirings or computational algebraic geometry you should. For an MLer learning more math is like learning math for a programmer, it is a lot of upfront work but it makes a lot of seemingly arbitrary list of rules much more cohesive and simpler when you've achieved what is basically a conceptual compression.

Re: How can one manage thousands of IF…THEN…ELSE rules?

#78
post #57

Earlier quoted context omitted.

How do video games solve it? Do you have any material one can read to learn more about this?

Often through physics engines. You express a bunch of constraints then let a physics engine solve them on each time step (and sometimes across multiple time steps). Custom (non-physics) solutions involve declarative sets of constraints being solved by some sort of engine; such solutions often start to resemble physics engines even if the physical rules even if the constraints are not exactly physical. Learning how to…

Using a physics engine to express an AI problem? That's an interesting solution, but that's certainly the first time I've heard of one being used like this?

Re: How can one manage thousands of IF…THEN…ELSE rules?

#79
post #57
post #26

Is it just me? It's not a good question, it shows lack of core coding experience. For example a video game consists of millions of possibilities/results in movement based on environment - it's not approached as a collection of thousands of if/then/else statements. In fact the movement of cows seems very much like video game coding, it needs a "cow engine".

How do video games solve it? Do you have any material one can read to learn more about this?

If I was given the task to integrate cow herds in a computer game, my first instinct would be BOIDS/flocking, adding in weights for wind velocity and sun. It's fast and lends itself to predictable behaviour which is beneficial to the player.

It may not necessarily be realistic but then most players won't be familiar with cow movements.

Re: How can one manage thousands of IF…THEN…ELSE rules?

#80
post #77

Earlier quoted context omitted.

I agree with everything you said. I never said optimization isn't a part of ML, it was very much a part of my ML masters, in fact. I was just saying that, in this case, the OP doesn't have an explicit function to optimize, hence why he didn't need optimization...

Oh cool =) I don't really think in terms of classification and optimization anymore and don't really see much distinction between minimizing a loss or objective function. But I did rant on because I am really passionate about how much unnecessary complexity (hehe) is in much of machine learning. And am always eager to talk about promising unifying approaches. If you haven't read up on semirings or computational algeb…

Oh man, I can't stand math :/ It's one of my weaknesses when it comes to ML, I really have to struggle with the formalism...
Post reply on HN