News for hackers. Stuff that matters.
Re:TDD from the Factorio Team by astrange on Friday June 18, 2021 @10:32AM (#27550741)
Well, that's how machine learning works.
Re:TDD from the Factorio Team by mikewarot on Friday June 18, 2021 @11:22AM (#27551305)
Machine learning requires a problem that you can have partially correct, so that it can climb the gradient to optimize on. If you can build tests that have an analog instead of pass/fail output, you could, in theory, do it with machine learning.

Beware that machine learning in a single pass/fail is more like having an infinite number of monkeys trying to write the works of Isaac Asimov.

[Edit/Update] All of the tests could be individual values, so non-zero (but nowhere near all ones) might help. Thanks for making me reconsider this, sdenton4.

Re:TDD from the Factorio Team by sdenton4 on Friday June 18, 2021 @12:02PM (#27551762)
Not all ml is gradient based. Other options exist: Bayesian black box optimization (like vizier), or genetic algos. And Vizier is actually quite efficient for small problems.
Re:TDD from the Factorio Team by peheje on Friday June 18, 2021 @05:19PM (#27555162)
With genetic algorithms you still need to be able to calculate a fitness. Usually a test is fail/success. There's no fitness in that. I would guess the other optimizers also need such a signal?
Re:TDD from the Factorio Team by sdenton4 on Friday June 18, 2021 @06:10PM (#27555545)
Success/failure is just a binary classification signal: you can look at how it correlates with your target variables, how noisy it is for particular choices of variables over multiple trials, etc. The noisier it is, the harder it is to learn, but such is life.
Re:TDD from the Factorio Team by peheje on Friday June 18, 2021 @06:29PM (#27555693)
I think it would be impractical for a naive fitness function that is 0 for failure and 1 for success. Wouldn't the signal be too difficult to find? GA would be brute force until you find code that passed a test. I don't think tests for factorio are trivial.

Maybe you could move the goal/fitness function along the way. So start with something that compiles. Then having the desired input output. Etc.

Re:TDD from the Factorio Team by peheje on Friday June 18, 2021 @06:45PM (#27555842)
Addendum. More tests. I see. Would you then lead the algorithm along a trajectory. If you can pass this simple test you would probably be able to pass this as well then this... Babysitting it along the way. Ideally you wouldn't need to, but maybe to make it possible..
Re:TDD from the Factorio Team by sdenton4 on Monday June 21, 2021 @03:12PM (#27582935)
Check out Thompson Sampling and multi-armed bandit problems for how this can work out in real life. (I tend to think this approach is much better than genetic algorithms...)

Each 'bandit' is a random boolean outcome, governed by some hidden success probability. Thompson Sampling trades of exploration and exploitation. If there's no successes ever, then all bandits are equally bad, and you just keep exploring randomly until you find some success (or give up). If you do have some success, you can try to exploit it.

For a problem with continuous parameters, you can discretize the parameter space by binning, and then choose randomly within a bin for each trial. 'Exploiting' a particular bin might lead to breaking it into more bins for finer resolution.

Re:TDD from the Factorio Team by astrange on Friday June 18, 2021 @12:52PM (#27552338)
I was actually thinking about decision trees.