diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b40a7b1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# ENTER MODELFORGE + +Ready to make some magic happen with ModelForge? Whether it's your first time forking a repo or you're a seasoned coder, we're excited to have you here! This doc will help you join the action. But first, grab some snacks, maybe a bunsamosa (:p), and let’s lay down some ground rules. + +## What is This? 🛠️ + +This is ModelForge—our low-code ML framework designed to make model-building as smooth as butter. Your contributions are going to make it even cooler, and hacknights are the perfect time to bring in fresh energy, and here's how you can get started: + +# Participiant: How to Contribute + +1. **Visit the HackNight 6.0 Leaderboard**: Browse the leaderboard and choose a repository you'd like to contribute to! + +2.**Check for Open Issues**: Look for any open issues in the repository. If you find one that interests you, ask to be assigned to it by commenting on the issue. + +3.**Setup Your Codebase**: + +Fork the repository to your GitHub account and copy it's clone URL +Clone your forked repository to your local machine using Git (make sure it's installed) + +```bash +git clone git@github.com:your-username/repo-name.git +``` + +4.**Make Your Changes** After cloning and setting up your branch, make the necessary changes to the code in your IDE. + +5.**Commit and Push**: Commit your changes and push them to your fork: + +```bash +git commit -m "Describe the changes you made" +git push +``` + +Alternatively, use VSCode's inbuilt Git source control pane Ctrl+Shift+G if you're unconfortable with a CLI + +6.**Submit a Pull Request**: After pushing your changes, open a pull request to pull changes from your fork to the original repository. + +7.**Get Feedback** Wait for a maintainer to review your pull request (PR) and provide feedback. + +8.**Gain Bounty Points** If everything is approved, your issue will be closed, and you'll gain bounty points on the leaderboard! diff --git a/main.py b/main.py index 8b2496a..eae937e 100644 --- a/main.py +++ b/main.py @@ -41,17 +41,46 @@ def __init__(self, config_path): def load_config(self, config_path): logging.info(f"Loading config from {config_path}") - with open(config_path, 'r') as file: - config = yaml.safe_load(file) - logging.info("Config loaded successfully") - return config + try: + with open(config_path, 'r') as file: + config = yaml.safe_load(file) + logging.info("Config loaded successfully") + return config + except FileNotFoundError: + logging.error(f"Config file not found: {config_path}") + raise + except yaml.YAMLError as e: + logging.error(f"Error parsing YAML file: {e}") + raise def load_dataset(self): - dataset_config = self.config['dataset'] - logging.info(f"Loading dataset from {dataset_config['path']}") - self.data = pd.read_csv(dataset_config['path'], delimiter=dataset_config['delimiter'], encoding='utf-8', encoding_errors='ignore') - logging.info("Dataset loaded successfully") - return self.data + dataset_config = self.config.get('dataset') + if dataset_config is None: + logging.error("Dataset configuration is missing from the config file.") + raise ValueError("Dataset configuration is missing from the config file.") + + dataset_path = dataset_config.get('path') + if dataset_path is None: + logging.error("Dataset path is missing from the dataset configuration.") + raise ValueError("Dataset path is missing from the dataset configuration.") + + logging.info(f"Loading dataset from {dataset_path}") + try: + self.data = pd.read_csv(dataset_path, delimiter=dataset_config['delimiter'], encoding='utf-8', encoding_errors='ignore') + logging.info("Dataset loaded successfully") + return self.data + except FileNotFoundError: + logging.error(f"Dataset file not found: {dataset_path}") + raise + except pd.errors.EmptyDataError: + logging.error("The dataset file is empty.") + raise + except pd.errors.ParserError: + logging.error("Error parsing the dataset file. It may be in an unsupported format.") + raise + except Exception as e: + logging.error(f"An unexpected error occurred: {e}") + raise class DataCleaner: def __init__(self, config):