The Python ML Cheat Sheet Repo You'll Actually Use
Every ML beginner hits the same wall: you know what you want to do, but you can't remember the exact syntax. Is it fit_transform or transform ? Which scaler do I use for outliers? How do I plot a confusion matrix again? I got tired of Googling the same things, so I built a repo that has all of it in one place. ๐ github.com/Kavi274/python-ml-cheatsheets What's Inside 9 cheat sheets covering theโฆ
This GitHub repository, Python-ML-CheatSheets, is a treasure trove for anyone learning machine learning. It contains nine comprehensive cheat sheets that cover every step of the ML process.
The foundation begins with NumPy, where you'll find guides on arrays, indexing, broadcasting, and linear algebra. For example, creating an array: `a = np.array([[1, 2, 3], [4, 5, 6]])`, and accessing specific elements: `a[a > 3]`, which returns `[4, 5, 6]`.
Pandas DataFrames follow, with functions like `groupby`, `merge`, and handling datetime and string operations. An example is summarizing sales and profit by city: `df.groupby('city').agg({'sales': 'sum', 'profit': 'mean'})`.
Scikit-learn's most popular models are cataloged here, along with pipelines for cross-validation and hyperparameter tuning. The repository provides ready-to-copy code for pipelines, such as:
```python
pipe = Pipeline([
('scaler', StandardScaler()),
('model', RandomForestClassifier())
])
pipe.fit(X_train, y_train)
```
Matplotlib and Seaborn are represented by visualizations like heatmaps and ROC curves, with copy-paste code provided.
The cheat sheet also covers data preprocessing, feature engineering including datetime features and SHAP-based selection, model evaluation with ROC, precision-recall curves, and calibration, and the basics of deep learning in Keras.
Lastly, there's a section on statistics for ML, from distributions and hypothesis testing to A/B testing and Bayes' theorem.
To use this resource, simply open any cheat sheet on GitHub and utilize the Ctrl+F function to find the needed information. If you prefer offline access, clone the repository with the command: `git clone https://github.com/Kavi274/python-ml-cheatsheets.git`.
The creator, Kavi, is open to contributions, especially for additional topics like PyTorch, XGBoost, LightGBM, time series, and HuggingFace Transformers. If this resource saves you from conducting Google searches, consider supporting the project by leaving a star on GitHub.
Written by urgent.news from Dev.to's reporting โ not their text. Machine-written โ may contain errors; check the original before relying on it.