-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stability of edges as feature selection
- Loading branch information
1 parent
547da24
commit e3d4fa3
Showing
8 changed files
with
249 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import logging | ||
|
||
|
||
def setup_logging(log_file: str = "analysis_log.txt"): | ||
# Get the root logger | ||
logger = logging.getLogger() | ||
|
||
# Check if handlers already exist and remove them to avoid duplication | ||
if logger.hasHandlers(): | ||
logger.handlers.clear() | ||
|
||
# Console handler: logs all levels (DEBUG and above) to the console | ||
console_handler = logging.StreamHandler() | ||
console_handler.setLevel(logging.DEBUG) | ||
console_handler.setFormatter(SimpleFormatter()) | ||
|
||
# File handler: logs only INFO level logs to the file | ||
file_handler = logging.FileHandler(log_file, mode='w') | ||
file_handler.setLevel(logging.INFO) | ||
file_handler.addFilter(lambda record: record.levelno == logging.INFO) | ||
file_handler.setFormatter(SimpleFormatter()) | ||
|
||
# Create a logger and set the base level to DEBUG so both handlers can operate independently | ||
logger.setLevel(logging.DEBUG) # This ensures all messages are passed to handlers | ||
logger.addHandler(console_handler) | ||
logger.addHandler(file_handler) | ||
|
||
|
||
class SimpleFormatter(logging.Formatter): | ||
def format(self, record): | ||
log_fmt = "%(message)s" | ||
formatter = logging.Formatter(log_fmt) | ||
return formatter.format(record) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.