Add PyTorch recurrent forecaster
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet("torch", "reservoir")]
|
||||
[string]$Trainer = "torch",
|
||||
[string]$Symbols = "",
|
||||
[int]$Limit = 0,
|
||||
[string]$Lookbacks = "",
|
||||
[string]$Units = "",
|
||||
[string]$Ridges = "",
|
||||
[string]$Architectures = "",
|
||||
[string]$HiddenSizes = "",
|
||||
[string]$Layers = "",
|
||||
[string]$Dropouts = "",
|
||||
[int]$Epochs = 0,
|
||||
[int]$Patience = 0,
|
||||
[string]$Interval = "",
|
||||
[string]$EnvFile = ""
|
||||
)
|
||||
@@ -47,9 +55,15 @@ if (-not $Symbols -and $env:LSTM_RETRAIN_SYMBOLS) { $Symbols = $env:LSTM_RETRAIN
|
||||
if ($Limit -le 0) {
|
||||
$Limit = if ($env:LSTM_RETRAIN_LIMIT) { [int]$env:LSTM_RETRAIN_LIMIT } else { 1000 }
|
||||
}
|
||||
if (-not $Lookbacks) { $Lookbacks = if ($env:LSTM_RETRAIN_LOOKBACKS) { $env:LSTM_RETRAIN_LOOKBACKS } else { "16,32" } }
|
||||
if (-not $Lookbacks) { $Lookbacks = if ($env:LSTM_RETRAIN_LOOKBACKS) { $env:LSTM_RETRAIN_LOOKBACKS } else { "32,64" } }
|
||||
if (-not $Units) { $Units = if ($env:LSTM_RETRAIN_UNITS) { $env:LSTM_RETRAIN_UNITS } else { "4,6" } }
|
||||
if (-not $Ridges) { $Ridges = if ($env:LSTM_RETRAIN_RIDGES) { $env:LSTM_RETRAIN_RIDGES } else { "0.001" } }
|
||||
if (-not $Architectures) { $Architectures = if ($env:LSTM_RETRAIN_ARCHITECTURES) { $env:LSTM_RETRAIN_ARCHITECTURES } else { "lstm,gru" } }
|
||||
if (-not $HiddenSizes) { $HiddenSizes = if ($env:LSTM_RETRAIN_HIDDEN_SIZES) { $env:LSTM_RETRAIN_HIDDEN_SIZES } else { "16,32" } }
|
||||
if (-not $Layers) { $Layers = if ($env:LSTM_RETRAIN_LAYERS) { $env:LSTM_RETRAIN_LAYERS } else { "1" } }
|
||||
if (-not $Dropouts) { $Dropouts = if ($env:LSTM_RETRAIN_DROPOUTS) { $env:LSTM_RETRAIN_DROPOUTS } else { "0.0" } }
|
||||
if ($Epochs -le 0) { $Epochs = if ($env:LSTM_RETRAIN_EPOCHS) { [int]$env:LSTM_RETRAIN_EPOCHS } else { 60 } }
|
||||
if ($Patience -le 0) { $Patience = if ($env:LSTM_RETRAIN_PATIENCE) { [int]$env:LSTM_RETRAIN_PATIENCE } else { 10 } }
|
||||
if (-not $Interval -and $env:LSTM_RETRAIN_INTERVAL) { $Interval = $env:LSTM_RETRAIN_INTERVAL }
|
||||
if (-not $EnvFile -and $env:LSTM_RETRAIN_ENV) { $EnvFile = $env:LSTM_RETRAIN_ENV }
|
||||
if (-not $EnvFile -and (Test-Path (Join-Path $RepoRoot ".env"))) { $EnvFile = Join-Path $RepoRoot ".env" }
|
||||
@@ -66,14 +80,29 @@ try {
|
||||
}
|
||||
|
||||
$python = Resolve-Python
|
||||
$trainerArgs = @(
|
||||
"-u",
|
||||
"tools\train_lstm_forecaster.py",
|
||||
"--limit", $Limit.ToString(),
|
||||
"--lookbacks", $Lookbacks,
|
||||
"--units", $Units,
|
||||
"--ridges", $Ridges
|
||||
)
|
||||
if ($Trainer -eq "torch") {
|
||||
$trainerArgs = @(
|
||||
"-u",
|
||||
"tools\train_torch_recurrent_forecaster.py",
|
||||
"--limit", $Limit.ToString(),
|
||||
"--lookbacks", $Lookbacks,
|
||||
"--architectures", $Architectures,
|
||||
"--hidden-sizes", $HiddenSizes,
|
||||
"--layers", $Layers,
|
||||
"--dropouts", $Dropouts,
|
||||
"--epochs", $Epochs.ToString(),
|
||||
"--patience", $Patience.ToString()
|
||||
)
|
||||
} else {
|
||||
$trainerArgs = @(
|
||||
"-u",
|
||||
"tools\train_lstm_forecaster.py",
|
||||
"--limit", $Limit.ToString(),
|
||||
"--lookbacks", $Lookbacks,
|
||||
"--units", $Units,
|
||||
"--ridges", $Ridges
|
||||
)
|
||||
}
|
||||
if ($Symbols) { $trainerArgs += @("--symbols", $Symbols) }
|
||||
if ($Interval) { $trainerArgs += @("--interval", $Interval) }
|
||||
if ($EnvFile) { $trainerArgs += @("--env", $EnvFile) }
|
||||
|
||||
Reference in New Issue
Block a user