Feyn Documentation

Feyn Documentation

  • Learn
  • Guides
  • Tutorials
  • API Reference
  • FAQ

›Advanced

Getting Started

  • Quick start
  • Using Feyn
  • Installation
  • What is the QLattice?

Essentials

  • Auto Run
  • Summary plot
  • Plot response
  • Splitting a dataset
  • Seeding a QLattice
  • Predicting with a model
  • Saving and loading models
  • Categorical features

Evaluate Regressors

  • Regression plot
  • Residuals plot

Evaluate Classifiers

  • ROC curve
  • Confusion matrix
  • Plot probability scores

Understand Your Models

  • Plot response 1D
  • Plot response 2D
  • Model signal
  • Segmented loss
  • Interactive flow

Primitive Operations

  • Using the primitives
  • Updating priors
  • Sample models
  • Fitting models
  • Pruning models
  • Visualise a model
  • Diverse models
  • Updating a QLattice
  • Validate data
  • Semantic types

Advanced

  • Converting a model to SymPy
  • Logging in Feyn
  • Setting themes
  • Saving a graph as an image
  • Using the query language
  • Estimating priors
  • Filtering models
  • Model parameters
  • Model complexity

Privacy & Commercial

  • Privacy
  • Community edition
  • Commercial use
  • Transition to Feyn 3.0

Logging in Feyn

by: Kevin Broløs
(Feyn version 3.1.0 or newer)


Feyn uses the standard Python logging module for all messages. This means that the output can be configured and controlled as you usually would in a Python application. This allows you to suppress log outputs, or to choose logging messages to a file instead.

Any existing log configurations will always be honored.

For more information on the logging module, we refer you to the official documentation and the official logging HOWTO.

Default configuration

If nothing else is set, the default log level for Feyn is INFO.

Additionally, in the case where there is no existing configuration and the root logger has no handlers, Feyn will register its own StreamHandler on the feyn logger. This is done primarily to support data science workflows and IPython environments like Jupyter, where users typically don't preconfigure log handlers.

Changing log levels

You can change the default log level using setLevel, for instance:

import logging
logging.getLogger('feyn').setLevel("ERROR")

Disabling default behaviour

If you want to avoid the default behaviour, make sure to configure your logging before importing Feyn. A basic example that logs to a file:

import logging
logging.basicConfig(level=logging.INFO)

import feyn

Alternatively, if your own logger is configured after importing Feyn, you can remove the handlers to avoid potentially handling logs on both the feyn and root level. Example:

import feyn

import logging
logging.basicConfig()

feyn_logger = logging.getLogger('feyn')
for handler in feyn_logger.handlers:
    feyn_logger.removeHandler(handler)

JupyterLogger

When Feyn detects that it's running in IPython environments like Jupyter and if nothing else is configured, it configures the logging to use an extended Logger class to ensure a nice default output for humans. This logger uses the IPython.display functionality for DEBUG and INFO level messages, and the logging system only for WARNING, ERROR and FATAL.

As mentioned above, if you want to avoid this behaviour, make sure to configure your logging before importing feyn, or to set your own custom logger.

Disable display behavior

If you want to disable the IPython.display bypass behavior and use the logging system instead, you can set use_display to False individually like in the example below:

logging.getLogger('feyn').use_display = False
logging.getLogger('feyn._model').use_display = False
# etc. (...)

or for all of them by setting it globally on the class property:

feyn._logging.JupyterLogger.use_display = False

Removing the logger class

If you have imported Feyn prior to adding configuration, the JupyterLogger is added using logging.setLoggerClass and can be reverted by calling:

logging.setLoggerClass(logging.Logger)
← Converting a model to SymPySetting themes →
  • Default configuration
    • Changing log levels
    • Disabling default behaviour
  • JupyterLogger
    • Disable display behavior
    • Removing the logger class

Subscribe to get news about Feyn and the QLattice.

You can opt out at any time, and you can read our privacy policy here.

Copyright © 2024 Abzu.ai - Feyn license: CC BY-NC-ND 4.0
Feyn®, QGraph®, and the QLattice® are registered trademarks of Abzu®