{"id":26060452,"url":"https://github.com/pramodyasahan/car-safe-predictor","last_synced_at":"2026-04-10T12:05:12.794Z","repository":{"id":213091271,"uuid":"732995776","full_name":"pramodyasahan/car-safe-predictor","owner":"pramodyasahan","description":"This repository contains a machine learning project that applies the K-Nearest Neighbors (KNN) classification algorithm to predict car safety ratings. The project uses a dataset of cars, with features such as buying price, maintenance cost, number of doors, persons, lug boot size, and safety.","archived":false,"fork":false,"pushed_at":"2023-12-18T11:01:31.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T14:08:18.497Z","etag":null,"topics":["classification","k-nearest-neighbours","machine-learning","numpy","pandas","scikit-learn"],"latest_commit_sha":null,"homepage":"","language":"Python","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/pramodyasahan.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}},"created_at":"2023-12-18T10:28:39.000Z","updated_at":"2023-12-18T11:02:36.000Z","dependencies_parsed_at":"2023-12-18T11:54:08.636Z","dependency_job_id":"672515ef-5a7a-4ee0-bb38-2644539774d8","html_url":"https://github.com/pramodyasahan/car-safe-predictor","commit_stats":null,"previous_names":["pramodyasahan/car-safe-predictor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pramodyasahan/car-safe-predictor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Fcar-safe-predictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Fcar-safe-predictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Fcar-safe-predictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Fcar-safe-predictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pramodyasahan","download_url":"https://codeload.github.com/pramodyasahan/car-safe-predictor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pramodyasahan%2Fcar-safe-predictor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31641493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["classification","k-nearest-neighbours","machine-learning","numpy","pandas","scikit-learn"],"created_at":"2025-03-08T14:08:21.920Z","updated_at":"2026-04-10T12:05:12.772Z","avatar_url":"https://github.com/pramodyasahan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n---\n\n# Car Safety Rating Prediction using K-Nearest Neighbors\n\n## Overview\nThis repository contains a machine learning project that applies the K-Nearest Neighbors (KNN) classification algorithm to predict car safety ratings. The project uses a dataset of cars, with features such as buying price, maintenance cost, number of doors, persons, lug boot size, and safety. The goal is to accurately predict the safety rating of a car based on these features.\n\n## Dataset\nThe dataset used in this project is named `car.csv`. It consists of various car attributes, including:\n- Buying price\n- Maintenance cost\n- Number of doors\n- Number of persons the car can accommodate\n- Size of the luggage boot\n- Safety rating\n\nThe target variable is the safety rating of the car.\n\n## Methodology\n\n### Data Preprocessing\n- **OneHotEncoding**: Categorical variables in the dataset are transformed into a format that can be provided to the machine learning algorithm.\n- **Label Encoding**: The target variable (safety rating) is encoded from string labels to integers.\n\n### Model Training\n- **K-Nearest Neighbors Classifier**: The KNN algorithm is used for classification, with `n_neighbors=5` and `metric='minkowski'`.\n- **Training and Testing**: The dataset is split into training and testing sets, with 80% of the data used for training and 20% for testing.\n\n### Model Evaluation\n- **Confusion Matrix**: Used to evaluate the accuracy of the classification.\n- **Accuracy Score**: Calculates the proportion of correctly predicted instances.\n\n## Requirements\n- Python 3.x\n- Pandas\n- NumPy\n- scikit-learn\n\n## Usage\n1. Clone the repository.\n2. Run the script using a Python interpreter.\n3. The script will train the KNN model on the training set and evaluate its performance on the test set.\n\n## Results\n- The output of the script includes the predictions made by the model, a confusion matrix, and the accuracy score.\n- These results help in understanding the effectiveness of the KNN algorithm in classifying car safety ratings based on given features.\n\n## Contributing\nContributions to this project are welcome. Feel free to fork the repository, add improvements, and submit a pull request.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramodyasahan%2Fcar-safe-predictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpramodyasahan%2Fcar-safe-predictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramodyasahan%2Fcar-safe-predictor/lists"}