This file contains hidden or 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
import yaml | |
import argparse | |
class Config: | |
""" | |
A dynamic configuration class that automatically loads configuration from a YAML file and command line arguments. | |
Attributes: | |
_config (dict): A dictionary to store configuration parameters. |
This file contains hidden or 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
import logging | |
import os | |
import sys | |
def root_path(): | |
... | |
class MyFormatter(logging.Formatter): | |
err_fmt = f"%(asctime)s %(levelname)s %(filename)s @function %(funcName)s line %(lineno)s - %(message)s" |
This file contains hidden or 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
import torch | |
import numpy as np | |
import random | |
def seed_random_generators(seed=SEED): | |
np.random.seed(seed) | |
torch.manual_seed(seed) | |
torch.cuda.manual_seed(seed) | |
random.seed(seed) |
This file contains hidden or 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
import numpy as np | |
import os # To improve compatity of the code | |
import matplotlib.pyplot as plt | |
class Reader(): | |
def __init__(self): | |
pass | |
def load_data(self, foldername): | |
''' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
import matplotlib.pyplot as plt | |
import numpy as np | |
import os | |
import math | |
def read_data(BASE='dataSets'): | |
''' | |
load data from file | |
:param BASE: the path of the folder storing the dataset | |
:return: dict{['train','test']} | |
''' |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
import math | |
def read_data(BASE='dataSets'): | |
''' | |
load data from file | |
:param BASE: the path of the folder storing the dataset | |
:return: dict{['train','test']} |
This file contains hidden or 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
import numpy as np | |
import math | |
import matplotlib.pyplot as plt | |
import os | |
def read_data(BASE='dataSets'): | |
''' | |
load data from file | |
:param BASE: the path of the folder storing the dataset | |
:return: dict{['train','test']} |
This file contains hidden or 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
import numpy as np | |
import matplotlib.pyplot as plt | |
import os | |
def read_data(BASE='dataSets'): | |
''' | |
load data from file | |
:param parentF: the path of parent folder of the data file | |
:return: dict{['train','test']} | |
''' |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder