From caee7225fbeeeab68707bcfe8602752416a83360 Mon Sep 17 00:00:00 2001 From: Ankita Mishra Date: Mon, 6 Oct 2025 10:31:50 -0500 Subject: [PATCH 1/7] Added Adaboost algorithm --- machine_learning/adaboost.py | 71 ++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 machine_learning/adaboost.py diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py new file mode 100644 index 000000000000..b31ede2651c9 --- /dev/null +++ b/machine_learning/adaboost.py @@ -0,0 +1,71 @@ + +import numpy as np + +# AdaBoost implementation for binary classification +# Uses decision stumps (one-level trees) as weak learners +class AdaBoost: + def __init__(self, n_estimators=50): + # Number of boosting rounds + self.n_estimators = n_estimators + self.alphas = [] # Weights for each weak learner + self.models = [] # List of weak learners (stumps) + + def fit(self, X, y): + # X: (n_samples, n_features), y: (n_samples,) with labels 0 or 1 + n_samples, n_features = X.shape + w = np.ones(n_samples) / n_samples # Initialize sample weights + self.models = [] + self.alphas = [] + y_ = np.where(y == 0, -1, 1) # Convert labels to -1, 1 + for _ in range(self.n_estimators): + # Train a decision stump with weighted samples + stump = self._build_stump(X, y_, w) + pred = stump['pred'] + err = stump['error'] + # Compute alpha (learner weight) + alpha = 0.5 * np.log((1 - err) / (err + 1e-10)) + # Update sample weights + w *= np.exp(-alpha * y_ * pred) + w /= np.sum(w) + self.models.append(stump) + self.alphas.append(alpha) + + def predict(self, X): + # Aggregate predictions from all weak learners + clf_preds = np.zeros(X.shape[0]) + for alpha, stump in zip(self.alphas, self.models): + pred = self._stump_predict(X, stump['feature'], stump['threshold'], stump['polarity']) + clf_preds += alpha * pred + # Return final prediction (majority vote) + return np.where(clf_preds >= 0, 1, 0) + + def _build_stump(self, X, y, w): + # Find the best decision stump for current weights + n_samples, n_features = X.shape + min_error = float('inf') + best_stump = {} + for feature in range(n_features): + thresholds = np.unique(X[:, feature]) + for threshold in thresholds: + for polarity in [1, -1]: + pred = self._stump_predict(X, feature, threshold, polarity) + error = np.sum(w * (pred != y)) + if error < min_error: + min_error = error + best_stump = { + 'feature': feature, + 'threshold': threshold, + 'polarity': polarity, + 'error': error, + 'pred': pred.copy() + } + return best_stump + + def _stump_predict(self, X, feature, threshold, polarity): + # Predict using a single decision stump + pred = np.ones(X.shape[0]) + if polarity == 1: + pred[X[:, feature] < threshold] = -1 + else: + pred[X[:, feature] > threshold] = -1 + return pred From 851be66222e3d7e8b1cc0d9823e2dbe0a960cd2d Mon Sep 17 00:00:00 2001 From: Ankita Mishra Date: Mon, 6 Oct 2025 10:43:54 -0500 Subject: [PATCH 2/7] Added Adaboost algorithm --- machine_learning/adaboost.py | 89 +++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 26 deletions(-) diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py index b31ede2651c9..96369c812de3 100644 --- a/machine_learning/adaboost.py +++ b/machine_learning/adaboost.py @@ -1,17 +1,37 @@ +""" +AdaBoost implementation for binary classification using decision stumps. + +Reference: https://en.wikipedia.org/wiki/AdaBoost + +>>> import numpy as np +>>> X = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) +>>> y = np.array([0, 1, 1, 0]) +>>> clf = AdaBoost(n_estimators=5) +>>> clf.fit(X, y) +>>> clf.predict(np.array([[0, 0], [1, 1]])) +array([0, 1]) +""" import numpy as np +from typing import Any, Dict, List + -# AdaBoost implementation for binary classification -# Uses decision stumps (one-level trees) as weak learners class AdaBoost: - def __init__(self, n_estimators=50): - # Number of boosting rounds - self.n_estimators = n_estimators - self.alphas = [] # Weights for each weak learner - self.models = [] # List of weak learners (stumps) + def __init__(self, n_estimators: int = 50) -> None: + """Initialize AdaBoost classifier. + Args: + n_estimators: Number of boosting rounds. + """ + self.n_estimators: int = n_estimators + self.alphas: List[float] = [] # Weights for each weak learner + self.models: List[Dict[str, Any]] = [] # List of weak learners (stumps) - def fit(self, X, y): - # X: (n_samples, n_features), y: (n_samples,) with labels 0 or 1 + def fit(self, X: np.ndarray, y: np.ndarray) -> None: + """Fit AdaBoost model. + Args: + X: (n_samples, n_features) feature matrix + y: (n_samples,) labels (0 or 1) + """ n_samples, n_features = X.shape w = np.ones(n_samples) / n_samples # Initialize sample weights self.models = [] @@ -20,8 +40,8 @@ def fit(self, X, y): for _ in range(self.n_estimators): # Train a decision stump with weighted samples stump = self._build_stump(X, y_, w) - pred = stump['pred'] - err = stump['error'] + pred = stump["pred"] + err = stump["error"] # Compute alpha (learner weight) alpha = 0.5 * np.log((1 - err) / (err + 1e-10)) # Update sample weights @@ -30,20 +50,35 @@ def fit(self, X, y): self.models.append(stump) self.alphas.append(alpha) - def predict(self, X): - # Aggregate predictions from all weak learners + def predict(self, X: np.ndarray) -> np.ndarray: + """Predict class labels for samples in X. + Args: + X: (n_samples, n_features) feature matrix + Returns: + (n_samples,) predicted labels (0 or 1) + >>> import numpy as np + >>> X = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) + >>> y = np.array([0, 1, 1, 0]) + >>> clf = AdaBoost(n_estimators=5) + >>> clf.fit(X, y) + >>> clf.predict(np.array([[0, 0], [1, 1]])) + array([0, 1]) + """ clf_preds = np.zeros(X.shape[0]) for alpha, stump in zip(self.alphas, self.models): - pred = self._stump_predict(X, stump['feature'], stump['threshold'], stump['polarity']) + pred = self._stump_predict( + X, stump["feature"], stump["threshold"], stump["polarity"] + ) clf_preds += alpha * pred - # Return final prediction (majority vote) return np.where(clf_preds >= 0, 1, 0) - def _build_stump(self, X, y, w): - # Find the best decision stump for current weights + def _build_stump( + self, X: np.ndarray, y: np.ndarray, w: np.ndarray + ) -> Dict[str, Any]: + """Find the best decision stump for current weights.""" n_samples, n_features = X.shape - min_error = float('inf') - best_stump = {} + min_error = float("inf") + best_stump: Dict[str, Any] = {} for feature in range(n_features): thresholds = np.unique(X[:, feature]) for threshold in thresholds: @@ -53,16 +88,18 @@ def _build_stump(self, X, y, w): if error < min_error: min_error = error best_stump = { - 'feature': feature, - 'threshold': threshold, - 'polarity': polarity, - 'error': error, - 'pred': pred.copy() + "feature": feature, + "threshold": threshold, + "polarity": polarity, + "error": error, + "pred": pred.copy(), } return best_stump - def _stump_predict(self, X, feature, threshold, polarity): - # Predict using a single decision stump + def _stump_predict( + self, X: np.ndarray, feature: int, threshold: float, polarity: int + ) -> np.ndarray: + """Predict using a single decision stump.""" pred = np.ones(X.shape[0]) if polarity == 1: pred[X[:, feature] < threshold] = -1 From 6f801ac806c5501d52a13676bdd2b522e98931a2 Mon Sep 17 00:00:00 2001 From: Ankita Mishra Date: Mon, 6 Oct 2025 10:51:22 -0500 Subject: [PATCH 3/7] Added Adaboost algorithm --- machine_learning/adaboost.py | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py index 96369c812de3..44cd2ea51373 100644 --- a/machine_learning/adaboost.py +++ b/machine_learning/adaboost.py @@ -4,10 +4,10 @@ Reference: https://en.wikipedia.org/wiki/AdaBoost >>> import numpy as np ->>> X = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) ->>> y = np.array([0, 1, 1, 0]) +>>> features = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) +>>> labels = np.array([0, 1, 1, 0]) >>> clf = AdaBoost(n_estimators=5) ->>> clf.fit(X, y) +>>> clf.fit(features, labels) >>> clf.predict(np.array([[0, 0], [1, 1]])) array([0, 1]) """ @@ -26,65 +26,65 @@ def __init__(self, n_estimators: int = 50) -> None: self.alphas: List[float] = [] # Weights for each weak learner self.models: List[Dict[str, Any]] = [] # List of weak learners (stumps) - def fit(self, X: np.ndarray, y: np.ndarray) -> None: + def fit(self, feature_matrix: np.ndarray, target: np.ndarray) -> None: """Fit AdaBoost model. Args: - X: (n_samples, n_features) feature matrix - y: (n_samples,) labels (0 or 1) + feature_matrix: (n_samples, n_features) feature matrix + target: (n_samples,) labels (0 or 1) """ - n_samples, n_features = X.shape - w = np.ones(n_samples) / n_samples # Initialize sample weights + n_samples, n_features = feature_matrix.shape + sample_weights = np.ones(n_samples) / n_samples # Initialize sample weights self.models = [] self.alphas = [] - y_ = np.where(y == 0, -1, 1) # Convert labels to -1, 1 + y_signed = np.where(target == 0, -1, 1) # Convert labels to -1, 1 for _ in range(self.n_estimators): # Train a decision stump with weighted samples - stump = self._build_stump(X, y_, w) + stump = self._build_stump(feature_matrix, y_signed, sample_weights) pred = stump["pred"] err = stump["error"] # Compute alpha (learner weight) alpha = 0.5 * np.log((1 - err) / (err + 1e-10)) # Update sample weights - w *= np.exp(-alpha * y_ * pred) - w /= np.sum(w) + sample_weights *= np.exp(-alpha * y_signed * pred) + sample_weights /= np.sum(sample_weights) self.models.append(stump) self.alphas.append(alpha) - def predict(self, X: np.ndarray) -> np.ndarray: - """Predict class labels for samples in X. + def predict(self, feature_matrix: np.ndarray) -> np.ndarray: + """Predict class labels for samples in feature_matrix. Args: - X: (n_samples, n_features) feature matrix + feature_matrix: (n_samples, n_features) feature matrix Returns: (n_samples,) predicted labels (0 or 1) >>> import numpy as np - >>> X = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) - >>> y = np.array([0, 1, 1, 0]) + >>> features = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) + >>> labels = np.array([0, 1, 1, 0]) >>> clf = AdaBoost(n_estimators=5) - >>> clf.fit(X, y) + >>> clf.fit(features, labels) >>> clf.predict(np.array([[0, 0], [1, 1]])) array([0, 1]) """ - clf_preds = np.zeros(X.shape[0]) + clf_preds = np.zeros(feature_matrix.shape[0]) for alpha, stump in zip(self.alphas, self.models): pred = self._stump_predict( - X, stump["feature"], stump["threshold"], stump["polarity"] + feature_matrix, stump["feature"], stump["threshold"], stump["polarity"] ) clf_preds += alpha * pred return np.where(clf_preds >= 0, 1, 0) def _build_stump( - self, X: np.ndarray, y: np.ndarray, w: np.ndarray + self, feature_matrix: np.ndarray, target_signed: np.ndarray, sample_weights: np.ndarray ) -> Dict[str, Any]: """Find the best decision stump for current weights.""" - n_samples, n_features = X.shape + n_samples, n_features = feature_matrix.shape min_error = float("inf") best_stump: Dict[str, Any] = {} for feature in range(n_features): - thresholds = np.unique(X[:, feature]) + thresholds = np.unique(feature_matrix[:, feature]) for threshold in thresholds: for polarity in [1, -1]: - pred = self._stump_predict(X, feature, threshold, polarity) - error = np.sum(w * (pred != y)) + pred = self._stump_predict(feature_matrix, feature, threshold, polarity) + error = np.sum(sample_weights * (pred != target_signed)) if error < min_error: min_error = error best_stump = { @@ -97,12 +97,12 @@ def _build_stump( return best_stump def _stump_predict( - self, X: np.ndarray, feature: int, threshold: float, polarity: int + self, feature_matrix: np.ndarray, feature: int, threshold: float, polarity: int ) -> np.ndarray: """Predict using a single decision stump.""" - pred = np.ones(X.shape[0]) + pred = np.ones(feature_matrix.shape[0]) if polarity == 1: - pred[X[:, feature] < threshold] = -1 + pred[feature_matrix[:, feature] < threshold] = -1 else: - pred[X[:, feature] > threshold] = -1 + pred[feature_matrix[:, feature] > threshold] = -1 return pred From 6233abcb6c2c3a8a53d6f6be3d5031f67d507ece Mon Sep 17 00:00:00 2001 From: Ankita Mishra Date: Mon, 6 Oct 2025 12:02:58 -0500 Subject: [PATCH 4/7] Fixing and Updating Adaboost algorithm --- machine_learning/adaboost.py | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py index 44cd2ea51373..6dcea729e5ed 100644 --- a/machine_learning/adaboost.py +++ b/machine_learning/adaboost.py @@ -13,7 +13,7 @@ """ import numpy as np -from typing import Any, Dict, List +from typing import Any class AdaBoost: @@ -23,8 +23,8 @@ def __init__(self, n_estimators: int = 50) -> None: n_estimators: Number of boosting rounds. """ self.n_estimators: int = n_estimators - self.alphas: List[float] = [] # Weights for each weak learner - self.models: List[Dict[str, Any]] = [] # List of weak learners (stumps) + self.alphas: list[float] = [] # Weights for each weak learner + self.models: list[dict[str, Any]] = [] # List of weak learners (stumps) def fit(self, feature_matrix: np.ndarray, target: np.ndarray) -> None: """Fit AdaBoost model. @@ -32,19 +32,16 @@ def fit(self, feature_matrix: np.ndarray, target: np.ndarray) -> None: feature_matrix: (n_samples, n_features) feature matrix target: (n_samples,) labels (0 or 1) """ - n_samples, n_features = feature_matrix.shape - sample_weights = np.ones(n_samples) / n_samples # Initialize sample weights + n_samples, _ = feature_matrix.shape + sample_weights = np.ones(n_samples) / n_samples self.models = [] self.alphas = [] - y_signed = np.where(target == 0, -1, 1) # Convert labels to -1, 1 + y_signed = np.where(target == 0, -1, 1) for _ in range(self.n_estimators): - # Train a decision stump with weighted samples stump = self._build_stump(feature_matrix, y_signed, sample_weights) pred = stump["pred"] err = stump["error"] - # Compute alpha (learner weight) alpha = 0.5 * np.log((1 - err) / (err + 1e-10)) - # Update sample weights sample_weights *= np.exp(-alpha * y_signed * pred) sample_weights /= np.sum(sample_weights) self.models.append(stump) @@ -56,13 +53,6 @@ def predict(self, feature_matrix: np.ndarray) -> np.ndarray: feature_matrix: (n_samples, n_features) feature matrix Returns: (n_samples,) predicted labels (0 or 1) - >>> import numpy as np - >>> features = np.array([[0, 0], [1, 1], [1, 0], [0, 1]]) - >>> labels = np.array([0, 1, 1, 0]) - >>> clf = AdaBoost(n_estimators=5) - >>> clf.fit(features, labels) - >>> clf.predict(np.array([[0, 0], [1, 1]])) - array([0, 1]) """ clf_preds = np.zeros(feature_matrix.shape[0]) for alpha, stump in zip(self.alphas, self.models): @@ -73,12 +63,15 @@ def predict(self, feature_matrix: np.ndarray) -> np.ndarray: return np.where(clf_preds >= 0, 1, 0) def _build_stump( - self, feature_matrix: np.ndarray, target_signed: np.ndarray, sample_weights: np.ndarray - ) -> Dict[str, Any]: + self, + feature_matrix: np.ndarray, + target_signed: np.ndarray, + sample_weights: np.ndarray, + ) -> dict[str, Any]: """Find the best decision stump for current weights.""" - n_samples, n_features = feature_matrix.shape + _, n_features = feature_matrix.shape min_error = float("inf") - best_stump: Dict[str, Any] = {} + best_stump: dict[str, Any] = {} for feature in range(n_features): thresholds = np.unique(feature_matrix[:, feature]) for threshold in thresholds: @@ -105,4 +98,4 @@ def _stump_predict( pred[feature_matrix[:, feature] < threshold] = -1 else: pred[feature_matrix[:, feature] > threshold] = -1 - return pred + return pred \ No newline at end of file From 08d53bc49530e3081717e244b17a8b16e47658be Mon Sep 17 00:00:00 2001 From: Ankita Mishra Date: Mon, 6 Oct 2025 12:14:36 -0500 Subject: [PATCH 5/7] Fixing and Updating Adaboost algorithm --- machine_learning/adaboost.py | 90 +++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 17 deletions(-) diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py index 6dcea729e5ed..69dd5f44265d 100644 --- a/machine_learning/adaboost.py +++ b/machine_learning/adaboost.py @@ -12,54 +12,83 @@ array([0, 1]) """ -import numpy as np from typing import Any +import numpy as np + class AdaBoost: def __init__(self, n_estimators: int = 50) -> None: - """Initialize AdaBoost classifier. + """ + Initialize AdaBoost classifier. + Args: - n_estimators: Number of boosting rounds. + n_estimators: Number of boosting rounds (weak learners). """ self.n_estimators: int = n_estimators - self.alphas: list[float] = [] # Weights for each weak learner - self.models: list[dict[str, Any]] = [] # List of weak learners (stumps) + self.alphas: list[float] = [] # Weights assigned to each weak learner + self.models: list[dict[str, Any]] = [] # Stores each decision stump def fit(self, feature_matrix: np.ndarray, target: np.ndarray) -> None: - """Fit AdaBoost model. + """ + Train AdaBoost model using decision stumps. + Args: - feature_matrix: (n_samples, n_features) feature matrix - target: (n_samples,) labels (0 or 1) + feature_matrix: 2D array of shape (n_samples, n_features) + target: 1D array of binary labels (0 or 1) """ n_samples, _ = feature_matrix.shape + + # Initialize uniform sample weights sample_weights = np.ones(n_samples) / n_samples + + # Reset model state self.models = [] self.alphas = [] + + # Convert labels to {-1, 1} for boosting y_signed = np.where(target == 0, -1, 1) + for _ in range(self.n_estimators): + # Train a weighted decision stump stump = self._build_stump(feature_matrix, y_signed, sample_weights) pred = stump["pred"] err = stump["error"] + + # Compute alpha (learner weight) with numerical stability alpha = 0.5 * np.log((1 - err) / (err + 1e-10)) + + # Update sample weights to focus on misclassified points sample_weights *= np.exp(-alpha * y_signed * pred) sample_weights /= np.sum(sample_weights) + + # Store the stump and its weight self.models.append(stump) self.alphas.append(alpha) def predict(self, feature_matrix: np.ndarray) -> np.ndarray: - """Predict class labels for samples in feature_matrix. + """ + Predict binary class labels for input samples. + Args: - feature_matrix: (n_samples, n_features) feature matrix + feature_matrix: 2D array of shape (n_samples, n_features) + Returns: - (n_samples,) predicted labels (0 or 1) + 1D array of predicted labels (0 or 1) """ clf_preds = np.zeros(feature_matrix.shape[0]) + + # Aggregate predictions from all stumps for alpha, stump in zip(self.alphas, self.models): pred = self._stump_predict( - feature_matrix, stump["feature"], stump["threshold"], stump["polarity"] + feature_matrix, + stump["feature"], + stump["threshold"], + stump["polarity"], ) clf_preds += alpha * pred + + # Final prediction: sign of weighted sum return np.where(clf_preds >= 0, 1, 0) def _build_stump( @@ -68,16 +97,30 @@ def _build_stump( target_signed: np.ndarray, sample_weights: np.ndarray, ) -> dict[str, Any]: - """Find the best decision stump for current weights.""" + """ + Build the best decision stump for current sample weights. + + Returns: + Dictionary containing stump parameters and predictions. + """ _, n_features = feature_matrix.shape min_error = float("inf") best_stump: dict[str, Any] = {} + + # Iterate over all features and thresholds for feature in range(n_features): thresholds = np.unique(feature_matrix[:, feature]) for threshold in thresholds: for polarity in [1, -1]: - pred = self._stump_predict(feature_matrix, feature, threshold, polarity) + pred = self._stump_predict( + feature_matrix, + feature, + threshold, + polarity, + ) error = np.sum(sample_weights * (pred != target_signed)) + + # Keep stump with lowest weighted error if error < min_error: min_error = error best_stump = { @@ -87,15 +130,28 @@ def _build_stump( "error": error, "pred": pred.copy(), } + return best_stump def _stump_predict( - self, feature_matrix: np.ndarray, feature: int, threshold: float, polarity: int + self, + feature_matrix: np.ndarray, + feature: int, + threshold: float, + polarity: int, ) -> np.ndarray: - """Predict using a single decision stump.""" + """ + Predict using a single decision stump. + + Returns: + 1D array of predictions in {-1, 1} + """ pred = np.ones(feature_matrix.shape[0]) + + # Apply polarity to threshold comparison if polarity == 1: pred[feature_matrix[:, feature] < threshold] = -1 else: pred[feature_matrix[:, feature] > threshold] = -1 - return pred \ No newline at end of file + + return pred From 32ce8883974884cb4bcdc7f6852f1a6e98c43112 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 17:15:09 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- machine_learning/adaboost.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/machine_learning/adaboost.py b/machine_learning/adaboost.py index 69dd5f44265d..39c2a8341a8c 100644 --- a/machine_learning/adaboost.py +++ b/machine_learning/adaboost.py @@ -113,11 +113,11 @@ def _build_stump( for threshold in thresholds: for polarity in [1, -1]: pred = self._stump_predict( - feature_matrix, - feature, - threshold, - polarity, - ) + feature_matrix, + feature, + threshold, + polarity, + ) error = np.sum(sample_weights * (pred != target_signed)) # Keep stump with lowest weighted error From bec9a358317372b6da8ede71f8604e6cf067ecf4 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 14 Sep 2026 05:10:55 +0000 Subject: [PATCH 7/7] updating DIRECTORY.md --- DIRECTORY.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index 311a7c7c9de8..d8ee90c9e013 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -685,6 +685,7 @@ * [Simplex](linear_programming/simplex.py) ## [Machine Learning](machine_learning) + * [Adaboost](machine_learning/adaboost.py) * [Apriori Algorithm](machine_learning/apriori_algorithm.py) * [Astar](machine_learning/astar.py) * [Automatic Differentiation](machine_learning/automatic_differentiation.py) @@ -712,14 +713,17 @@ * [Loss Functions](machine_learning/loss_functions.py) * Lstm * [Lstm Prediction](machine_learning/lstm/lstm_prediction.py) + * [Mean Shift](machine_learning/mean_shift.py) * [Mfcc](machine_learning/mfcc.py) * [Mini Batch Gradient Descent](machine_learning/mini_batch_gradient_descent.py) * [Multilayer Perceptron Classifier](machine_learning/multilayer_perceptron_classifier.py) + * [Naive Bayes Text Classification](machine_learning/naive_bayes_text_classification.py) * [Polynomial Regression](machine_learning/polynomial_regression.py) * [Principle Component Analysis](machine_learning/principle_component_analysis.py) * [Q Learning](machine_learning/q_learning.py) * [Random Forest Classifier](machine_learning/random_forest_classifier.py) * [Random Forest Regressor](machine_learning/random_forest_regressor.py) + * [Rmsprop](machine_learning/rmsprop.py) * [Scoring Functions](machine_learning/scoring_functions.py) * [Self Organizing Map](machine_learning/self_organizing_map.py) * [Sequential Minimum Optimization](machine_learning/sequential_minimum_optimization.py) @@ -736,6 +740,7 @@ * [Arc Length](maths/arc_length.py) * [Area](maths/area.py) * [Area Under Curve](maths/area_under_curve.py) + * [Autocorrelation](maths/autocorrelation.py) * [Average Absolute Deviation](maths/average_absolute_deviation.py) * [Average Mean](maths/average_mean.py) * [Average Median](maths/average_median.py) @@ -781,6 +786,7 @@ * [Fibonacci](maths/fibonacci.py) * [Find Max](maths/find_max.py) * [Find Min](maths/find_min.py) + * [First Fundamental Form](maths/first_fundamental_form.py) * [Floor](maths/floor.py) * [Gamma](maths/gamma.py) * [Gaussian](maths/gaussian.py) @@ -843,6 +849,7 @@ * [Square Root](maths/numerical_analysis/square_root.py) * [Weierstrass Method](maths/numerical_analysis/weierstrass_method.py) * [Odd Sieve](maths/odd_sieve.py) + * [Padovan Sequence](maths/padovan_sequence.py) * [Pell Number](maths/pell_number.py) * [Perfect Cube](maths/perfect_cube.py) * [Perfect Number](maths/perfect_number.py) @@ -872,6 +879,8 @@ * [Reverse Factorial Recursive](maths/reverse_factorial_recursive.py) * [Segmented Sieve](maths/segmented_sieve.py) * Series + * [Alternate Harmonic Series](maths/series/alternate_harmonic_series.py) + * [Alternating Harmonic Series](maths/series/alternating_harmonic_series.py) * [Arithmetic](maths/series/arithmetic.py) * [Geometric](maths/series/geometric.py) * [Geometric Series](maths/series/geometric_series.py) @@ -911,6 +920,7 @@ * [Polygonal Numbers](maths/special_numbers/polygonal_numbers.py) * [Pronic Number](maths/special_numbers/pronic_number.py) * [Proth Number](maths/special_numbers/proth_number.py) + * [Spy Number](maths/special_numbers/spy_number.py) * [Triangular Numbers](maths/special_numbers/triangular_numbers.py) * [Trimorphic Number](maths/special_numbers/trimorphic_number.py) * [Ugly Numbers](maths/special_numbers/ugly_numbers.py)