Skip to content

Release v0.9.0 #2380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 97 commits into from
Aug 1, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
1c4bffa
Update make_for_win.bat
rsfutch77 Jun 9, 2019
df8f2a0
Update Creating-Custom-Protobuf-Messages.md
rsfutch77 Jun 10, 2019
627ce19
Update make_for_win.bat
rsfutch77 Jun 10, 2019
1d5bf01
Update README.md
rsfutch77 Jun 10, 2019
7ebf3ed
Update .gitignore
rsfutch77 Jun 10, 2019
0c46cf8
Update make_for_win.bat
rsfutch77 Jun 10, 2019
f0729ff
Update .gitignore
rsfutch77 Jun 10, 2019
034dc70
Update make_for_win_.bat to match make.bat
rsfutch77 Jun 10, 2019
e38e81f
Update protobuf readme
rsfutch77 Jun 16, 2019
15ebe45
Update protobuf readme
rsfutch77 Jun 16, 2019
15a3fa8
Fix mlagents re-install directions
rsfutch77 Jun 16, 2019
e4d83f6
Updated minor typos (sh for console)
quevedin Jun 23, 2019
be5a60a
Merge pull request #2179 from Unity-Technologies/release-v0.8.2
xiaomaogy Jun 24, 2019
d767905
Use pre-commit for CI tests, add black hook (#2163)
Jun 25, 2019
8b77f11
Enable mypy in precommit checks (#2177)
Jun 25, 2019
0a37a43
Adding docs clarifying the construction of the ray sublist. The main …
gregnz Jun 26, 2019
1786fb0
Update to include CLA language (#2195)
shihzy Jun 26, 2019
a740162
Merge pull request #2172 from quevedin/patch-1
xiaomaogy Jun 26, 2019
e8018e8
Merge pull request #2190 from gregnz/develop-rayperception-docs
xiaomaogy Jun 26, 2019
ebf9582
Merge branch 'develop' into protobuf_update
rsfutch77 Jun 27, 2019
2b4a961
Merge pull request #2138 from rsfutch77/protobuf_update
xiaomaogy Jun 27, 2019
ed1b76e
enable precommit for line endings, fix 1 failure (#2208)
Jul 1, 2019
f4bc8ef
Refactor reward signals into separate class (#2144)
Jul 3, 2019
f6f967a
Remove unused "last reward" logic, TF nodes
Jul 3, 2019
15fa740
add flake8 to precommit
Jul 8, 2019
3420421
add setup.cfg
Jul 8, 2019
654bb7b
enforce line length
Jul 8, 2019
98e9d24
cleanup setup.cfg
Jul 8, 2019
3aa3310
precommit autoupdate
Jul 8, 2019
0d23c30
fix accidental change
Jul 8, 2019
b52926c
remove unused variables
Jul 9, 2019
cdf8b2c
Add environment manager for parallel environments (#2209)
Jul 9, 2019
3fbc928
Remove "external_brains" arg for TrainerController (#2213)
Jul 9, 2019
ea60bc9
Fix reference to external_brains in TrainerController (#2237)
Jul 9, 2019
b7f841a
Add custom reset parameters to subprocess env manager
erikfrey Jul 10, 2019
1417b9c
Make Gym interface work with grayscale and RGB visual observations (#…
shakenes Jul 11, 2019
3e242c7
python timers (#2180)
chriselion Jul 11, 2019
603ac97
fix subprocess test and style checks on develop (#2248)
chriselion Jul 11, 2019
586e50c
add some types to the reward signals (#2215)
chriselion Jul 12, 2019
83f16b5
Merge remote-tracking branch 'origin/master' into enable-flake8
Jul 12, 2019
6e2f1b7
Using-Docker.md miss a backslash in 3DBall command (#2239)
AcelisWeaven Jul 12, 2019
ec11f57
[docs] Fix a small spelling error. (#2256)
surfnerd Jul 12, 2019
e670c97
[docs] Reorder the instructions for intalling python/mlagents for seq…
surfnerd Jul 12, 2019
6b736e0
[docs] Fix typo. (#2260)
surfnerd Jul 12, 2019
850663d
enforce a min % of code coverage
Jul 15, 2019
24818aa
comments
Jul 15, 2019
9787453
add kor ver of README.md and empty docs, images (#2221)
JangHyeonJun Jul 16, 2019
a3e859e
link from readme to KR docs (#2271)
shihzy Jul 16, 2019
3d82954
Updated links to point to KR blog site (#2272)
shihzy Jul 16, 2019
34e852c
GAIL and Pretraining (#2118)
Jul 16, 2019
a43361e
Swap 0 set and reward buffer append (#2273)
Jul 16, 2019
76f5e24
Add Unity command line arguments
BlueFisher Jul 11, 2019
c0316de
fix lint checks
Jul 17, 2019
c025086
Fix get_value_estimate and buffer append (#2276)
Jul 17, 2019
3496832
Relax the cloudpickle version restriction (#2279)
Jul 17, 2019
a9917c7
3D ball reset parameter implementation ported over
sankalp04 Jul 17, 2019
0fe03a0
3D ball reset parameter implementation ported over
sankalp04 Jul 17, 2019
b00f92b
two soccer reset parameter implementation ported over
sankalp04 Jul 17, 2019
f7ebd52
Fixed the default value to match the value in the docs
sankalp04 Jul 17, 2019
2929126
tennis reset parameter implementation ported over
sankalp04 Jul 17, 2019
f2b2e02
Ported documentation from other branch
sankalp04 Jul 17, 2019
96f3410
Merge pull request #2280 from Unity-Technologies/develop-newResetPara…
sankalp04 Jul 18, 2019
0750306
Merge pull request #2267 from Unity-Technologies/develop-enforce-cove…
xiaomaogy Jul 18, 2019
ed72010
Merge remote-tracking branch 'origin/develop' into enable-flake8
Jul 18, 2019
c085438
remove codacy (#2287)
Jul 18, 2019
6f36bc1
fix whitespace and line breaks
Jul 18, 2019
f564030
Fix respawn part of BananaLogic (#2277)
LuoYouRen Jul 18, 2019
0412409
remove unused variables
Jul 18, 2019
9c7b878
one more unused
Jul 18, 2019
2258691
update mypy version
Jul 18, 2019
cbdc3bc
Merge pull request #2236 from Unity-Technologies/enable-flake8
xiaomaogy Jul 18, 2019
7c374f2
Make SubprocessEnvManager take asynchronous steps (#2265)
Jul 19, 2019
e6dff56
Add different types of visual encoder (nature cnn/resnet)
dongruoping Jul 19, 2019
c806491
Fix for vis obs memory leak in docker (#2274)
awjuliani Jul 22, 2019
58d03ee
fix bug in RandomNormal (#2294)
Jul 22, 2019
09e66b1
Very simple environment for testing (#2266)
Jul 22, 2019
f576c88
Improvements for GAIL (#2296)
Jul 22, 2019
21d53d6
Cleanup unused code in TrainerController (#2315)
Jul 23, 2019
1837840
Get timers from subprocess (#2268)
Jul 23, 2019
8fd352b
Use Barracuda tensors and Barracuda 0.2.4 (#2308)
mantasp Jul 24, 2019
1148141
refactor vis_encoder_type and add to doc
dongruoping Jul 24, 2019
5bb5331
Fix broken doc links (#2327)
Jul 24, 2019
d5bfa89
Implemented the reset parameters for Banana Collectors and Bouncer (#…
sankalp04 Jul 24, 2019
75f1a9a
Reset Parameters implemented for Pushblock, Reacher and Walker (#2322)
sankalp04 Jul 24, 2019
b7dcda6
Profiling docs (#2325)
Jul 25, 2019
5d7dd57
Enable generalization training (#2232)
sankalp04 Jul 25, 2019
b2db1d9
Fix docs for reward signals (#2320)
Jul 25, 2019
ffa50d8
Fix default for vis_encode_type (#2330)
Jul 25, 2019
5837c71
Tick version number for 0.9 (#2331)
Jul 25, 2019
b78c1e0
Fix tests for Barracuda (#2333)
mantasp Jul 25, 2019
7a2a922
Fix docs for Generalization (#2334)
sankalp04 Jul 26, 2019
d26a502
Barracuda hotfix for LSTM and tests (#2352)
mantasp Jul 29, 2019
4279620
Added Migrating docs for 0.9 (#2347)
Jul 29, 2019
6c20869
Localizing kr (#2356)
JangHyeonJun Jul 30, 2019
9eefcd3
Release 0.9.0 docs checklist and cleanup - v2 (#2372)
Jul 31, 2019
efda758
Updated the models for v0.9 (#2374)
xiaomaogy Aug 1, 2019
52c004b
Fix training not quitting when play button is unchecked (#2376)
Aug 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix bug in RandomNormal (#2294)
* fix bug in RandomNormal, add test for distribution

* extract epsilon, rename vars
  • Loading branch information
Chris Elion authored Jul 22, 2019
commit 58d03eea4e370700a46ce16d5b00921b2afc517b
271 changes: 157 additions & 114 deletions UnitySDK/Assets/ML-Agents/Editor/Tests/RandomNormalTest.cs
Original file line number Diff line number Diff line change
@@ -1,122 +1,165 @@
using System;
using System;
using NUnit.Framework;
using MLAgents.InferenceBrain;
using MLAgents.InferenceBrain.Utils;

using UnityEngine;
using System.Collections;



namespace MLAgents.Tests
{

public class RandomNormalTest
{

[Test]
public void RandomNormalTestTwoDouble()
{
RandomNormal rn = new RandomNormal(2018);

Assert.AreEqual(-0.46666, rn.NextDouble(), 0.0001);
Assert.AreEqual(-0.37989, rn.NextDouble(), 0.0001);
}

[Test]
public void RandomNormalTestWithMean()
{
RandomNormal rn = new RandomNormal(2018, 5.0f);

Assert.AreEqual(4.53333, rn.NextDouble(), 0.0001);
Assert.AreEqual(4.6201, rn.NextDouble(), 0.0001);
}

[Test]
public void RandomNormalTestWithStddev()
{
RandomNormal rn = new RandomNormal(2018, 1.0f, 4.2f);

Assert.AreEqual(-0.9599, rn.NextDouble(), 0.0001);
Assert.AreEqual(-0.5955, rn.NextDouble(), 0.0001);
}

[Test]
public void RandomNormalTestWithMeanStddev()
{
RandomNormal rn = new RandomNormal(2018, -3.2f, 2.2f);

Assert.AreEqual(-4.2266, rn.NextDouble(), 0.0001);
Assert.AreEqual(-4.0357, rn.NextDouble(), 0.0001);
}

[Test]
public void RandomNormalTestTensorInt()
{
RandomNormal rn = new RandomNormal(1982);
Tensor t = new Tensor
{
ValueType = Tensor.TensorType.Integer
};

Assert.Throws<NotImplementedException>(() => rn.FillTensor(t));
}

[Test]
public void RandomNormalTestDataNull()
{
RandomNormal rn = new RandomNormal(1982);
Tensor t = new Tensor
{
ValueType = Tensor.TensorType.FloatingPoint
};

Assert.Throws<ArgumentNullException>(() => rn.FillTensor(t));
}

[Test]
public void RandomNormalTestTensor()
{
RandomNormal rn = new RandomNormal(1982);
Tensor t = new Tensor
{
ValueType = Tensor.TensorType.FloatingPoint,
Data = Array.CreateInstance(typeof(float), new long[3] {3, 4, 2})
};

rn.FillTensor(t);

float[] reference = new float[]
{
-0.2139822f,
0.5051259f,
-0.5640336f,
-0.3357787f,
-0.2055894f,
-0.09432302f,
-0.01419199f,
0.53621f,
-0.5507085f,
-0.2651141f,
0.09315512f,
-0.04918706f,
-0.179625f,
0.2280539f,
0.1883962f,
0.4047216f,
0.1704049f,
0.5050544f,
-0.3365685f,
0.3542781f,
0.5951571f,
0.03460682f,
-0.5537263f,
-0.4378373f,
};

int i = 0;
foreach (float f in t.Data)
{
Assert.AreEqual(f, reference[i], 0.0001);
++i;
}


}
}
public class RandomNormalTest
{
private const float firstValue = -1.19580f;
private const float secondValue = -0.97345f;
private const double epsilon = 0.0001;

[Test]
public void RandomNormalTestTwoDouble ()
{
RandomNormal rn = new RandomNormal (2018);

Assert.AreEqual (firstValue, rn.NextDouble (), epsilon);
Assert.AreEqual (secondValue, rn.NextDouble (), epsilon);
}

[Test]
public void RandomNormalTestWithMean ()
{
RandomNormal rn = new RandomNormal (2018, 5.0f);

Assert.AreEqual (firstValue + 5.0, rn.NextDouble (), epsilon);
Assert.AreEqual (secondValue + 5.0, rn.NextDouble (), epsilon);
}

[Test]
public void RandomNormalTestWithStddev ()
{
RandomNormal rn = new RandomNormal (2018, 0.0f, 4.2f);

Assert.AreEqual (firstValue * 4.2, rn.NextDouble (), epsilon);
Assert.AreEqual (secondValue * 4.2, rn.NextDouble (), epsilon);
}

[Test]
public void RandomNormalTestWithMeanStddev ()
{
float mean = -3.2f;
float stddev = 2.2f;
RandomNormal rn = new RandomNormal (2018, mean, stddev);

Assert.AreEqual (firstValue * stddev + mean, rn.NextDouble (), epsilon);
Assert.AreEqual (secondValue * stddev + mean, rn.NextDouble (), epsilon);
}

[Test]
public void RandomNormalTestTensorInt ()
{
RandomNormal rn = new RandomNormal (1982);
Tensor t = new Tensor {
ValueType = Tensor.TensorType.Integer
};

Assert.Throws<NotImplementedException> (() => rn.FillTensor (t));
}

[Test]
public void RandomNormalTestDataNull ()
{
RandomNormal rn = new RandomNormal (1982);
Tensor t = new Tensor {
ValueType = Tensor.TensorType.FloatingPoint
};

Assert.Throws<ArgumentNullException> (() => rn.FillTensor (t));
}

[Test]
public void RandomNormalTestDistribution ()
{
float mean = -3.2f;
float stddev = 2.2f;
RandomNormal rn = new RandomNormal (2018, mean, stddev);

int numSamples = 100000;
// Adapted from https://www.johndcook.com/blog/standard_deviation/
// Computes stddev and mean without losing precision
double oldM = 0.0, newM = 0.0, oldS = 0.0, newS = 0.0;

for (int i = 0; i < numSamples; i++) {
double x = rn.NextDouble ();
if (i == 0) {
oldM = newM = x;
oldS = 0.0;
} else {
newM = oldM + (x - oldM) / i;
newS = oldS + (x - oldM) * (x - newM);

// set up for next iteration
oldM = newM;
oldS = newS;
}
}

double sampleMean = newM;
double sampleVariance = newS / (numSamples - 1);
double sampleStddev = Math.Sqrt (sampleVariance);

// Note a larger epsilon here. We could get closer to the true values with more samples.
Assert.AreEqual (mean, sampleMean, 0.01);
Assert.AreEqual (stddev, sampleStddev, 0.01);

}

[Test]
public void RandomNormalTestTensor ()
{
RandomNormal rn = new RandomNormal (1982);
Tensor t = new Tensor {
ValueType = Tensor.TensorType.FloatingPoint,
Data = Array.CreateInstance (typeof (float), new long [3] { 3, 4, 2 })
};

rn.FillTensor (t);

float [] reference = new float []
{
-0.4315872f,
0.9561074f,
-1.130287f,
-0.7763879f,
-0.3027347f,
-0.1377991f,
-0.02921959f,
0.9520947f,
-1.11074f,
-0.5018106f,
0.1413168f,
-0.07491868f,
-0.2645015f,
0.3331701f,
0.3716498f,
1.088157f,
0.3414804f,
1.167787f,
-0.5105762f,
0.5396146f,
1.225356f,
0.06144788f,
-1.092338f,
-1.177194f,
};

int i = 0;
foreach (float f in t.Data) {
Assert.AreEqual (f, reference [i], epsilon);
++i;
}


}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace MLAgents.InferenceBrain.Utils
{
Expand All @@ -12,7 +12,7 @@ public class RandomNormal
private readonly double m_mean;
private readonly double m_stddev;
private readonly System.Random m_random;

public RandomNormal(int seed, float mean = 0.0f, float stddev = 1.0f)
{
m_mean = mean;
Expand All @@ -23,7 +23,7 @@ public RandomNormal(int seed, float mean = 0.0f, float stddev = 1.0f)
// Each iteration produces two numbers. Hold one here for next call
private bool m_hasSpare = false;
private double m_spare = 0.0f;

/// <summary>
/// Return the next random double number
/// </summary>
Expand All @@ -44,7 +44,7 @@ public double NextDouble()
s = u * u + v * v;
} while (s >= 1.0 || s == 0.0);

s = Math.Sqrt(-2.0 * Math.Log(s) / 2);
s = Math.Sqrt(-2.0 * Math.Log(s) / s);
m_spare = u * s;
m_hasSpare = true;

Expand All @@ -66,9 +66,9 @@ private void IncreaseNextDim(Array arr, long[] indices)
}
}
}

/// <summary>
/// Fill a pre-allocated Tensor with random numbers
/// Fill a pre-allocated Tensor with random numbers
/// </summary>
/// <param name="t">The pre-allocated Tensor to fill</param>
/// <exception cref="NotImplementedException">Throws when trying to fill a Tensor of type other than float</exception>
Expand Down