{"id":23663273,"url":"https://github.com/aaalgieee/ml-finals","last_synced_at":"2025-06-21T08:35:26.261Z","repository":{"id":263451141,"uuid":"887794188","full_name":"aaalgieee/ML-finals","owner":"aaalgieee","description":"Finals Project for Machine Learning ELEC026","archived":true,"fork":false,"pushed_at":"2024-11-24T19:22:48.000Z","size":11879,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T13:54:34.482Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ml-finals.vercel.app","language":"Jupyter Notebook","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/aaalgieee.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-13T09:49:57.000Z","updated_at":"2025-02-26T15:21:01.000Z","dependencies_parsed_at":"2025-02-19T12:44:19.444Z","dependency_job_id":"cacd6105-e20a-4440-be4a-babb8f698ee7","html_url":"https://github.com/aaalgieee/ML-finals","commit_stats":null,"previous_names":["aaalgieee/ml-finals"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aaalgieee/ML-finals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaalgieee%2FML-finals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaalgieee%2FML-finals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaalgieee%2FML-finals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaalgieee%2FML-finals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaalgieee","download_url":"https://codeload.github.com/aaalgieee/ML-finals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaalgieee%2FML-finals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261094579,"owners_count":23108754,"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","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":[],"created_at":"2024-12-29T05:19:31.710Z","updated_at":"2025-06-21T08:35:21.248Z","avatar_url":"https://github.com/aaalgieee.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"Documentation\nBackend (main.py)\nImports: The script starts by importing necessary libraries such as Flask, numpy, PIL, pickle, sklearn, logging, pandas, joblib, tensorflow, cv2, and scipy. These libraries are used for web server functionality, data manipulation, machine learning, and image processing.\n\nFlask App Initialization: The Flask app is initialized and CORS is enabled to allow cross-origin requests.\n\nSVM Model:\n\nFunction load_svm_model_and_data: Loads the SVM model and preprocessed data from files.\nRoute /api/svm/predict: Handles POST requests to predict pneumonia from an uploaded image. The image is processed, resized, and normalized before being fed into the SVM model for prediction. The confidence score is calculated and returned along with the prediction.\nKNN Model:\n\nFunction load_knn_model_and_data: Loads the KNN model, label encoders, and scaler from files.\nRoute /api/knn/predict: Handles POST requests to predict diabetes risk based on input features. The input data is preprocessed, scaled, and fed into the KNN model for prediction. The prediction and scatter plot data are returned.\nLinear Regression Model:\n\nRoute /api/lr/predict: Handles POST requests to predict cardiovascular disease risk based on input features. The input data is preprocessed and fed into the linear regression model for prediction. The risk level and message are returned based on the prediction.\nANN Model:\n\nFunction load_label_encoder: Loads the label encoder from a file.\nFunction load_ann_model: Loads the ANN model and label encoder from files.\nRoute /api/ann/predict: Handles POST requests to predict brain tumor from an uploaded MRI image. The image is processed, resized, and normalized before being fed into the ANN model for prediction. If a tumor is detected, the tumor region is identified and returned along with the prediction.\nDecision Tree Model:\n\nFunction load_dt_model: Loads the decision tree model and label encoder from files.\nRoute /api/dt/predict: Handles POST requests to predict maternal health risk based on input features. The input data is preprocessed and fed into the decision tree model for prediction. The risk level and message are returned based on the prediction.\nNaive Bayes Model:\n\nFunction load_nb_model: Loads the Naive Bayes model and scaler from files.\nRoute /api/nb/predict: Handles POST requests to predict heart disease risk based on input features. The input data is preprocessed, scaled, and fed into the Naive Bayes model for prediction. The risk level, message, and risk factors are returned based on the prediction.\nHealth Check Route:\n\nRoute /api/health: Handles GET requests to check the health status of the server.\nMain Execution: The Flask app is configured to run on a specified port.\n\nFrontend (home-page.tsx and algorithm-test.tsx)\nImports: The script imports necessary libraries and components such as React, React Router, UI components, icons, and Chart.js.\n\nAlgorithm List: Defines a list of algorithms with their respective IDs, names, icons, descriptions, and input fields.\n\nPrediction Response Type: Defines the structure of the prediction response object.\n\nAlgorithmTest Component:\n\nState Initialization: Initializes state variables for the selected algorithm, input values, result, loading status, image file, and image preview.\nEffect Hook: Updates the selected algorithm and input fields based on the URL parameter.\nDropzone Configuration: Configures the dropzone for image upload.\nInput Change Handler: Updates the input values based on user input.\nForm Submission Handler: Handles form submission to send input data or image to the backend API for prediction. The response is processed and displayed to the user.\nRendering: Renders the algorithm test form with input fields or image upload based on the selected algorithm. Displays the prediction result after form submission.\n\nTraining Files\nSVM Training (svm.ipynb):\n\nImports: Imports necessary libraries for data manipulation, image processing, and machine learning.\nData Loading: Loads and preprocesses training and test data from image files.\nModel Training: Trains an SVM model on the preprocessed data.\nModel Evaluation: Evaluates the model's accuracy on the test data.\nModel Saving: Saves the trained model and data to files.\nNaive Bayes Training (nb.py):\n\nImports: Imports necessary libraries for data manipulation and machine learning.\nHeartDiseasePredictor Class: Defines a class for heart disease prediction using Naive Bayes. Includes methods for data validation, training, prediction, and model export.\nMain Execution: Trains the model on a dataset and tests prediction on sample data.\nLinear Regression Training (lr.ipynb):\n\nImports: Imports necessary libraries for data manipulation, machine learning, and visualization.\nData Loading: Loads and preprocesses the dataset.\nModel Training: Trains a linear regression model on the preprocessed data.\nModel Evaluation: Evaluates the model's performance on the test data.\nModel Saving: Saves the trained model to a file.\nKNN Training (knn.ipynb):\n\nImports: Imports necessary libraries for data manipulation and machine learning.\nData Loading: Loads and preprocesses the dataset.\nModel Training: Trains a KNN model on the preprocessed data.\nModel Evaluation: Evaluates the model's accuracy on the test data.\nModel Saving: Saves the trained model and preprocessing objects to files.\nDecision Tree Training (dt.py):\n\nImports: Imports necessary libraries for data manipulation and machine learning.\nData Loading: Loads and preprocesses the dataset.\nModel Training: Trains a decision tree model on the preprocessed data.\nModel Evaluation: Evaluates the model's accuracy on the test data.\nModel Saving: Saves the trained model and label encoder to files.\nANN Training (ann.py):\n\nImports: Imports necessary libraries for data manipulation, image processing, and deep learning.\nData Loading: Defines functions to load and preprocess image data.\nModel Creation: Defines a function to create an ANN model.\nMain Execution: Loads and preprocesses training and test data, creates and trains the ANN model, evaluates the model, and saves the trained model and label encoder to files.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaalgieee%2Fml-finals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaalgieee%2Fml-finals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaalgieee%2Fml-finals/lists"}