{"id":26984146,"url":"https://github.com/keshon/neural-data-classifier","last_synced_at":"2025-10-09T11:12:06.681Z","repository":{"id":183705171,"uuid":"670091967","full_name":"keshon/neural-data-classifier","owner":"keshon","description":"A playground to test brain.js classification based on various datasets","archived":false,"fork":false,"pushed_at":"2023-07-25T12:58:09.000Z","size":892,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T17:43:33.883Z","etag":null,"topics":["ai-learning","brainjs","classifier-training","ml","neural-network","training-neural-net"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keshon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-24T09:22:46.000Z","updated_at":"2023-07-25T13:01:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"586d20d4-dcde-4d3d-b369-812f1453d1d5","html_url":"https://github.com/keshon/neural-data-classifier","commit_stats":null,"previous_names":["keshon/neural-data-classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/keshon/neural-data-classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keshon%2Fneural-data-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keshon%2Fneural-data-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keshon%2Fneural-data-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keshon%2Fneural-data-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keshon","download_url":"https://codeload.github.com/keshon/neural-data-classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keshon%2Fneural-data-classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001290,"owners_count":26083058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-learning","brainjs","classifier-training","ml","neural-network","training-neural-net"],"created_at":"2025-04-03T17:34:50.932Z","updated_at":"2025-10-09T11:12:06.662Z","avatar_url":"https://github.com/keshon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Machine Learning with Brain.js - Research Project\n\nThis is a personal research project exploring the use of machine learning with Brain.js. The project focuses on the feature-label scenario and demonstrates how to train and test a neural network using Brain.js. Two differently formatted datasets are used, which are loaded into a common interface using attribute mapping to ensure consistent processing.\n\n## Documentation (doc folder)\n\nThe project includes a /doc folder, where you can find individual markdown files named after the source files. These files provide detailed information about the methods and interfaces present in each source file. This documentation aims to help to understand the purpose and usage of different functions and interfaces in the codebase.\n\n## Features\n\n-   Loading and preprocessing datasets from CSV files.\n-   Formatting datasets to a common feature-label map for training and testing.\n-   Training a neural network using Brain.js with configurable options.\n-   Testing the trained model with new data and obtaining prediction results.\n-   Outputting prediction results in a human-readable format.\n\n## Datasets\n\nTwo datasets with different formats are used in this project. These datasets are loaded and preprocessed using the provided tools to ensure compatibility with the neural network model. Attribute mapping is employed to convert the datasets into a common interface for easy processing.\n\n## Installation\n\nTo run this project, make sure you have Node.js and npm installed on your machine. Then, follow these steps:\n\n1. Clone this repository to your local machine.\n2. Navigate to the project directory in the terminal.\n3. Install the required dependencies using npm:\n\n```bash\nnpm install\n```\n\n## Usage\n\nThe project can be used to train a neural network with one of the datasets and then test the trained model with the other dataset. The command-line interface is used to trigger the training and testing processes.\n\n### Using the \"run.cmd\" wrapper (on Windows only)\n\nFor simplicity there is a wrapper named \"run.cmd\" that is provided to run the project. It wraps `ts-node src/__main__.ts` commands and accepts arguments.\n\n### Training\n\nTo train the neural network using one of the datasets, use the following command:\n\n```bash\nrun --train --dataset=\u003cdataset_number\u003e\n```\n\nReplace `\u003cdataset_number\u003e` with the dataset number you want to use for training (e.g., `01` or `02` - correspoding subfolders inside `/datasets`). The trained model and other intermediate files will be saved in the `/trained` directory.\n\nExample of training output:\n\n```\nrun --train --dataset=01\niterations: 100, training error: 0.005161096035617374\niterations: 200, training error: 0.005141267007658591\niterations: 300, training error: 0.005074350162723186\niterations: 400, training error: 0.004915941659087565\niterations: 500, training error: 0.00467786168269278\niterations: 600, training error: 0.004370577895463286\niterations: 700, training error: 0.004003078114147197\niterations: 800, training error: 0.00370858469302403\niterations: 900, training error: 0.0033748814914147714\niterations: 1000, training error: 0.0029539210783946675\nTraining completed. Model saved to: ./trained/01/model.json\nTraining complete using dataset file ./datasets/01/dataset.csv\n```\n\n### Testing\n\nTo test the trained model with the other dataset, use the following command:\n\n```bash\nrun --test --dataset=\u003cdataset_number\u003e\n```\n\nReplace `\u003cdataset_number\u003e` with the dataset number you want to use for testing (e.g., \"01\" or \"02\"). The testing results will be displayed in the terminal.\n\nExample of testing output:\n\n```\nrun --test --dataset=01\n========================\nLabel: carcinoma breast\nFeatures: mass in breast, mass of body structure, paresthesia, retropulsion, erythema, difficulty, lesion, estrogen use, burning sensation, dyspnea, swelling, formication\n------------------------\nPredicted Labels:\n------------------------\ncarcinoma breast            : 0.5013131 - 47.47%\nmalignant neoplasm of breast: 0.4962638 - 46.99%\nmyocardial infarction       : 0.0434024 - 4.11%\npneumonia aspiration        : 0.0061305 - 0.58%\ndelusion                    : 0.0040335 - 0.38%\nanxiety state               : 0.0030150 - 0.29%\nmelanoma                    : 0.0019802 - 0.19%\n========================\n\n========================\nLabel: hepatitis B\nFeatures: inappropriate affect, tachypnea, yellow sputum, projectile vomiting, poor feeding, pain abdominal, abdominal tenderness, wheelchair bound, moan\n------------------------\nPredicted Labels:\n------------------------\nhepatitis B   : 0.9908005 - 95.07%\ncholelithiasis: 0.0347123 - 3.33%\nkidney disease:\n\n 0.0167040 - 1.60%\n========================\n```\n\n### How to read it\n\n`Label` in the example is a name of the disease and `Features` are complete list of symptoms of that disease - it's our reference. By submitting this list (Features) to a trained model we expect to predict the very same Label that should match the reference one.\n\n## Credits\n\nThis project utilizes the following libraries:\n\n-   [Brain.js](https://github.com/BrainJS/brain.js) - A JavaScript library for building and training neural networks.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis project is intended for research and educational purposes and may not be suitable for production use. Use at your own risk.\n\n## Author\n\nMe and my new best friend ChatGPT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeshon%2Fneural-data-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeshon%2Fneural-data-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeshon%2Fneural-data-classifier/lists"}