{"id":16530628,"url":"https://github.com/smileexpression/los-angeles-crime","last_synced_at":"2026-05-18T02:03:49.498Z","repository":{"id":212623862,"uuid":"731903237","full_name":"smileexpression/Los-Angeles-Crime","owner":"smileexpression","description":"This experiment aims to predict crime in Los Angeles through machine learning methods.","archived":false,"fork":false,"pushed_at":"2024-01-16T05:03:05.000Z","size":17243,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T06:04:46.918Z","etag":null,"topics":["ipynb","logistic-regression","machine-learning","mlp","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smileexpression.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-12-15T06:39:54.000Z","updated_at":"2024-01-12T12:52:16.000Z","dependencies_parsed_at":"2024-11-14T04:48:31.080Z","dependency_job_id":"313fe415-58e5-4eaa-a581-2b5fd0dfab83","html_url":"https://github.com/smileexpression/Los-Angeles-Crime","commit_stats":null,"previous_names":["arronvague/los-angeles-crime","smileexpression/los-angeles-crime"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smileexpression%2FLos-Angeles-Crime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smileexpression%2FLos-Angeles-Crime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smileexpression%2FLos-Angeles-Crime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smileexpression%2FLos-Angeles-Crime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smileexpression","download_url":"https://codeload.github.com/smileexpression/Los-Angeles-Crime/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smileexpression%2FLos-Angeles-Crime/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259211830,"owners_count":22822378,"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":["ipynb","logistic-regression","machine-learning","mlp","python"],"created_at":"2024-10-11T18:06:42.223Z","updated_at":"2025-10-07T01:43:47.883Z","avatar_url":"https://github.com/smileexpression.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Los-Angeles-Crime\n\n机器学习实验课大作业\n\n## 环境\n\nPython 3.9.17\n\n## 数据集\n\n[Los Angeles Crime Data 2020-2023](https://www.kaggle.com/datasets/asaniczka/crimes-in-los-angeles-2020-2023/data)\n\n特征\n\n\u003e \"division_number\",\"date_reported\",\"date_occurred\",\"area\",\"area_name\",\"reporting_district\",\"part\",\"crime_code\",\"crime_description\",\"modus_operandi\",\"victim_age\",\"victim_sex\",\"victim_descent\",\"premise_code\",\"premise_description\",\"weapon_code\",\"weapon_description\",\"status\",\"status_description\",\"crime_code_1\",\"crime_code_2\",\"crime_code_3\",\"crime_code_4\",\"location\",\"cross_street\",\"latitude\",\"longitude\"\n\n“部门编号”、“报告日期”、“发生日期”、“区域”、“区域名称”、“报告地区”、“部分”、“犯罪代码”、“犯罪描述”、“作案方式”、“受害者年龄”、“受害者性别”、“受害者血统”、\"前提代码\"、\"前提描述\"、\"武器代码\"、\"武器描述\"、\"状态\"、\"状态描述\"、\"犯罪代码1\"、\"犯罪代码2\"、\"犯罪代码3\"、\"犯罪代码4\"、\"位置\"、\"交叉街道\"、\"纬度 “，“经度”\n\n## 分工\n\n1. 导包、导入数据集（照旧）\n\n2. clean data\n\n   - 这部分综合algorithms/data_clean.py和你MLTTest中对数据集的处理方式\n\n   - 删除不必要的信息，这几个是一定没有用的（至于这两个删除的顺序，训练结果差别应该不大）\n\n     ```python\n     # 删除没有用的列\n     data.drop(\n         [\n             \"division_number\",\n             \"date_reported\",\n             \"area_name\",\n             \"reporting_district\",\n             \"part\",\n             \"crime_description\",\n             \"modus_operandi\",\n             \"premise_description\",\n             \"weapon_description\",\n             \"status_description\",\n             \"crime_code_1\",\n             \"crime_code_2\",\n             \"crime_code_3\",\n             \"crime_code_4\",\n             \"cross_street\",\n         ],\n         axis=1,\n         inplace=True,\n     )\n     \n     # 删除存在缺失值的行\n     data.dropna(inplace=True)\n     ```\n\n   - 沿用get_usefulData_feature_label中的fill_the_blank，不再使用month_day、specific_time，改用month、day、hour、minute\n\n   - 所有LabelEncoder先不要做（留到[@Why-unable](https://github.com/Why-unable)做完数据可视化后再做）\n\n   - 全都放在data中（后续尽量不要修改data，使用copy()，也不用写入.csv文件了）\n\n3. Data Overview（还是[@ArronVague](https://github.com/ArronVague)做）\n\n4. [@Why-unable](https://github.com/Why-unable)的算法，再扯皮一下结果\n\n5. [@ArronVague](https://github.com/ArronVague)的算法及汇总\n\n## 特征选择\n\nmonth 月份（由date_occured拆分而来）\n\nday 日期（由date_occured拆分而来）\n\nhour（由date_occured拆分而来）\n\nminute（由date_occured拆分而来）\n\narea (area_name) 地区\n\nvictim_age 受害者年龄\n\nvictim_sex 受害者性别\n\nvictim_descent 受害者血统\n\nlatitude 纬度坐标\n\nlongitude 经度坐标\n\n## 标签\n\ncrime_code (crime_descroption) 犯罪描述（训练效果差）\n\npremise_code (premise_description) 遇害地点（如酒店、夜总会等）\n\nweapon_code (weapon_description) 武器（训练效果较好）\n\nstatus (status_descroption) 案件状态（训练效果好）\n\n## 没用的特征\n\n~~division_number 编号~~\n\n~~date_reported 报告日期~~\n\n~~reporting_district报告地点~~\n\n~~part 犯罪事件的部分号~~\n\n~~modus_operandi 作案手法~~\n\ncrime_code_1/2/3/4 犯罪编号\n\nlocation 详细地址\n\ncross_street 临近街道\n\n## 算法性能汇总\n\n|                     | crime_code | premise_code | weapon_code | status |\n| ------------------- | ---------- | ------------ | ----------- | ------ |\n| Logistic Regression | 0.28       | 0.27         | 0.54        | 0.61   |\n| MLP                 | 0.28       | 0.27         | 0.54        | 0.61   |\n| k-NN                | 0.22       | 0.22         | 0.47        | 0.51   |\n| Naive Bayes         | 0.03       | 0.02         | 0.04        | 0.23   |\n| Decision Tree       | 0.19       | 0.26         | 0.35        | 0.48   |\n| Classifier Chain    | 0.19       | 0.26         | 0.35        | 0.48   |\n\n## 参与贡献\n\n1. clone仓库\n2. 以main branch为基础new branch\n3. 在新建分支上编写代码\n4. commit代码到本地\n5. publish branch到仓库\n6. 创建pull request\n7. 经审核人员审核后merge到main branch\n\n## 贡献者\n\n[![GitHub contributors](https://img.shields.io/github/contributors/ArronVague/Los-Angeles-Crime.svg)](https://github.com/ArronVague/Los-Angeles-Crime/graphs/contributors)\n\n## 参考文献\n\n[Los Angeles Crime Data Quick EDA 🦹🏼‍♂️](https://www.kaggle.com/code/guslovesmath/los-angeles-crime-data-quick-eda)\n\n- 每个区域犯罪分布\n\n- 犯罪状态统计\n\n- 受害者血统\n\n- 区域\n\n[CrimeSolver Predictor](https://www.kaggle.com/code/safronov00/crimesolver-predictor#2.-Clean-Data)\n\n- data overview\n  - victim age\n  - monthly crime（准备做成365天的，不看年份）\n  - hour of the day\n  - victim sex and descent distribution\n  - top 10 crime descriptions and weapons used in crimes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmileexpression%2Flos-angeles-crime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmileexpression%2Flos-angeles-crime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmileexpression%2Flos-angeles-crime/lists"}