snorkel.classification.LogWriter

class snorkel.classification.LogWriter(**kwargs)[source]

Bases: object

A class for writing logs.

Parameters

kwargs (Any) – Settings to merge into LogWriterConfig

config[source]

Merged configuration

run_name[source]

Name of run if provided, otherwise date-time combination

log_dir[source]

The root directory where logs should be saved

run_log[source]

Dictionary of scalar values to log, keyed by value name

__init__(**kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Return type

None

Methods

__init__(**kwargs)

Initialize self.

add_scalar(name, value, step)

Log a scalar variable.

cleanup()

Perform final operations and close writer if necessary.

write_config(config[, config_filename])

Dump the config to file.

write_json(dict_to_write, filename)

Dump a JSON-compatbile object to root log directory.

write_log(log_filename)

Dump the scalar value log to file.

write_text(text, filename)

Dump user-provided text to filename (e.g., the launch command).

add_scalar(name, value, step)[source]

Log a scalar variable.

Parameters
  • name (str) – Name of the scalar collection

  • value (float) – Value of scalar

  • step (float) – Step axis value

Return type

None

cleanup()[source]

Perform final operations and close writer if necessary.

Return type

None

write_config(config, config_filename='config.json')[source]

Dump the config to file.

Parameters
  • config (Namedtuple) – JSON-compatible config to write to file

  • config_filename (str) – Name of file in logging directory to write to

Return type

None

write_json(dict_to_write, filename)[source]

Dump a JSON-compatbile object to root log directory.

Parameters
  • dict_to_write (Mapping[str, Any]) – JSON-compatbile object to log

  • filename (str) – Name of file in logging directory to write to

Return type

None

write_log(log_filename)[source]

Dump the scalar value log to file.

Parameters

log_filename (str) – Name of file in logging directory to write to

Return type

None

write_text(text, filename)[source]

Dump user-provided text to filename (e.g., the launch command).

Parameters
  • text (str) – Text to write

  • filename (str) – Name of file in logging directory to write to

Return type

None