{
  "title": "Which ML algorithm?",
  "intro": "Narrow by task, data size, and how interpretable the answer must be. Each card names a scikit-learn estimator (scikit-learn==1.5.2) with a minimal call and why it fits Indian workplace scenarios.",
  "searchPlaceholder": "Search LogisticRegression, RandomForest, clustering…",
  "versions": {
    "scikit-learn": "1.5.2"
  },
  "docs": [
    {
      "label": "Choosing the right estimator",
      "url": "https://scikit-learn.org/1.5/machine_learning_map.html"
    },
    {
      "label": "API reference",
      "url": "https://scikit-learn.org/1.5/modules/classes.html"
    }
  ],
  "filters": [
    {
      "id": "task",
      "label": "1. Task type",
      "options": [
        {
          "value": "classification",
          "label": "Classification"
        },
        {
          "value": "regression",
          "label": "Regression"
        },
        {
          "value": "clustering",
          "label": "Clustering"
        },
        {
          "value": "anomaly",
          "label": "Anomaly / outlier"
        },
        {
          "value": "dimred",
          "label": "Dim. reduction"
        }
      ]
    },
    {
      "id": "size",
      "label": "2. Data size (rows)",
      "options": [
        {
          "value": "small",
          "label": "< 10k"
        },
        {
          "value": "medium",
          "label": "10k–100k"
        },
        {
          "value": "large",
          "label": "> 100k"
        }
      ]
    },
    {
      "id": "interpretability",
      "label": "3. Interpretability need",
      "options": [
        {
          "value": "high",
          "label": "High (coefficients / rules)"
        },
        {
          "value": "medium",
          "label": "Medium (feature importance)"
        },
        {
          "value": "low",
          "label": "Low (accuracy first)"
        }
      ]
    }
  ],
  "items": [
    {
      "id": "logreg",
      "name": "LogisticRegression",
      "estimator": "sklearn.linear_model.LogisticRegression",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "high"
      ],
      "why": "Linear decision boundary with readable coefficients. Strong default for binary outcomes when features are roughly linear.",
      "example": "Predict whether a Bengaluru SaaS trial converts to paid (yes/no).",
      "api": "from sklearn.linear_model import LogisticRegression\nclf = LogisticRegression(max_iter=1000)\nclf.fit(X_train, y_train)\nproba = clf.predict_proba(X_test)[:, 1]",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.LogisticRegression.html",
      "tags": [
        "binary",
        "multinomial",
        "baseline"
      ]
    },
    {
      "id": "linearsvc",
      "name": "LinearSVC",
      "estimator": "sklearn.svm.LinearSVC",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Fast linear SVM for high-dimensional sparse text or bag-of-words features.",
      "example": "Ticket triage: classify support emails into billing / tech / account.",
      "api": "from sklearn.svm import LinearSVC\nclf = LinearSVC(dual=\"auto\")\nclf.fit(X_train, y_train)\ny_hat = clf.predict(X_test)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.svm.LinearSVC.html",
      "tags": [
        "svm",
        "text",
        "sparse"
      ]
    },
    {
      "id": "svc-rbf",
      "name": "SVC (RBF kernel)",
      "estimator": "sklearn.svm.SVC",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "small"
      ],
      "interpretability": [
        "low"
      ],
      "why": "Non-linear boundary when rows are few and you can afford O(n²) training. Scale features first.",
      "example": "Small lab dataset: classify wafer defect type from 8 sensor readings.",
      "api": "from sklearn.svm import SVC\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nclf = make_pipeline(StandardScaler(), SVC(kernel=\"rbf\", probability=True))\nclf.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.svm.SVC.html",
      "tags": [
        "kernel",
        "non-linear"
      ]
    },
    {
      "id": "knn",
      "name": "KNeighborsClassifier",
      "estimator": "sklearn.neighbors.KNeighborsClassifier",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "small",
        "medium"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Instance-based: predict from nearest neighbours. Sensitive to scale and irrelevant columns.",
      "example": "Recommend similar SKUs for a Delhi fashion retailer from style embeddings.",
      "api": "from sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nclf = make_pipeline(StandardScaler(), KNeighborsClassifier(n_neighbors=5))\nclf.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.neighbors.KNeighborsClassifier.html",
      "tags": [
        "knn",
        "lazy"
      ]
    },
    {
      "id": "gnb",
      "name": "GaussianNB",
      "estimator": "sklearn.naive_bayes.GaussianNB",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "high"
      ],
      "why": "Fast probabilistic baseline assuming feature independence (Gaussian likelihood).",
      "example": "Quick spam vs ham on a small internal newsletter list.",
      "api": "from sklearn.naive_bayes import GaussianNB\nclf = GaussianNB()\nclf.fit(X_train, y_train)\nproba = clf.predict_proba(X_test)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.naive_bayes.GaussianNB.html",
      "tags": [
        "naive bayes",
        "baseline"
      ]
    },
    {
      "id": "sgd-clf",
      "name": "SGDClassifier",
      "estimator": "sklearn.linear_model.SGDClassifier",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Online / large-scale linear models via stochastic gradient descent. Good when data does not fit in one batch.",
      "example": "Stream of UPI fraud flags scored hourly from millions of rows.",
      "api": "from sklearn.linear_model import SGDClassifier\nclf = SGDClassifier(loss=\"log_loss\", max_iter=1000, tol=1e-3)\nclf.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.SGDClassifier.html",
      "tags": [
        "sgd",
        "online",
        "large"
      ]
    },
    {
      "id": "rf-clf",
      "name": "RandomForestClassifier",
      "estimator": "sklearn.ensemble.RandomForestClassifier",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Bagged trees handle non-linear interactions and mixed feature types with little scaling.",
      "example": "Loan default risk for a Pune NBFC with tabular applicant features.",
      "api": "from sklearn.ensemble import RandomForestClassifier\nclf = RandomForestClassifier(n_estimators=300, random_state=0, n_jobs=-1)\nclf.fit(X_train, y_train)\nimportances = clf.feature_importances_",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.RandomForestClassifier.html",
      "tags": [
        "ensemble",
        "trees"
      ]
    },
    {
      "id": "hgb-clf",
      "name": "HistGradientBoostingClassifier",
      "estimator": "sklearn.ensemble.HistGradientBoostingClassifier",
      "package": "scikit-learn",
      "task": [
        "classification"
      ],
      "taskLabel": "Classification",
      "size": [
        "medium",
        "large"
      ],
      "interpretability": [
        "low"
      ],
      "why": "Histogram gradient boosting — strong tabular accuracy; native missing-value support.",
      "example": "Churn model on 200k telecom subscribers with sparse usage columns.",
      "api": "from sklearn.ensemble import HistGradientBoostingClassifier\nclf = HistGradientBoostingClassifier(max_depth=6, learning_rate=0.1, random_state=0)\nclf.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.HistGradientBoostingClassifier.html",
      "tags": [
        "boosting",
        "gbdt"
      ]
    },
    {
      "id": "ridge",
      "name": "Ridge",
      "estimator": "sklearn.linear_model.Ridge",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "high"
      ],
      "why": "L2-regularised linear regression when many correlated predictors (e.g. spend channels).",
      "example": "Predict weekly GMV from ad spend by channel for a Jaipur D2C brand.",
      "api": "from sklearn.linear_model import Ridge\nreg = Ridge(alpha=1.0)\nreg.fit(X_train, y_train)\ny_hat = reg.predict(X_test)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.Ridge.html",
      "tags": [
        "linear",
        "l2"
      ]
    },
    {
      "id": "lasso",
      "name": "Lasso",
      "estimator": "sklearn.linear_model.Lasso",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "small",
        "medium"
      ],
      "interpretability": [
        "high"
      ],
      "why": "L1 penalty zeros weak coefficients — useful for sparse feature selection.",
      "example": "Explain which store attributes drive footfall in a 40-feature retail panel.",
      "api": "from sklearn.linear_model import Lasso\nreg = Lasso(alpha=0.01, max_iter=5000)\nreg.fit(X_train, y_train)\nnonzero = (reg.coef_ != 0).sum()",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.Lasso.html",
      "tags": [
        "linear",
        "l1",
        "sparse"
      ]
    },
    {
      "id": "elasticnet",
      "name": "ElasticNet",
      "estimator": "sklearn.linear_model.ElasticNet",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "high"
      ],
      "why": "Mix of L1 and L2 when groups of correlated features should shrink together.",
      "example": "Price elasticity with many overlapping promo and seasonality dummies.",
      "api": "from sklearn.linear_model import ElasticNet\nreg = ElasticNet(alpha=0.01, l1_ratio=0.5, max_iter=5000)\nreg.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.ElasticNet.html",
      "tags": [
        "linear",
        "elasticnet"
      ]
    },
    {
      "id": "rf-reg",
      "name": "RandomForestRegressor",
      "estimator": "sklearn.ensemble.RandomForestRegressor",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Non-linear tabular regression with feature importances for stakeholder decks.",
      "example": "Predict delivery ETA minutes for a Hyderabad last-mile fleet.",
      "api": "from sklearn.ensemble import RandomForestRegressor\nreg = RandomForestRegressor(n_estimators=300, random_state=0, n_jobs=-1)\nreg.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.RandomForestRegressor.html",
      "tags": [
        "ensemble",
        "trees"
      ]
    },
    {
      "id": "hgb-reg",
      "name": "HistGradientBoostingRegressor",
      "estimator": "sklearn.ensemble.HistGradientBoostingRegressor",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "medium",
        "large"
      ],
      "interpretability": [
        "low"
      ],
      "why": "Usually strongest sklearn default for large tabular regression without heavy tuning.",
      "example": "Forecast next-day order volume for a Mumbai grocery dark store.",
      "api": "from sklearn.ensemble import HistGradientBoostingRegressor\nreg = HistGradientBoostingRegressor(max_depth=8, learning_rate=0.08, random_state=0)\nreg.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.HistGradientBoostingRegressor.html",
      "tags": [
        "boosting",
        "gbdt"
      ]
    },
    {
      "id": "svr",
      "name": "SVR",
      "estimator": "sklearn.svm.SVR",
      "package": "scikit-learn",
      "task": [
        "regression"
      ],
      "taskLabel": "Regression",
      "size": [
        "small"
      ],
      "interpretability": [
        "low"
      ],
      "why": "Kernel regression for small continuous targets; scale inputs.",
      "example": "Calibrate a lab sensor reading from 200 labelled samples.",
      "api": "from sklearn.svm import SVR\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nreg = make_pipeline(StandardScaler(), SVR(kernel=\"rbf\", C=1.0))\nreg.fit(X_train, y_train)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.svm.SVR.html",
      "tags": [
        "svm",
        "kernel"
      ]
    },
    {
      "id": "kmeans",
      "name": "KMeans",
      "estimator": "sklearn.cluster.KMeans",
      "package": "scikit-learn",
      "task": [
        "clustering"
      ],
      "taskLabel": "Clustering",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Partition into k spherical clusters. Scale features; choose k with elbow / silhouette.",
      "example": "Segment grocery customers into 5 RFM behaviour groups.",
      "api": "from sklearn.cluster import KMeans\nfrom sklearn.preprocessing import StandardScaler\nXs = StandardScaler().fit_transform(X)\nkm = KMeans(n_clusters=5, n_init=10, random_state=0)\nlabels = km.fit_predict(Xs)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.cluster.KMeans.html",
      "tags": [
        "unsupervised",
        "kmeans"
      ]
    },
    {
      "id": "dbscan",
      "name": "DBSCAN",
      "estimator": "sklearn.cluster.DBSCAN",
      "package": "scikit-learn",
      "task": [
        "clustering"
      ],
      "taskLabel": "Clustering",
      "size": [
        "small",
        "medium"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Density clusters of arbitrary shape; marks noise as -1. Tune eps carefully.",
      "example": "Find dense delivery-hotspot clusters on lat/long for a Noida fleet.",
      "api": "from sklearn.cluster import DBSCAN\nfrom sklearn.preprocessing import StandardScaler\nXs = StandardScaler().fit_transform(X)\nlabels = DBSCAN(eps=0.5, min_samples=5).fit_predict(Xs)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.cluster.DBSCAN.html",
      "tags": [
        "density",
        "noise"
      ]
    },
    {
      "id": "agglo",
      "name": "AgglomerativeClustering",
      "estimator": "sklearn.cluster.AgglomerativeClustering",
      "package": "scikit-learn",
      "task": [
        "clustering"
      ],
      "taskLabel": "Clustering",
      "size": [
        "small"
      ],
      "interpretability": [
        "high"
      ],
      "why": "Hierarchical clusters; good for small n when you want a dendrogram story.",
      "example": "Group 80 branch offices by KPI profile for a regional review.",
      "api": "from sklearn.cluster import AgglomerativeClustering\nlabels = AgglomerativeClustering(n_clusters=4, linkage=\"ward\").fit_predict(X)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.cluster.AgglomerativeClustering.html",
      "tags": [
        "hierarchical"
      ]
    },
    {
      "id": "isolation",
      "name": "IsolationForest",
      "estimator": "sklearn.ensemble.IsolationForest",
      "package": "scikit-learn",
      "task": [
        "anomaly"
      ],
      "taskLabel": "Anomaly",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Unsupervised outlier scores via random partitions. Works on tabular metrics.",
      "example": "Flag unusual ATM withdrawal patterns for an internal audit sample.",
      "api": "from sklearn.ensemble import IsolationForest\nclf = IsolationForest(contamination=0.02, random_state=0)\nscores = clf.fit_predict(X)  # -1 = outlier",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.ensemble.IsolationForest.html",
      "tags": [
        "outlier",
        "unsupervised"
      ]
    },
    {
      "id": "ocsvm",
      "name": "OneClassSVM",
      "estimator": "sklearn.svm.OneClassSVM",
      "package": "scikit-learn",
      "task": [
        "anomaly"
      ],
      "taskLabel": "Anomaly",
      "size": [
        "small",
        "medium"
      ],
      "interpretability": [
        "low"
      ],
      "why": "Learn a boundary around \"normal\" class when only healthy examples are labelled.",
      "example": "Machine health: train on normal vibration windows, flag novel faults.",
      "api": "from sklearn.svm import OneClassSVM\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\nclf = make_pipeline(StandardScaler(), OneClassSVM(nu=0.05, kernel=\"rbf\"))\nclf.fit(X_train)\npred = clf.predict(X_test)  # -1 = outlier",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.svm.OneClassSVM.html",
      "tags": [
        "novelty",
        "svm"
      ]
    },
    {
      "id": "pca",
      "name": "PCA",
      "estimator": "sklearn.decomposition.PCA",
      "package": "scikit-learn",
      "task": [
        "dimred"
      ],
      "taskLabel": "Dim. reduction",
      "size": [
        "small",
        "medium",
        "large"
      ],
      "interpretability": [
        "medium"
      ],
      "why": "Linear projection that maximises variance — compress features or visualise.",
      "example": "Reduce 40 survey Likert items to 3 components before clustering.",
      "api": "from sklearn.decomposition import PCA\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.pipeline import make_pipeline\npipe = make_pipeline(StandardScaler(), PCA(n_components=3, random_state=0))\nZ = pipe.fit_transform(X)",
      "docsUrl": "https://scikit-learn.org/1.5/modules/generated/sklearn.decomposition.PCA.html",
      "tags": [
        "pca",
        "compression"
      ]
    }
  ]
}
