I am currently learning machine learning algorithms. Here, you will find a collection of examples that I have implemented during this learning journey. I hope these examples are interesting and helpful for you, dear visitor, and assist in better understanding the concepts.
- Random State
- Startify
- Missing Values
- PipeLine
- Column Transformer
- Confusion Matrix
- Roc Curve
- Encode Categorical Features
- Save & Load Model
- Grid Search
- Decision Tree
- Decision Tree Plots & Pruning Nodes
- Drop Binary
- Custom Transformer Function For Outlier Remove
- Create Balance & Inbalanced Syntethic_Data by make_classification
Here's a brief overview of some common scikit-learn models categorized by their purpose:
-
Logistic Regression: Used for binary classification problems.
from sklearn.linear_model import LogisticRegression
-
Decision Tree Classifier: A tree-based model for classification tasks.
from sklearn.tree import DecisionTreeClassifier
-
Random Forest Classifier: An ensemble of decision trees for better accuracy.
from sklearn.ensemble import RandomForestClassifier
-
Support Vector Machine (SVM): Effective for high-dimensional spaces.
from sklearn.svm import SVC
-
K-Nearest Neighbors (KNN): Classifies based on the closest training examples.
from sklearn.neighbors import KNeighborsClassifier
-
Gradient Boosting Classifier: An ensemble technique that builds models sequentially.
from sklearn.ensemble import GradientBoostingClassifier
-
Linear Regression: Models the relationship between a dependent variable and one or more independent variables.
from sklearn.linear_model import LinearRegression
-
Ridge Regression: A type of linear regression that includes L2 regularization.
from sklearn.linear_model import Ridge
-
Lasso Regression: Includes L1 regularization, which can lead to sparse solutions.
from sklearn.linear_model import Lasso
-
Decision Tree Regressor: For regression tasks using a decision tree.
from sklearn.tree import DecisionTreeRegressor
-
Random Forest Regressor: An ensemble method for regression based on decision trees.
from sklearn.ensemble import RandomForestRegressor
-
Gradient Boosting Regressor: Sequentially builds models to minimize error.
from sklearn.ensemble import GradientBoostingRegressor
-
K-Means Clustering: Partitions data into K distinct clusters.
from sklearn.cluster import KMeans
-
DBSCAN: Density-based clustering that identifies clusters of varying shapes.
from sklearn.cluster import DBSCAN
-
Agglomerative Clustering: A hierarchical clustering method.
from sklearn.cluster import AgglomerativeClustering
Don't forget about model evaluation techniques:
- Train/Test Split:
from sklearn.model_selection import train_test_split
- Cross-Validation:
from sklearn.model_selection import cross_val_score
- Metrics:
from sklearn.metrics import accuracy_score, mean_squared_error, classification_report, confusion_matrix
, etc.