Skip to content

Instantly share code, notes, and snippets.

View sanity's full-sized avatar

Ian Clarke sanity

View GitHub Profile
private void simplify(final GPCandidateProgram p) {
final String oldString = p.toString();
if (!p.isValid())
return;
p.setRootNode(simplify(p.getRootNode()));
final String newString = p.toString();
}
private Node simplify(Node node) {
0 .96507374279561 OR(IF(GT(ADD(SEQ_DELTA(last) ADD(lastLast lastSellPrice)) MAX(MAX(lastBuyPrice lastBuyPrice) MAX(lastBuy 0.0))) OR(GT(lastLast lastBuyPrice) OR(NOT(in) IF(in true in))) OR(GT(lastLast lastLast) GT(SEQ_MEAN(volume) SEQ_MIN(last)))) in)
1 .96486374279561 OR(OR(in GT(lastLast lastBuy)) NOT(GT(ADD(lastSell lastLast) MAX(SEQ_DELTA(sell) SEQ_MIN(volume)))))
2 .96475374279561 OR(in GT(lastLast lastBuy))
3 .96475374279561 OR(in GT(lastLast lastBuy))
4 .96475374279561 OR(in GT(lastLast lastBuy))
5 .96475374279561 OR(in GT(lastLast lastBuy))
6 .9639736248403 OR(OR(GT(PDIV(lastBuyPrice lastBuy) SEQ_DELTA(sell)) GT(SUB(lastBuyPrice lastBuy) MIN(lastLast lastBuy))) IF(GT(SUB(lastLast lastBuy) MIN(lastBuyPrice 0.0)) GT(lastSell ADD(lastBuyPrice lastLast)) in))
7 .9639536248403 OR(OR(GT(PDIV(lastBuyPrice lastBuy) SEQ_DELTA(sell)) GT(SUB(lastBuyPrice lastBuy) lastBuy)) IF(GT(SUB(lastLast lastBuy) MIN(lastBuyPrice 0.0)) GT(lastSell ADD(lastBuyPrice lastLast)) in))
8 .96393362484031 OR(OR(GT(PDIV(lastBuyPrice
IF(
GT(
SUB(lastLast lastBuy)
PDIV(
lastBuyPrice
ADD(lastBuyPrice lastBuyPrice)))
GT(lastSell lastLast)
OR(
OR(in GT(lastBuy lastBuy))
IF(
By way of quick introduction, my name is Ian Clarke, I'm a computer scientist and serial entrepreneur, and I blog at http://blog.locut.us/ (using Wordpress, of course).
For over a year now I've been thinking of ways that bloggers can more effectively generate revenue from their blogs, without annoying their readership with annoying and intrusive advertising. Based on your past writings, I know this is an area that interests you.
About 6 months ago, in discussion with some old university friends of mine, we came up with a simple, but so far as we can tell, quite novel idea. Basically, we would take a leaf out of the TV advertising world, and rather than present ads to the user while they are trying to read the content on a blog, why not present advertising to the user while they are between one blog and another one?
It works like this: A blogger signs up for our website, and installs a simple Wordpress plugin. Then, whenever someone clicks on a link on their website that goes off their site, we'll insert
Initial: 0.4982890018865529, predicted: 0.4967176316142575
Initial: 0.5019670365057287, predicted: 0.5004106229724584
Initial: 0.5000969667146445, predicted: 0.498607280973313
Initial: 0.5001652788068449, predicted: 0.5010773804234867
Initial: 0.49987396031875314, predicted: 0.4999183710604109
Initial: 0.498237783397972, predicted: 0.49904988782363935
Initial: 0.5009626562703291, predicted: 0.5030185253303403
Initial: 0.5010134545152054, predicted: 0.5007349302286274
Initial: 0.49891075143157143, predicted: 0.49936094910201756
Initial: 0.5015176044888766, predicted: 0.5011838689663578
Initial: 0.25261612268476574, predicted: 0.09270865601634412
Initial: 0.252484443792305, predicted: 0.08186073324827739
Initial: 0.25231336058963383, predicted: 0.07657362774646057
Initial: 0.2523799678733703, predicted: 0.08880811271701142
Initial: 0.2525626310258369, predicted: 0.0803499453531276
Initial: 0.25226617465349277, predicted: 0.08056630503943739
Initial: 0.25267587130984326, predicted: 0.07070471006816013
Initial: 0.2523738368237544, predicted: 0.09114640834043276
Initial: 0.25236603576123484, predicted: 0.07720644943489678
Initial: 0.2523891750999367, predicted: 0.08811821661014556
Initial: 0.747057619158212, predicted: 0.9239869216647003
Initial: 0.7472510140322802, predicted: 0.9142193772877276
Initial: 0.7477199878111889, predicted: 0.9139854231922762
Initial: 0.7477493332577575, predicted: 0.9184393761968787
Initial: 0.7473201265018791, predicted: 0.9134101561281003
Initial: 0.747541546509776, predicted: 0.9169970734051002
Initial: 0.74680412364313, predicted: 0.9141371165095892
Initial: 0.7476568027742245, predicted: 0.9092514444756934
Initial: 0.7472131427882267, predicted: 0.9139835064511798
Initial: 0.7471514888303639, predicted: 0.9058729717406588
import java.util.*;
public class RBTMain {
public static void main(final String[] args) {
final int sampleCount = 10000, testCount = 100;
for (int p = 0; p < 10; p++) {
final double[] actual = new double[sampleCount];
final Random r = new Random();
for (int x = 0; x < actual.length; x++) {
// We don't want them too close to 0 or 1

I'm trying to find as many golden tickets as I can, so that I can sell them to rich, spoilt kids that want to go on a tour of Wonka's chocolate factory.

Fortunately, I have a machine that can tell me the probability that a ticket is present within a chocolate bar without having to open it. I can use this machine on chocolate bars before I must buy them, so I can use it to select the chocolate bars most likely to have tickets.

Of course, the machine isn't accurate, so the probability it gives me will have some error, but this error will be normally distributed around the real probabilities, so it will even out across multiple chocolate bars. This means that if I tested every chocolate bar, I could determine the overall probability of finding a winning ticket by averaging the predictions produced by the machine.

So I test 10,000 chocolate bars (its Costco), and pick the 100 with the highest probabilities as predicted by the machine.

Now, to test the machine's accuracy, I average its predictions for these 10

${bold}Warning${/bold} There is a danger that if you associate your Freetalk identity with your real-life
identity that you could create legal liability. Specifically, it is possible that in some jurisdictions
you could be held liable for not giving negative trust to illegal content.
We therefore recommend that you keep your real-life identity separate from your FreeTalk identity.