浏览代码

fix variable name case

/sampler-refactor-copy
Andrew Cohen 5 年前
当前提交
c71bbf3c
共有 1 个文件被更改,包括 17 次插入17 次删除
  1. 34
      com.unity.ml-agents/Runtime/Sampler.cs

34
com.unity.ml-agents/Runtime/Sampler.cs


//RNG
System.Random distr = new System.Random(seed);
// Skip type of distribution since already checked to get into this function
var sampler_encoding = encoding.Skip(1);
var samplerEncoding = encoding.Skip(1);
float sum_interval_sizes = 0;
float sumIntervalSizes = 0;
int num_intervals = (int)(sampler_encoding.Count()/2);
int numIntervals = (int)(samplerEncoding.Count()/2);
float[] interval_sizes = new float[num_intervals];
float[] intervalSizes = new float[numIntervals];
IList<Func<float>> intervals = new Func<float>[num_intervals];
IList<Func<float>> intervals = new Func<float>[numIntervals];
for(int i = 0; i < num_intervals; i++)
for(int i = 0; i < numIntervals; i++)
var min = sampler_encoding.ElementAt(2 * i);
var max = sampler_encoding.ElementAt(2 * i + 1);
var interval_size = max - min;
sum_interval_sizes += interval_size;
interval_sizes[i] = interval_size;
intervals[i] = () => min + (float)distr.NextDouble() * interval_size;
var min = samplerEncoding.ElementAt(2 * i);
var max = samplerEncoding.ElementAt(2 * i + 1);
var intervalSize = max - min;
sumIntervalSizes += intervalSize;
intervalSizes[i] = intervalSize;
intervals[i] = () => min + (float)distr.NextDouble() * intervalSize;
for(int i = 0; i < num_intervals; i++)
for(int i = 0; i < numIntervals; i++)
interval_sizes[i] = interval_sizes[i] / sum_interval_sizes;
intervalSizes[i] = intervalSizes[i] / sumIntervalSizes;
for(int i = 1; i < num_intervals; i++)
for(int i = 1; i < numIntervals; i++)
interval_sizes[i] += interval_sizes[i - 1];
intervalSizes[i] += intervalSizes[i - 1];
int sampledInterval = intervalDistr.Sample(interval_sizes);
int sampledInterval = intervalDistr.Sample(intervalSizes);
return intervals[sampledInterval].Invoke();
}
return MultiRange;

正在加载...
取消
保存