| 57 | } |
| 58 | |
| 59 | void validateConfig(size_t epochs, const TuningConfig &cfg) |
| 60 | { |
| 61 | if (epochs < 1) |
| 62 | throw std::invalid_argument("epochs must be greater than 0"); |
| 63 | if (!(cfg.tuneRule[FREESTYLE] || cfg.tuneRule[STANDARD] || cfg.tuneRule[RENJU])) |
| 64 | throw std::invalid_argument("there must be at least one rule to tune"); |
| 65 | if (cfg.batchSize < 1) |
| 66 | throw std::invalid_argument("batchsize must be greater than 0"); |
| 67 | if (cfg.moveScoreLossGamma < 0) |
| 68 | throw std::invalid_argument("move-score-loss-gamma must be not less than 0"); |
| 69 | if (cfg.boardSizeMin > cfg.boardSizeMax) |
| 70 | throw std::invalid_argument("max-boardsize must be greater than min-boardsize"); |
| 71 | if (!cfg.usePreviousScalingFactor) { |
| 72 | if (cfg.nIterations < 1 || cfg.nStepsPerIteration < 1) |
| 73 | throw std::invalid_argument( |
| 74 | "num-iteration and num-steps-per-iteration must be greater than 0"); |
| 75 | if (cfg.scalingFactorMin > cfg.scalingFactorMax) |
| 76 | throw std::invalid_argument( |
| 77 | "scaling-factor-lower-bound must be not less than scaling-factor-upper-bound"); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | std::unique_ptr<Dataset> createDataset(Command::DatasetType datasetType, |
| 82 | const std::vector<std::string> &pathList) |