MCPcopy Index your code
hub / github.com/tensorflow/tfjs-examples / parseArguments

Function parseArguments

snake-dqn/train.js:140–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138}
139
140export function parseArguments() {
141 const parser = new argparse.ArgumentParser({
142 description: 'Training script for a DQN that plays the snake game'
143 });
144 parser.addArgument('--gpu', {
145 action: 'storeTrue',
146 help: 'Whether to use tfjs-node-gpu for training ' +
147 '(requires CUDA GPU, drivers, and libraries).'
148 });
149 parser.addArgument('--height', {
150 type: 'int',
151 defaultValue: 9,
152 help: 'Height of the game board.'
153 });
154 parser.addArgument('--width', {
155 type: 'int',
156 defaultValue: 9,
157 help: 'Width of the game board.'
158 });
159 parser.addArgument('--numFruits', {
160 type: 'int',
161 defaultValue: 1,
162 help: 'Number of fruits present on the board at any given time.'
163 });
164 parser.addArgument('--initLen', {
165 type: 'int',
166 defaultValue: 2,
167 help: 'Initial length of the snake, in number of squares.'
168 });
169 parser.addArgument('--cumulativeRewardThreshold', {
170 type: 'float',
171 defaultValue: 100,
172 help: 'Threshold for cumulative reward (its moving ' +
173 'average) over the 100 latest games. Training stops as soon as this ' +
174 'threshold is reached (or when --maxNumFrames is reached).'
175 });
176 parser.addArgument('--maxNumFrames', {
177 type: 'float',
178 defaultValue: 1e6,
179 help: 'Maximum number of frames to run durnig the training. ' +
180 'Training ends immediately when this frame count is reached.'
181 });
182 parser.addArgument('--replayBufferSize', {
183 type: 'int',
184 defaultValue: 1e4,
185 help: 'Length of the replay memory buffer.'
186 });
187 parser.addArgument('--epsilonInit', {
188 type: 'float',
189 defaultValue: 0.5,
190 help: 'Initial value of epsilon, used for the epsilon-greedy algorithm.'
191 });
192 parser.addArgument('--epsilonFinal', {
193 type: 'float',
194 defaultValue: 0.01,
195 help: 'Final value of epsilon, used for the epsilon-greedy algorithm.'
196 });
197 parser.addArgument('--epsilonDecayFrames', {

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected