Ver código fonte

changing activation function

Sebastian Vendt 6 anos atrás
pai
commit
8b9ccbad70
2 arquivos alterados com 8 adições e 8 exclusões
  1. 6 6
      julia/net.jl
  2. 2 2
      julia/verbose.jl

+ 6 - 6
julia/net.jl

@@ -133,14 +133,14 @@ model = Chain(
 	Dropout(dropout_rate),
 	Dense(inputDense2, inputDense3, relu),
 	Dropout(dropout_rate),
-	Dense(inputDense3, 2), # identity to output coordinates!
+	Dense(inputDense3, 2, σ), # coordinates between 0 and 1
 )
 
 function train_model(model, train_set, validation_set, test_set)
    Flux.testmode!(model, true)
 	opt = Momentum(learning_rate, momentum)
-	if(validate) tprintf(io, "INIT with Loss(val_set): %f\n", loss(validation_set)) 
-	else tprintf(io, "INIT with Loss(test_set): %f\n", loss(test_set)) end
+	if(validate) @printf(io, "[%s] INIT with Loss(val_set): %f\n", Dates.format(now(), time_format), loss(validation_set)) 
+	else @printf(io, "[%s] INIT with Loss(test_set): %f\n", Dates.format(now(), time_format), loss(test_set)) end
 	
     for i in 1:epochs
 		flush(io)
@@ -149,12 +149,12 @@ function train_model(model, train_set, validation_set, test_set)
         opt.eta = adapt_learnrate(i)
         if ( rem(i, printout_interval) == 0 ) 
          Flux.testmode!(model, true)
-			tprintf(io, "Epoch %3d: Loss: %f\n", i, loss(train_set)) 
+			@printf(io, "[%s] Epoch %3d: Loss: %f\n", Dates.format(now(), time_format), i, loss(train_set)) 
 		end 
     end
 	Flux.testmode!(model, true)
-	if(validate) tprintf(io, "FINAL Loss(val_set): %f\n", loss(validation_set)) 
-	else tprintf(io, "FINAL Loss(test_set): %f\n", loss(test_set)) end
+	if(validate) @printf(io, "[%s] FINAL Loss(val_set): %f\n", Dates.format(now(), time_format), loss(validation_set)) 
+	else @printf(io, "[%s] FINAL Loss(test_set): %f\n", Dates.format(now(), time_format), loss(test_set)) end
 end
 
 # logging framework 

+ 2 - 2
julia/verbose.jl

@@ -19,11 +19,11 @@ Same as printf but with leading timestamps
 function tprintf(args...)
 	isempty(args) && throw(ArgumentError("tprintf: called with no arguments"))
     if isa(args[1], AbstractString) || is_str_expr(args[1])
-        _printf("tprintf", :stdout, "[$(Dates.format(now(), time_format))] $(args[1])", args[2:end])
+        _printf("printf", :stdout, "[$(Dates.format(now(), time_format))] $(args[1])", args[2:end])
     else
         (length(args) >= 2 && (isa(args[2], AbstractString) || is_str_expr(args[2]))) ||
             throw(ArgumentError("tprintf: first or second argument must be a format string"))
-        _printf("tprintf", esc(args[1]), "[$(Dates.format(now(), time_format))] $(args[2])", args[3:end])
+        _printf("printf", esc(args[1]), "[$(Dates.format(now(), time_format))] $(args[2])", args[3:end])
     end
 end