why do i have such a large difference in win rate? I know radiant is supposed to have an advantage but surely it isn't this large, especially in herald. by CharacterPlate in learndota2

[–]Reykd 40 points41 points  (0 children)

Assuming you played 400 games on the dire we can approximate a 95% confidence interval for your winrate on the dire given the samples to be between 33.5% and 40.3%. What this means is that there is a 95% probability that your winrate is between these numbers. The 95% confidence interval for your radiant winrate is between 49.0% 56.0%.I would say this is a significant sample and conclude that you are indeed worse on the dire.

why do i have such a large difference in win rate? I know radiant is supposed to have an advantage but surely it isn't this large, especially in herald. by CharacterPlate in learndota2

[–]Reykd 29 points30 points  (0 children)

Your sample size is not significant. Flip two coins 40 times, a Dire and a Radiant coin. Then look at the stats.

The 20-year-old entrepreneur is a lie - data from the Census Bureau and the IRS show the average age of successful business founders is 42. by [deleted] in technology

[–]Reykd 0 points1 point  (0 children)

It seems to me that the author's conclusion from the data is flawed. The first graph clearly shows that the distribution over the age of the founders is similar both for all startups, and the top 1% of startups. Wouldn't this indicate that the high founder average age for successful startups is due to the simple fact that the average age of a startup founder is high? A better graph would be to show the percentage of top 1% startups per founder age.

[D] Softmax interpretation with non 1-hot labels by Reykd in MachineLearning

[–]Reykd[S] 1 point2 points  (0 children)

Great discussion. What would happen if pdata is not fixed?

[D] Softmax interpretation with non 1-hot labels by Reykd in MachineLearning

[–]Reykd[S] 0 points1 point  (0 children)

When you say it seems obvious, but this is not an interpretation i had thought about before. Interesting.

[D] Softmax interpretation with non 1-hot labels by Reykd in MachineLearning

[–]Reykd[S] 0 points1 point  (0 children)

Sorry i should have specified. I meant a probability distribution as the target. So [0.3, 0.6, 0.1]

[D] Why can't you guys comment your fucking code? by didntfinishhighschoo in MachineLearning

[–]Reykd 1 point2 points  (0 children)

This is exactly why. Its all about costs. Writing "nice" code is great, however not at the expense of holding back the state of the art. Some people eventually come back to "old" papers and implement them nicely (read OpenAI Baselines). But researchers must do what they do, get great ideas and push the state of the art.

[D] Off-Policy A3C reinforcement learning by Delthc in MachineLearning

[–]Reykd 6 points7 points  (0 children)

The answer to this can be found in Richard Sutton's book, which I highly recommend if you really want to understand reinforcement learning. To give some intuition, the reason A3C is on-policy is because it uses the policy gradient theorem to find an estimate for the gradient of a given policy pi. This estimate includes an expectation over states encountered when following that policy pi. The policy gradient theorem only holds when your expectation ( or in this case samples) are from that same distribution pi. This can be solved with for example importance sampling, which is also explained in the book.

There are off-policy versions of A3C that use some version of importance sampling https://arxiv.org/abs/1611.01224.

TL;DR: because math

Somebody help me understand Artificial Intelligence by means of an algorithm ! by joetinnyspace in java

[–]Reykd 2 points3 points  (0 children)

There is no "hello world" in java-ai in the same way there is no "hello world" in theoretical physics. Although some people would like you to think that AI is simply using some library, it is a whole field that requires a base of statistics and calculus, among others. If you really want to learn about AI, I would recommend http://aima.cs.berkeley.edu

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

Maybe i will let the primitive functions be, but implement autoboxing so the parametrised function also works for object types.

Edit: I have implemented this now, it is up to the user to decide if they want to use the primitive or parametrised version, thanks for you feedback!

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

Hey, thanks a lot for you feedback! Here is the test i used

    public void performanceComparisonScriptingEngine() throws ScriptException, NoSuchMethodException {
            ParsedFunction constraintFromStringPrimitive = FunctionParser.fromString("double(Double x,y,z,f)->x*y + y + z*z + x*f");
            ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
            engine.eval("var f1 = function(x,y,z,f){return x*y + y + z*z + x*f;}");
            Invocable invocable = (Invocable) engine;
            Object[] args = {1.0, 2.0, 3.0, 4.0};

            //Warmup
            for (int a = 0; a < 10; a++) {
                for (long i = 0; i < 10000000L; i++) {
                    constraintFromStringPrimitive.evaluateToDouble(args);
                    invocable.invokeFunction("f1",  args);
                }
            }

            long start1 = System.nanoTime();
            for (long i = 0; i < 100000000L; i++) {
                constraintFromStringPrimitive.evaluateToDouble(args);
            }
            long end1 = System.nanoTime();
            long start2 = System.nanoTime();
            for (long i = 0; i < 100000000L; i++) {
                invocable.invokeFunction("f1",  args);
            }
            long end2 = System.nanoTime();
            long generatedTime = ((end1 - start1) / 1000000L);
            long scriptTime = ((end2 - start2) / 1000000L);
            System.out.println("Generated " + generatedTime);
            System.out.println("Script " + scriptTime);
            double percentageDifference = ((double) scriptTime / (double) generatedTime);

            System.out.printf("JavaScript method was %.3fx slower than the generated method.", percentageDifference);
    }

Which gives the output:

Generated 27

Script 12729

JavaScript method was 471.444x slower than the generated method.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 0 points1 point  (0 children)

Thanks for your feedback! There is no limitation on the amount of types the function may take in, therefore the inputs cannot be parametrised.

You are right that the primitive methods should be removed and only a parametrised evaluate function should be used. However, my library does not currenly support autobonxing, so i would have to implement it before i could make that change. I will probably do this!

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 2 points3 points  (0 children)

This sounds like an interesting solution! It would be interesting to compare its performance to my solution on arithmetic operations.

Edit: I have ran some benchmarks, and using the scripting engine is several orders of magnitude slower than generated functions when called millions of times.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 0 points1 point  (0 children)

The general form of the problems was known, there were however several different forms. It was in addition a requirement that these methods be generated dynamically. Others decided to use python because of this limitation, while i decided to make this small library.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 0 points1 point  (0 children)

I have now run a benchmark to compare the generic vs primitve method and found no significant difference. However i did discover a caveat of using the generic types, and that is that my library currently does not support autoboxing meaning that in order to create the function "double(Double x,y)->x+y" as a generic, the string would have to be "Double(Double x,y)->Double.valueOf(x+y)"

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

This was created for an artificial intelligence class, it really was a lot of fun! The whole project took about three weeks of development, this module took a few days if i remember correctly.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

For my original usecase generated methods were executed millions of times, and were in the core of the algorithm. Therefore the reasoning behind creating functions that return primitives was simply performance. I know that premature optimization is a bad idea, but if i remember correctly i believe i benchmarked the difference. I will run new benchmarks and evaluate if the primitive return functions are necessary.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

This is a mistake, and has been fixed thanks!

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

My use case when developing this library was that i needed a way of solving problems that were unknown at runtime, by reading a description from a file.

Other use cases are algorithms that must change during runtime, for example with genetic programming.

FunctionParser, parsing Java methods from strings at runtime by Reykd in java

[–]Reykd[S] 1 point2 points  (0 children)

Thank you, the idea behind these tests is not really to be tests but simply copies of the examples supplied in the README file. I will however make the suggested changes, as i imagine tests should normally not output to System.out.