er :: (IsString a, Monoid a, ?numEpochs :: Int, ?dbnSizes :: [Int]) => String -> a
run_trainer outputFilepath = let dbnSizes' = ?dbnSizes 
                                 numepochs = ?numEpochs :: Int
                             in [str|
function dbn = run_trainer(train_x)
    dbn.sizes = $:dbnSizes'$;
    opts.numepochs = [$:numepochs$];
    opts.batchsize = 100;
    opts.momentum  =   0;
    opts.alpha     =   1;
    dbn = dbnsetup(dbn, train_x, opts);
    dbn = dbntrain(dbn, train_x, opts);
    nn = dbnunfoldtonn(dbn, 10);
    nnsave_to_file(nn, '$fromString outputFilepath$');


end
|]
run_trainer :: (IsString a, Monoid a, ?numEpochs :: Int, ?dbnSizes :: [Int]) => String -> a
run_trainer outputFilepath = let dbnSizes' = ?dbnSizes 
                                 numepochs = ?numEpochs :: Int
                             in [str|
function dbn = run_trainer(train_x)
    dbn.sizes = $:dbnSizes'$;
    opts.numepochs = [$:numepochs$];
    opts.batchsize = 100;
    opts.momentum  =   0;
    opts.alpha     =   1;
    dbn = dbnsetup(dbn, train_x, opts);
    dbn = dbntrain(dbn, train_x, opts);
    nn = dbnunfoldtonn(dbn, 10);
    nnsave_to_file(nn, '$fromString outputFilepath$');


end
|]
run_trainer outputFilepath = let dbnSizes' = ?dbnSizes 
                                 numepochs = ?numEpochs :: Int
                             in [str|
function dbn = run_trainer(train_x)
    dbn.sizes = $:dbnSizes'$;
    opts.numepochs = [$:numepochs$];
    opts.batchsize = 100;
    opts.momentum  =   0;
    opts.alpha     =   1;
    dbn = dbnsetup(dbn, train_x, opts);
    dbn = dbntrain(dbn, train_x, opts);
    nn = dbnunfoldtonn(dbn, 10);
    nnsave_to_file(nn, '$fromString outputFilepath$');


end
|]