opencog / moses

MOSES Machine Learning: Meta-Optimizing Semantic Evolutionary Search. See also AS-MOSES https://github.com/opencog/asmoses but kept to guaranty backward compatibility.
https://wiki.opencog.org/w/Meta-Optimizing_Semantic_Evolutionary_Search
Other
127 stars 83 forks source link

remove log output from stdout #64

Closed mjsduncan closed 6 years ago

mjsduncan commented 6 years ago

is there any way to turn of the log output from the stdout stream? it breaks pipes using the moses binary.

ngeiswei commented 6 years ago

@mjsduncan, yes you can turn off stdout either via the C++ API

logger().set_print_to_stdout_flag(false);

or via the Scheme API

(cog-logger-set-stdout! #f)

However my default that's what moses should do. In which context do get that problem?

mjsduncan commented 6 years ago

thanks! it broke my R wrapper which takes the output directly from the binary. if this is standard now shouldn't saving results to file be built in? right now it's an optional flag.

mjsduncan commented 6 years ago

turning it off via the command line would be ideal.

ngeiswei commented 6 years ago

Oh, so you don't mean the logging system I think, just the output results, the candidates and their scores, right?

Can't you just redirect moses' output to /dev/null?

ngeiswei commented 6 years ago

Actually there's an option, -o, is that doing what you need?

mjsduncan commented 6 years ago

the R code runs the binary and gets the output directly from stdout so now i have to filter out the log lines before further processing. this is fairly new behavior, a few months ago it wasn't necessary (maybe longer, it's been awhile since i used moses through R). my workaround now is to use the -o option to save the output and have R read the file.

ngeiswei commented 6 years ago

@mjsduncan what do you mean by "log lines"? Do you mean what is written in moses.log? Like

[2018-10-17 09:09:56:688] [INFO] moses version 3.6.10
[2018-10-17 09:09:56:688] [INFO] hostname: sofia-desktop
[2018-10-17 09:09:56:688] [INFO] Command line: moses -Hpa -k4 -m10000 -j4
[2018-10-17 09:09:56:688] [INFO] Alphabet size = 7 output = boolean
[2018-10-17 09:09:56:688] [INFO] BScore complexity ratio = 3.5
[2018-10-17 09:09:56:689] [INFO] Cache composite scores
[2018-10-17 09:09:56:689] [INFO] Inferred target score = 0

?

This shouldn't pollute the stdout, if it does, something is weird.

mjsduncan commented 6 years ago

those are the lines i'm talking about. after testing further this is an R bug, the R function that runs shell binaries is now somehow pulling the log output as well as the final results from what is supposed to only be the "stdout" source. sorry for not checking this first.