You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Learning-Environment-Best-Practices.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,12 @@ complexity over time. This can either be done manually, or via Curriculum Learni
15
15
16
16
## Vector Observations
17
17
* Vector Observations should include all variables relevant to allowing the agent to take the optimally informed decision.
18
-
* Categorical variables such as type of object (Sword, Shield, Bow) should be encoded in one-hot fashion (ie`3` -> `0, 0, 1`).
18
+
* Categorical variables such as type of object (Sword, Shield, Bow) should be encoded in one-hot fashion (i.e.`3` -> `0, 0, 1`).
19
19
* Besides encoding non-numeric values, all inputs should be normalized to be in the range 0 to +1 (or -1 to 1). For example, the `x` position information of an agent where the maximum possible value is `maxValue` should be recorded as `AddVectorObs(transform.position.x / maxValue);` rather than `AddVectorObs(transform.position.x);`. See the equation below for one approach of normalization.
20
20
* Positional information of relevant GameObjects should be encoded in relative coordinates wherever possible. This is often relative to the agent position.
21
21
22
22

23
23
24
24
## Vector Actions
25
25
* When using continuous control, action values should be clipped to an appropriate range.
26
-
* Be sure to set the Vector Action's Space Size to the number of used Vector Actions, and not greater, as doing the latter can interfere with the efficency of the training process.
26
+
* Be sure to set the Vector Action's Space Size to the number of used Vector Actions, and not greater, as doing the latter can interfere with the efficiency of the training process.
@@ -195,7 +194,7 @@ The Agent sends the information we collect to the Brain, which uses it to make a
195
194
196
195
In our case, the information our agent collects includes:
197
196
198
-
* Position of the target. In general, it is better to use the relative position of other objects rather than the absolute position for more generalizable training. Note that the agent only collects the x and z coordinates since the floor is aligned with the xz plane and the y component of the target's position never changes.
197
+
* Position of the target. In general, it is better to use the relative position of other objects rather than the absolute position for more generalizable training. Note that the agent only collects the x and z coordinates since the floor is aligned with the x-z plane and the y component of the target's position never changes.
<!-- Note that the above values aren't normalized, which we recommend! -->
62
-
63
61
The feature vector must always contain the same number of elements and observations must always be in the same position within the list. If the number of observed entities in an environment can vary you can pad the feature vector with zeros for any missing entities in a specific observation or you can limit an agent's observations to a fixed subset. For example, instead of observing every enemy agent in an environment, you could only observe the closest five.
64
62
65
63
When you set up an Agent's brain in the Unity Editor, set the following properties to use a continuous vector observation:
@@ -94,11 +92,6 @@ Type enumerations should be encoded in the _one-hot_ style. That is, add an elem
94
92
}
95
93
96
94
97
-
<!--
98
-
How to handle things like large numbers of words or symbols? Should you use a very long one-hot vector? Or a single index into a table?
99
-
Colors? Better to use a single color number or individual components?
100
-
-->
101
-
102
95
#### Normalization
103
96
104
97
For the best results when training, you should normalize the components of your feature vector to the range [-1, +1] or [0, 1]. When you normalize the values, the PPO neural network can often converge to a solution faster. Note that it isn't always necessary to normalize to these recommended ranges, but it is considered a best practice when using neural networks. The greater the variation in ranges between the components of your observation, the more likely that training will be affected.
@@ -129,7 +122,7 @@ In addition, make sure that the Agent's Brain expects a visual observation. In t
You can use the discrete vector observation space when an agent only has a limited number of possible states and those states can be enumerated by a single number. For instance, the [Basic example environment](Learning-Environment-Examples.md) in the ML Agent SDK defines an agent with a discrete vector observation space. The states of this agent are the integer steps between two linear goals. In the Basic example, the agent learns to move to the goal that provides the greatest reward.
125
+
You can use the discrete vector observation space when an agent only has a limited number of possible states and those states can be enumerated by a single number. For instance, the [Basic example environment](Learning-Environment-Examples.md) in ML-Agents defines an agent with a discrete vector observation space. The states of this agent are the integer steps between two linear goals. In the Basic example, the agent learns to move to the goal that provides the greatest reward.
133
126
134
127
More generally, the discrete vector observation identifier could be an index into a table of the possible states. However, tables quickly become unwieldy as the environment becomes more complex. For example, even a simple game like [tic-tac-toe has 765 possible states](https://en.wikipedia.org/wiki/Game_complexity) (far more if you don't reduce the number of observations by combining those that are rotations or reflections of each other).
135
128
@@ -310,7 +303,7 @@ To add an Agent to an environment at runtime, use the Unity `GameObject.Instanti
310
303
311
304
## Destroying an Agent
312
305
313
-
Before destroying an Agent Gameobject, you must mark it as done (and wait for the next step in the simulation) so that the Brain knows that this agent is no longer active. Thus, the best place to destroy an agent is in the `Agent.AgentOnDone()` function:
306
+
Before destroying an Agent GameObject, you must mark it as done (and wait for the next step in the simulation) so that the Brain knows that this agent is no longer active. Thus, the best place to destroy an agent is in the `Agent.AgentOnDone()` function:
Copy file name to clipboardExpand all lines: docs/Learning-Environment-Design-External-Internal-Brains.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ The training algorithms included in the ML-Agents SDK produce TensorFlow graph m
24
24
25
25
To use a graph model:
26
26
27
-
1. Select the Brain GameObject in the **Hierarchy** window of the Unity Editor. (The Brain GameObject must be a child of the Academy Gameobject and must have a Brain component.)
27
+
1. Select the Brain GameObject in the **Hierarchy** window of the Unity Editor. (The Brain GameObject must be a child of the Academy GameObject and must have a Brain component.)
28
28
2. Set the **Brain Type** to **Internal**.
29
29
30
30
**Note:** In order to see the **Internal** Brain Type option, you must [enable TensorFlowSharp](Using-TensorFlow-Sharp-in-Unity.md).
@@ -44,7 +44,7 @@ The default values of the TensorFlow graph parameters work with the model produc
*`Graph Model` : This must be the `bytes` file corresponding to the pretrained Tensorflow graph. (You must first drag this file into your Resources folder and then from the Resources folder into the inspector)
47
+
*`Graph Model` : This must be the `bytes` file corresponding to the pre-trained TensorFlow graph. (You must first drag this file into your Resources folder and then from the Resources folder into the inspector)
48
48
49
49
Only change the following Internal Brain properties if you have created your own TensorFlow model and are not using an ML-Agents model:
Copy file name to clipboardExpand all lines: docs/Learning-Environment-Design.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ The ML-Agents Academy class orchestrates the agent simulation loop as follows:
25
25
26
26
To create a training environment, extend the Academy and Agent classes to implement the above methods. The `Agent.CollectObservations()` and `Agent.AgentAction()` functions are required; the other methods are optional — whether you need to implement them or not depends on your specific scenario.
27
27
28
-
**Note:** The API used by the Python PPO training process to communicate with and control the Academy during training can be used for other purposes as well. For example, you could use the API to use Unity as the simulation engine for your own machine learning algorithms. See [External ML API](Python-API.md) for more information.
28
+
**Note:** The API used by the Python PPO training process to communicate with and control the Academy during training can be used for other purposes as well. For example, you could use the API to use Unity as the simulation engine for your own machine learning algorithms. See [Python API](Python-API.md) for more information.
Copy file name to clipboardExpand all lines: docs/Python-API.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ A BrainInfo object contains the following fields:
38
38
***`text_observations`** : A list of string corresponding to the agents text observations.
39
39
***`memories`** : A two dimensional numpy array of dimension `(batch size, memory size)` which corresponds to the memories sent at the previous step.
40
40
***`rewards`** : A list as long as the number of agents using the brain containing the rewards they each obtained at the previous step.
41
-
***`local_done`** : A list as long as the number of agents using the brain containing `done` flags (wether or not the agent is done).
41
+
***`local_done`** : A list as long as the number of agents using the brain containing `done` flags (whether or not the agent is done).
42
42
***`max_reached`** : A list as long as the number of agents using the brain containing true if the agents reached their max steps.
43
43
***`agents`** : A list of the unique ids of the agents using the brain.
44
44
***`previous_actions`** : A two dimensional numpy array of dimension `(batch size, vector action size)` if the vector action space is continuous and `(batch size, 1)` if the vector action space is discrete.
0 commit comments