{"id":16270697,"url":"https://github.com/jintao-huang/ml_alg","last_synced_at":"2025-09-02T09:31:07.474Z","repository":{"id":46584814,"uuid":"514537280","full_name":"Jintao-Huang/ml_alg","owner":"Jintao-Huang","description":"jintao的machine learning库","archived":false,"fork":false,"pushed_at":"2023-11-06T10:05:20.000Z","size":653,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-17T23:40:49.984Z","etag":null,"topics":["algorithm","data-structure","deep-learning","leetcode","machine-learning","metrics","mini-lightning","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Jintao-Huang.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}},"created_at":"2022-07-16T09:44:27.000Z","updated_at":"2024-06-29T03:30:05.000Z","dependencies_parsed_at":"2023-11-06T11:26:14.895Z","dependency_job_id":"b6ab70ac-d999-4e96-9110-433b81388384","html_url":"https://github.com/Jintao-Huang/ml_alg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jintao-Huang%2Fml_alg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jintao-Huang%2Fml_alg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jintao-Huang%2Fml_alg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jintao-Huang%2Fml_alg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jintao-Huang","download_url":"https://codeload.github.com/Jintao-Huang/ml_alg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231768726,"owners_count":18423791,"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":["algorithm","data-structure","deep-learning","leetcode","machine-learning","metrics","mini-lightning","pytorch"],"created_at":"2024-10-10T18:11:11.357Z","updated_at":"2024-12-29T17:54:10.132Z","avatar_url":"https://github.com/Jintao-Huang.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ML-ALG\n![Python Version](https://img.shields.io/badge/python-%E2%89%A53.8-5be.svg)\n![Pytorch Version](https://img.shields.io/badge/pytorch-%E2%89%A51.12%20%7C%20%E2%89%A52.0-orange.svg)\n[![License](https://img.shields.io/badge/License-MIT-yellowgreen.svg)](https://github.com/Jintao-Huang/ml_alg/blob/main/LICENSE)\n\n\n## Introduction\n1. 这个仓库是一个机器学习算法, 传统算法的集成库, 现在主要是自己在使用. 所在文件夹为`libs/`, 下面将会介绍各个文件的用途.\n\n\n## 文件功能介绍\n1. mini_lightning部分, 现已移置: [https://github.com/ustcml/mini-lightning](https://github.com/ustcml/mini-lightning)\n   1. 含: `mini-lightning`轻量级的深度学习训练框架. \n   2. 含: Examples: cv, nlp, dqn, gan, contrastive_learning, gnn, ae, vae; ddp等.\n2. leetcode-alg部分: 现已移置: [https://github.com/Jintao-Huang/LeetCode-Py](https://github.com/Jintao-Huang/LeetCode-Py)\n   1. 含: `leetcode-alg`数据结构和算法库\n   2. 含: 基于`leetcode-alg`的leetcode(python)题目的解答\n3. `libs/ml/_ml_alg/*`: 机器学习中的算法实现\n   1. `_metrics.py`: ml中的metrics的torch实现. (faster than `torchmetrics.functional`, `sklearn`, 使用torch实现, 支持cuda加速)\n      1. 含accuracy, confusion_matrix, precision, recall, f1_score, fbeta_score, PR_curve, AP, roc_curve, AUC, r2_score, cosine_similarity, euclidean_distance, kl_divergence, pearson_corrcoef, spearman_corrcoef.\n   2. `_nn_functional.py`: 实现torch.nn.functional包中的算法. (没啥实用性, 用于学习)\n      1. 含激活函数, 损失, batch_norm, layer_norm, dropout, linear, conv2d, conv_transpose2d, conv1d, avg_pool2d, max_pool2d, rnn_relu_cell, rnn_tanh_cell, lstm_cell, gru_cell, multi-head attention, interpolate(nearest, bilinear), adaptive_avg_pool2d, adaptive_max_pool2d.\n   3. `_ml_alg.py`: 传统ml算法的torch实现 (faster than `sklearn`, 支持cuda加速). (开发中...)\n      1. 含归一化方法, LinearRegression, Ridge, LogisticRegression, PCA, KMeans, NearestNeighbors等\n   4. `_optim_functional.py`: 优化器的实现. (没啥实用性, 用于学习)\n      1. 含sgd, adam, adamw.\n   5. `_tvt_functional_tensor.py`: torchvision.transforms._functional_tensor的实现. (没啥实用性, 用于学习)\n      1. 含: to_tensor, normalize, pad, hflip, vflip, rgb_to_grayscale, crop, center_crop, resize, resized_crop, adjust_brightness, adjust_contrast, adjust_saturation, adjust_hue, rotate, affine\n   6. `_tvt_functional.py`: torchvision.transforms.functional; torchvision.transforms的实现. (没啥实用性, 用于学习)\n      1. 含: random_horizontal_flip, random_resized_crop...\n   7. `_linalg.py`: 线性代数算法. (没啥实用性, 用于学习)\n      1. 含pinv, solve, lstsq, cholesky_solve, lu_solve等\n   8. `_functional/*`: 一些torch的函数实现. (没啥实用性, 用于学习)\n      1. 含logsumexp, softmax, var, cov, corrcoef, bincount, unique_consecutive\n      2. 含div, fmod, remainder\n   9. `_rand.py`: (没啥实用性, 用于学习)\n      1. 含normal, uniform, randperm, multivariate_normal\n   10. `_pygnn_functional.py`: 图网络的实现. (开发中...)\n   11. `_class_impl/`: pytorch的常见base类: Module, Optimizer, _LRScheduler的简化版\n4. `libs/alg_fast/*`: 传统算法库的numba/cython版本 (开发中...)\n5. `examples/*`: 一些代表性的examples \n6. `libs/_plt/*`, 可视化的库. \n   1. `_2d.py`: \n      1. 含plot, scatter, imshow, hist, bar, text, contour等.\n      2. 含config_ax, config_plt, config_fig等.\n   2. `_3d.py`\n7. `libs/ml/`\n   1. `_pd/*`: torch pandas库. (开发中)\n   2. `_models`: 一些模型的实现. \n8. `libs/utils/*`: 一些工具函数的实现\n\n\n\n## Installation and Use\n```bash\n# Installation\n# 下载仓库到本地, 进入setup.py所在文件夹. 输入以下命令即可(会自动安装依赖, pytorch请手动安装, 避免cuda版本不匹配)\npip install -e .\n```\n\n```python\n# Use\nfrom libs import *\n```\n\n\n## TODO\n1. tvtF: adjust_hue; rotate; affine\n2. pyg: pygnn的函数","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjintao-huang%2Fml_alg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjintao-huang%2Fml_alg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjintao-huang%2Fml_alg/lists"}