repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/linting.py | gpt_engineer/core/linting.py | import black
from gpt_engineer.core.files_dict import FilesDict
class Linting:
def __init__(self):
# Dictionary to hold linting methods for different file types
self.linters = {".py": self.lint_python}
import black
def lint_python(self, content, config):
"""Lint Python files usi... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/prompt.py | gpt_engineer/core/prompt.py | import json
from typing import Dict, Optional
class Prompt:
def __init__(
self,
text: str,
image_urls: Optional[Dict[str, str]] = None,
entrypoint_prompt: str = "",
):
self.text = text
self.image_urls = image_urls
self.entrypoint_prompt = entrypoint_pro... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/__init__.py | gpt_engineer/core/__init__.py | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false | |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/files_dict.py | gpt_engineer/core/files_dict.py | """
FilesDict Module
This module provides a FilesDict class which is a dictionary-based container for managing code files.
It extends the standard dictionary to enforce string keys and values, representing filenames and their
corresponding code content. It also provides methods to format its contents for chat-based in... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/ai.py | gpt_engineer/core/ai.py | """
AI Module
This module provides an AI class that interfaces with language models to perform various tasks such as
starting a conversation, advancing the conversation, and handling message serialization. It also includes
backoff strategies for handling rate limit errors from the OpenAI API.
Classes:
AI: A class... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/steps.py | gpt_engineer/core/default/steps.py | """
Module for defining the steps involved in generating and improving code using AI.
This module provides functions that represent different steps in the process of generating
and improving code using an AI model. These steps include generating code from a prompt,
creating an entrypoint for the codebase, executing th... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/paths.py | gpt_engineer/core/default/paths.py | """
Module defining file system paths used by the application.
This module contains definitions of file system paths that are used throughout the
application to locate and manage various files and directories, such as logs, memory,
and preprompts.
Constants
---------
META_DATA_REL_PATH : str
The relative path to ... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/disk_memory.py | gpt_engineer/core/default/disk_memory.py | """
Disk Memory Module
==================
This module provides a simple file-based key-value database system, where keys are
represented as filenames and values are the contents of these files. The `DiskMemory` class
is responsible for the CRUD operations on the database.
Attributes
----------
None
Functions
-------... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/constants.py | gpt_engineer/core/default/constants.py | """
Module defining constants used throughout the application.
This module contains definitions of constants that are used across various
components of the application to maintain consistency and ease of configuration.
Constants
---------
MAX_EDIT_REFINEMENT_STEPS : int
The maximum number of refinement steps allo... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/disk_execution_env.py | gpt_engineer/core/default/disk_execution_env.py | """
Module for managing the execution environment on the local disk.
This module provides a class that handles the execution of code stored on the local
file system. It includes methods for uploading files to the execution environment,
running commands, and capturing the output.
Classes
-------
DiskExecutionEnv
A... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/__init__.py | gpt_engineer/core/default/__init__.py | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false | |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/simple_agent.py | gpt_engineer/core/default/simple_agent.py | """
Module for defining a simple agent that uses AI to manage code generation and improvement.
This module provides a class that represents an agent capable of initializing and improving
a codebase using AI. It handles interactions with the AI model, memory, and execution
environment to generate and refine code based ... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
AntonOsika/gpt-engineer | https://github.com/AntonOsika/gpt-engineer/blob/a90fcd543eedcc0ff2c34561bc0785d2ba83c47e/gpt_engineer/core/default/file_store.py | gpt_engineer/core/default/file_store.py | import tempfile
from pathlib import Path
from typing import Union
from gpt_engineer.core.files_dict import FilesDict
from gpt_engineer.core.linting import Linting
class FileStore:
"""
Module for managing file storage in a temporary directory.
This module provides a class that manages the storage of fil... | python | MIT | a90fcd543eedcc0ff2c34561bc0785d2ba83c47e | 2026-01-04T14:39:15.137338Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/.github/scripts/label_title_regex.py | .github/scripts/label_title_regex.py | """Labels PRs based on title. Must be run in a github action with the
pull_request_target event."""
import json
import os
import re
from github import Github
context_dict = json.loads(os.getenv("CONTEXT_GITHUB"))
repo = context_dict["repository"]
g = Github(context_dict["token"])
repo = g.get_repo(repo)
pr_number =... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_glm.py | benchmarks/bench_glm.py | """
A comparison of different methods in GLM
Data comes from a random square matrix.
"""
from datetime import datetime
import numpy as np
from sklearn import linear_model
if __name__ == "__main__":
import matplotlib.pyplot as plt
n_iter = 40
time_ridge = np.empty(n_iter)
time_ols = np.empty(n_it... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_multilabel_metrics.py | benchmarks/bench_multilabel_metrics.py | #!/usr/bin/env python
"""
A comparison of multilabel target formats and metrics over them
"""
import argparse
import itertools
import sys
from functools import partial
from timeit import timeit
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import make_multilabel_c... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_hist_gradient_boosting_higgsboson.py | benchmarks/bench_hist_gradient_boosting_higgsboson.py | import argparse
import os
from gzip import GzipFile
from time import time
from urllib.request import urlretrieve
import numpy as np
import pandas as pd
from joblib import Memory
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.ensemble._hist_gradient_boosting.utils import get_equivalent_estima... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_isotonic.py | benchmarks/bench_isotonic.py | """
Benchmarks of isotonic regression performance.
We generate a synthetic dataset of size 10^n, for n in [min, max], and
examine the time taken to run isotonic regression over the dataset.
The timings are then output to stdout, or visualized on a log-log scale
with matplotlib.
This allows the scaling of the algorit... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_omp_lars.py | benchmarks/bench_plot_omp_lars.py | """Benchmarks of orthogonal matching pursuit (:ref:`OMP`) versus least angle
regression (:ref:`least_angle_regression`)
The input data is mostly low rank but is a fat infinite tail.
"""
import gc
import sys
from time import time
import numpy as np
from sklearn.datasets import make_sparse_coded_signal
from sklearn.l... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_nmf.py | benchmarks/bench_plot_nmf.py | """
Benchmarks of Non-Negative Matrix Factorization
"""
# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
import numbers
import sys
import warnings
from time import time
import matplotlib.pyplot as plt
import numpy as np
import pandas
from joblib import Memory
from sklearn.decomposition... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_hist_gradient_boosting_threading.py | benchmarks/bench_hist_gradient_boosting_threading.py | import argparse
import os
from pprint import pprint
from time import time
import numpy as np
from threadpoolctl import threadpool_limits
import sklearn
from sklearn.datasets import make_classification, make_regression
from sklearn.ensemble import (
HistGradientBoostingClassifier,
HistGradientBoostingRegressor... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_hist_gradient_boosting_categorical_only.py | benchmarks/bench_hist_gradient_boosting_categorical_only.py | import argparse
from time import time
from sklearn.datasets import make_classification
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.ensemble._hist_gradient_boosting.utils import get_equivalent_estimator
from sklearn.preprocessing import KBinsDiscretizer
parser = argparse.ArgumentParser()
p... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_fastkmeans.py | benchmarks/bench_plot_fastkmeans.py | from collections import defaultdict
from time import time
import numpy as np
from numpy import random as nr
from sklearn.cluster import KMeans, MiniBatchKMeans
def compute_bench(samples_range, features_range):
it = 0
results = defaultdict(lambda: [])
chunk = 100
max_it = len(samples_range) * len(fe... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_isolation_forest.py | benchmarks/bench_isolation_forest.py | """
==========================================
IsolationForest benchmark
==========================================
A test of IsolationForest on classical anomaly detection datasets.
The benchmark is run as follows:
1. The dataset is randomly split into a training set and a test set, both
assumed to contain outliers.
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/plot_tsne_mnist.py | benchmarks/plot_tsne_mnist.py | import argparse
import os.path as op
import matplotlib.pyplot as plt
import numpy as np
LOG_DIR = "mnist_tsne_output"
if __name__ == "__main__":
parser = argparse.ArgumentParser("Plot benchmark results for t-SNE")
parser.add_argument(
"--labels",
type=str,
default=op.join(LOG_DIR, "m... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_svd.py | benchmarks/bench_plot_svd.py | """Benchmarks of Singular Value Decomposition (Exact and Approximate)
The data is mostly low rank but is a fat infinite tail.
"""
import gc
from collections import defaultdict
from time import time
import numpy as np
from scipy.linalg import svd
from sklearn.datasets import make_low_rank_matrix
from sklearn.utils.e... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_pca_solvers.py | benchmarks/bench_pca_solvers.py | # %%
#
# This benchmark compares the speed of PCA solvers on datasets of different
# sizes in order to determine the best solver to select by default via the
# "auto" heuristic.
#
# Note: we do not control for the accuracy of the solvers: we assume that all
# solvers yield transformed data with similar explained varian... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_tsne_mnist.py | benchmarks/bench_tsne_mnist.py | """
=============================
MNIST dataset T-SNE benchmark
=============================
"""
# SPDX-License-Identifier: BSD-3-Clause
import argparse
import json
import os
import os.path as op
from time import time
import numpy as np
from joblib import Memory
from sklearn.utils._openmp_helpers import _openmp_ef... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_20newsgroups.py | benchmarks/bench_20newsgroups.py | import argparse
from time import time
import numpy as np
from sklearn.datasets import fetch_20newsgroups_vectorized
from sklearn.dummy import DummyClassifier
from sklearn.ensemble import (
AdaBoostClassifier,
ExtraTreesClassifier,
RandomForestClassifier,
)
from sklearn.linear_model import LogisticRegressi... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_isolation_forest_predict.py | benchmarks/bench_isolation_forest_predict.py | """
==========================================
IsolationForest prediction benchmark
==========================================
A test of IsolationForest on classical anomaly detection datasets.
The benchmark is run as follows:
1. The dataset is randomly split into a training set and a test set, both
assumed to contain... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_covertype.py | benchmarks/bench_covertype.py | """
===========================
Covertype dataset benchmark
===========================
Benchmark stochastic gradient descent (SGD), Liblinear, and Naive Bayes, CART
(decision tree), RandomForest and Extra-Trees on the forest covertype dataset
of Blackard, Jock, and Dean [1]. The dataset comprises 581,012 samples. It ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_polynomial_kernel_approximation.py | benchmarks/bench_plot_polynomial_kernel_approximation.py | """
========================================================================
Benchmark for explicit feature map approximation of polynomial kernels
========================================================================
An example illustrating the approximation of the feature map
of a Homogeneous Polynomial kernel.
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_lasso_path.py | benchmarks/bench_plot_lasso_path.py | """Benchmarks of Lasso regularization path computation using Lars and CD
The input data is mostly low rank but is a fat infinite tail.
"""
import gc
import sys
from collections import defaultdict
from time import time
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import l... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_online_ocsvm.py | benchmarks/bench_online_ocsvm.py | """
=====================================
SGDOneClassSVM benchmark
=====================================
This benchmark compares the :class:`SGDOneClassSVM` with :class:`OneClassSVM`.
The former is an online One-Class SVM implemented with a Stochastic Gradient
Descent (SGD). The latter is based on the LibSVM implementa... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_rcv1_logreg_convergence.py | benchmarks/bench_rcv1_logreg_convergence.py | # Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
import gc
import time
import matplotlib.pyplot as plt
import numpy as np
from joblib import Memory
from sklearn.datasets import fetch_rcv1
from sklearn.linear_model import LogisticRegression, SGDClassifier
from sklearn.linear_model._sag i... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_text_vectorizers.py | benchmarks/bench_text_vectorizers.py | """
To run this benchmark, you will need,
* scikit-learn
* pandas
* memory_profiler
* psutil (optional, but recommended)
"""
import itertools
import timeit
import numpy as np
import pandas as pd
from memory_profiler import memory_usage
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extra... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_neighbors.py | benchmarks/bench_plot_neighbors.py | """
Plot the scaling of the nearest neighbors algorithms with k, D, and N
"""
from time import time
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import ticker
from sklearn import datasets, neighbors
def get_data(N, D, dataset="dense"):
if dataset == "dense":
np.random.seed(0)
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_glmnet.py | benchmarks/bench_glmnet.py | """
To run this, you'll need to have installed.
* glmnet-python
* scikit-learn (of course)
Does two benchmarks
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_ward.py | benchmarks/bench_plot_ward.py | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import matplotlib.pyplot as plt
import numpy as np
from scipy.cluster import hierarchy
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage="ward")
n_samples = np.logspace(0.5, 3, 9)
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_parallel_pairwise.py | benchmarks/bench_plot_parallel_pairwise.py | # Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
import time
import matplotlib.pyplot as plt
from sklearn.metrics.pairwise import pairwise_distances, pairwise_kernels
from sklearn.utils import check_random_state
def plot(func):
random_state = check_random_state(0)
one_core = [... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_hist_gradient_boosting_adult.py | benchmarks/bench_hist_gradient_boosting_adult.py | import argparse
from time import time
import numpy as np
import pandas as pd
from sklearn.compose import make_column_selector, make_column_transformer
from sklearn.datasets import fetch_openml
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.ensemble._hist_gradient_boosting.utils import get_eq... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_random_projections.py | benchmarks/bench_random_projections.py | """
===========================
Random projection benchmark
===========================
Benchmarks for random projections.
"""
import collections
import gc
import optparse
import sys
from datetime import datetime
import numpy as np
import scipy.sparse as sp
from sklearn import clone
from sklearn.random_projection ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_incremental_pca.py | benchmarks/bench_plot_incremental_pca.py | """
========================
IncrementalPCA benchmark
========================
Benchmarks for IncrementalPCA
"""
import gc
from collections import defaultdict
from time import time
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_lfw_people
from sklearn.decomposition import PCA... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_kernel_pca_solvers_time_vs_n_samples.py | benchmarks/bench_kernel_pca_solvers_time_vs_n_samples.py | """
==========================================================
Kernel PCA Solvers comparison benchmark: time vs n_samples
==========================================================
This benchmark shows that the approximate solvers provided in Kernel PCA can
help significantly improve its execution speed when an approx... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_randomized_svd.py | benchmarks/bench_plot_randomized_svd.py | """
Benchmarks on the power iterations phase in randomized SVD.
We test on various synthetic and real datasets the effect of increasing
the number of power iterations in terms of quality of approximation
and running time. A number greater than 0 should help with noisy matrices,
which are characterized by a slow spectr... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_lasso.py | benchmarks/bench_lasso.py | """
Benchmarks of Lasso vs LassoLars
First, we fix a training set and increase the number of
samples. Then we plot the computation time as function of
the number of samples.
In the second benchmark, we increase the number of dimensions of the
training set. Then we plot the computation time as function of
the number o... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_feature_expansions.py | benchmarks/bench_feature_expansions.py | from time import time
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sparse
from sklearn.preprocessing import PolynomialFeatures
degree = 2
trials = 3
num_rows = 1000
dimensionalities = np.array([1, 2, 8, 16, 32, 64])
densities = np.array([0.01, 0.1, 1.0])
csr_times = {d: np.zeros(len(dime... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_hist_gradient_boosting.py | benchmarks/bench_hist_gradient_boosting.py | import argparse
from time import time
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_classification, make_regression
from sklearn.ensemble import (
HistGradientBoostingClassifier,
HistGradientBoostingRegressor,
)
from sklearn.ensemble._hist_gradient_boosting.utils import ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_mnist.py | benchmarks/bench_mnist.py | """
=======================
MNIST dataset benchmark
=======================
Benchmark on the MNIST dataset. The dataset comprises 70,000 samples
and 784 features. Here, we consider the task of predicting
10 classes - digits from 0 to 9 from their raw images. By contrast to the
covertype dataset, the feature space is... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_lof.py | benchmarks/bench_lof.py | """
============================
LocalOutlierFactor benchmark
============================
A test of LocalOutlierFactor on classical anomaly detection datasets.
Note that LocalOutlierFactor is not meant to predict on a test set and its
performance is assessed in an outlier detection context:
1. The model is trained o... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_tree.py | benchmarks/bench_tree.py | """
To run this, you'll need to have installed.
* scikit-learn
Does two benchmarks
First, we fix a training set, increase the number of
samples to classify and plot number of classified samples as a
function of time.
In the second benchmark, we increase the number of dimensions of the
training set, classify a sam... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_sgd_regression.py | benchmarks/bench_sgd_regression.py | # Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
import gc
from time import time
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_regression
from sklearn.linear_model import ElasticNet, Ridge, SGDRegressor
from sklearn.metrics import mean_squared_erro... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_sparsify.py | benchmarks/bench_sparsify.py | """
Benchmark SGD prediction time with dense/sparse coefficients.
Invoke with
-----------
$ kernprof.py -l sparsity_benchmark.py
$ python -m line_profiler sparsity_benchmark.py.lprof
Typical output
--------------
input data sparsity: 0.050000
true coef sparsity: 0.000100
test data sparsity: 0.027400
model sparsity:... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_saga.py | benchmarks/bench_saga.py | """Author: Arthur Mensch, Nelle Varoquaux
Benchmarks of sklearn SAGA vs lightning SAGA vs Liblinear. Shows the gain
in using multinomial logistic regression in term of learning time.
"""
import json
import os
import time
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import (
fetch_20n... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_plot_hierarchical.py | benchmarks/bench_plot_hierarchical.py | from collections import defaultdict
from time import time
import numpy as np
from numpy import random as nr
from sklearn.cluster import AgglomerativeClustering
def compute_bench(samples_range, features_range):
it = 0
results = defaultdict(lambda: [])
max_it = len(samples_range) * len(features_range)
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_sample_without_replacement.py | benchmarks/bench_sample_without_replacement.py | """
Benchmarks for sampling without replacement of integer.
"""
import gc
import operator
import optparse
import random
import sys
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from sklearn.utils.random import sample_without_replacement
def compute_time(t_start, delta):
mu_s... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/benchmarks/bench_kernel_pca_solvers_time_vs_n_components.py | benchmarks/bench_kernel_pca_solvers_time_vs_n_components.py | """
=============================================================
Kernel PCA Solvers comparison benchmark: time vs n_components
=============================================================
This benchmark shows that the approximate solvers provided in Kernel PCA can
help significantly improve its execution speed when ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/generate_authors_table.py | build_tools/generate_authors_table.py | """
This script generates an html table of contributors, with names and avatars.
The list is generated from scikit-learn's teams on GitHub, plus a small number
of hard-coded contributors.
The table should be updated for each new inclusion in the teams.
Generating the table requires admin rights.
"""
import getpass
im... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/check-meson-openmp-dependencies.py | build_tools/check-meson-openmp-dependencies.py | """
Check that OpenMP dependencies are correctly defined in meson.build files.
This is based on trying to make sure the following two things match:
- the Cython files using OpenMP (based on a git grep regex)
- the Cython extension modules that are built with OpenMP compiler flags (based
on meson introspect json outp... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/get_comment.py | build_tools/get_comment.py | # This script is used to generate a comment for a PR when linting issues are
# detected. It is used by the `Comment on failed linting` GitHub Action.
import os
import re
from github import Auth, Github, GithubException
def get_versions(versions_file):
"""Get the versions of the packages used in the linter job.
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/update_environments_and_lock_files.py | build_tools/update_environments_and_lock_files.py | """Script to update CI environment files and associated lock files.
To run it you need to be in the root folder of the scikit-learn repo:
python build_tools/update_environments_and_lock_files.py
Two scenarios where this script can be useful:
- make sure that the latest versions of all the dependencies are used in the... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/wheels/check_license.py | build_tools/wheels/check_license.py | """Checks the bundled license is installed with the wheel."""
import platform
import site
from itertools import chain
from pathlib import Path
site_packages = site.getsitepackages()
site_packages_path = (Path(p) for p in site_packages)
try:
distinfo_path = next(
chain(
s
for site... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/circle/list_versions.py | build_tools/circle/list_versions.py | #!/usr/bin/env python3
# Write the available versions page (--rst) and the version switcher JSON (--json).
# Version switcher see:
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/version-dropdown.html
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html#announcement-ba... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/azure/get_commit_message.py | build_tools/azure/get_commit_message.py | import argparse
import os
import subprocess
def get_commit_message():
"""Retrieve the commit message."""
if "COMMIT_MESSAGE" in os.environ or "BUILD_SOURCEVERSIONMESSAGE" not in os.environ:
raise RuntimeError(
"This legacy script should only be used on Azure. "
"On GitHub acti... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/azure/get_selected_tests.py | build_tools/azure/get_selected_tests.py | import os
from get_commit_message import get_commit_message
def get_selected_tests():
"""Parse the commit message to check if pytest should run only specific tests.
If so, selected tests will be run with SKLEARN_TESTS_GLOBAL_RANDOM_SEED="all".
The commit message must take the form:
<title> [all... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/github/check_wheels.py | build_tools/github/check_wheels.py | """Checks that dist/* contains the number of wheels built from the
.github/workflows/wheels.yml config."""
import sys
from pathlib import Path
import yaml
gh_wheel_path = Path.cwd() / ".github" / "workflows" / "wheels.yml"
with gh_wheel_path.open("r") as f:
wheel_config = yaml.safe_load(f)
build_matrix = wheel_... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/github/autoclose_prs.py | build_tools/github/autoclose_prs.py | """Close PRs labeled with 'autoclose' more than 14 days ago.
Called from .github/workflows/autoclose-schedule.yml."""
import os
from datetime import datetime, timedelta, timezone
from pprint import pprint
from github import Auth, Github
def get_labeled_last_time(pr, label):
labeled_time = datetime.max
for ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/build_tools/github/vendor.py | build_tools/github/vendor.py | """Embed vcomp140.dll and msvcp140.dll."""
import os
import os.path as op
import shutil
import sys
import textwrap
TARGET_FOLDER = op.join("sklearn", ".libs")
DISTRIBUTOR_INIT = op.join("sklearn", "_distributor_init.py")
VCOMP140_SRC_PATH = "C:\\Windows\\System32\\vcomp140.dll"
MSVCP140_SRC_PATH = "C:\\Windows\\Syste... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/model_selection.py | asv_benchmarks/benchmarks/model_selection.py | from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV, cross_val_score
from .common import Benchmark, Estimator, Predictor
from .datasets import _synth_classification_dataset
from .utils import make_gen_classif_scorers
class CrossValidationBenchmark(Benchmark):
"""
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/cluster.py | asv_benchmarks/benchmarks/cluster.py | from sklearn.cluster import KMeans, MiniBatchKMeans
from .common import Benchmark, Estimator, Predictor, Transformer
from .datasets import _20newsgroups_highdim_dataset, _blobs_dataset
from .utils import neg_mean_inertia
class KMeansBenchmark(Predictor, Transformer, Estimator, Benchmark):
"""
Benchmarks for ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/metrics.py | asv_benchmarks/benchmarks/metrics.py | from sklearn.metrics.pairwise import pairwise_distances
from .common import Benchmark
from .datasets import _random_dataset
class PairwiseDistancesBenchmark(Benchmark):
"""
Benchmarks for pairwise distances.
"""
param_names = ["representation", "metric", "n_jobs"]
params = (
["dense", "s... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/datasets.py | asv_benchmarks/benchmarks/datasets.py | from pathlib import Path
import numpy as np
import scipy.sparse as sp
from joblib import Memory
from sklearn.datasets import (
fetch_20newsgroups,
fetch_olivetti_faces,
fetch_openml,
load_digits,
make_blobs,
make_classification,
make_regression,
)
from sklearn.decomposition import Truncate... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/ensemble.py | asv_benchmarks/benchmarks/ensemble.py | from sklearn.ensemble import (
GradientBoostingClassifier,
HistGradientBoostingClassifier,
RandomForestClassifier,
)
from .common import Benchmark, Estimator, Predictor
from .datasets import (
_20newsgroups_highdim_dataset,
_20newsgroups_lowdim_dataset,
_synth_classification_dataset,
)
from .ut... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/common.py | asv_benchmarks/benchmarks/common.py | import itertools
import json
import os
import pickle
import timeit
from abc import ABC, abstractmethod
from multiprocessing import cpu_count
from pathlib import Path
import numpy as np
def get_from_config():
"""Get benchmarks configuration from the config.json file"""
current_path = Path(__file__).resolve().... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/decomposition.py | asv_benchmarks/benchmarks/decomposition.py | from sklearn.decomposition import PCA, DictionaryLearning, MiniBatchDictionaryLearning
from .common import Benchmark, Estimator, Transformer
from .datasets import _mnist_dataset, _olivetti_faces_dataset
from .utils import make_dict_learning_scorers, make_pca_scorers
class PCABenchmark(Transformer, Estimator, Benchma... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/svm.py | asv_benchmarks/benchmarks/svm.py | from sklearn.svm import SVC
from .common import Benchmark, Estimator, Predictor
from .datasets import _synth_classification_dataset
from .utils import make_gen_classif_scorers
class SVCBenchmark(Predictor, Estimator, Benchmark):
"""Benchmarks for SVC."""
param_names = ["kernel"]
params = (["linear", "po... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/linear_model.py | asv_benchmarks/benchmarks/linear_model.py | from sklearn.linear_model import (
ElasticNet,
Lasso,
LinearRegression,
LogisticRegression,
Ridge,
SGDRegressor,
)
from .common import Benchmark, Estimator, Predictor
from .datasets import (
_20newsgroups_highdim_dataset,
_20newsgroups_lowdim_dataset,
_synth_regression_dataset,
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/neighbors.py | asv_benchmarks/benchmarks/neighbors.py | from sklearn.neighbors import KNeighborsClassifier
from .common import Benchmark, Estimator, Predictor
from .datasets import _20newsgroups_lowdim_dataset
from .utils import make_gen_classif_scorers
class KNeighborsClassifierBenchmark(Predictor, Estimator, Benchmark):
"""
Benchmarks for KNeighborsClassifier.
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/utils.py | asv_benchmarks/benchmarks/utils.py | import numpy as np
from sklearn.metrics import balanced_accuracy_score, r2_score
def neg_mean_inertia(X, labels, centers):
return -(np.asarray(X - centers[labels]) ** 2).sum(axis=1).mean()
def make_gen_classif_scorers(caller):
caller.train_scorer = balanced_accuracy_score
caller.test_scorer = balanced_... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/__init__.py | asv_benchmarks/benchmarks/__init__.py | """Benchmark suite for scikit-learn using ASV"""
| python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/asv_benchmarks/benchmarks/manifold.py | asv_benchmarks/benchmarks/manifold.py | from sklearn.manifold import TSNE
from .common import Benchmark, Estimator
from .datasets import _digits_dataset
class TSNEBenchmark(Estimator, Benchmark):
"""
Benchmarks for t-SNE.
"""
param_names = ["method"]
params = (["exact", "barnes_hut"],)
def setup_cache(self):
super().setup... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/maint_tools/bump-dependencies-versions.py | maint_tools/bump-dependencies-versions.py | import io
import re
import subprocess
import sys
from datetime import datetime
from pathlib import Path
import pandas as pd
import requests
from packaging import version
req = requests.get("https://devguide.python.org/versions/")
df_list = pd.read_html(io.StringIO(req.content.decode("utf-8")))
df = pd.concat(df_list)... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/maint_tools/sort_whats_new.py | maint_tools/sort_whats_new.py | #!/usr/bin/env python
# Sorts what's new entries with per-module headings.
# Pass what's new entries on stdin.
import re
import sys
from collections import defaultdict
LABEL_ORDER = ["MajorFeature", "Feature", "Efficiency", "Enhancement", "Fix", "API"]
def entry_sort_key(s):
if s.startswith("- |"):
retu... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/maint_tools/update_tracking_issue.py | maint_tools/update_tracking_issue.py | """Creates or updates an issue if the CI fails. This is useful to keep track of
scheduled jobs that are failing repeatedly.
This script depends on:
- `defusedxml` for safer parsing for xml
- `PyGithub` for interacting with GitHub
The GitHub token only requires the `repo:public_repo` scope are described in
https://doc... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/maint_tools/check_xfailed_checks.py | maint_tools/check_xfailed_checks.py | # This script checks that the common tests marked with xfail are actually
# failing.
# Note that in some cases, a test might be marked with xfail because it is
# failing on certain machines, and might not be triggered by this script.
import contextlib
import io
from sklearn.utils._test_common.instance_generator impor... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_5_0.py | examples/release_highlights/plot_release_highlights_1_5_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.5
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.5! Many bug fixes
and improvements were added, as well as some key new features. Below we... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_0_22_0.py | examples/release_highlights/plot_release_highlights_0_22_0.py | """
========================================
Release Highlights for scikit-learn 0.22
========================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 0.22, which comes
with many bug fixes and new features! We detail below a few of the major
features of this r... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_3_0.py | examples/release_highlights/plot_release_highlights_1_3_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.3
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.3! Many bug fixes
and improvements were added, as well as some new key features. We detai... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_7_0.py | examples/release_highlights/plot_release_highlights_1_7_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.7
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.7! Many bug fixes
and improvements were added, as well as some key new features. Below we... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_0_0.py | examples/release_highlights/plot_release_highlights_1_0_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.0
=======================================
.. currentmodule:: sklearn
We are very pleased to announce the release of scikit-learn 1.0! The library
has been stable for quite some time, releasing version 1.0 is recogni... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_2_0.py | examples/release_highlights/plot_release_highlights_1_2_0.py | # ruff: noqa: CPY001, E501
"""
=======================================
Release Highlights for scikit-learn 1.2
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.2! Many bug fixes
and improvements were added, as well as some new key features. We... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_6_0.py | examples/release_highlights/plot_release_highlights_1_6_0.py | # ruff: noqa: CPY001, E501
"""
=======================================
Release Highlights for scikit-learn 1.6
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.6! Many bug fixes
and improvements were added, as well as some key new features. Be... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_8_0.py | examples/release_highlights/plot_release_highlights_1_8_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.8
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.8! Many bug fixes
and improvements were added, as well as some key new features. Below we... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_4_0.py | examples/release_highlights/plot_release_highlights_1_4_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.4
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.4! Many bug fixes
and improvements were added, as well as some new key features. We detai... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_1_1_0.py | examples/release_highlights/plot_release_highlights_1_1_0.py | # ruff: noqa: CPY001
"""
=======================================
Release Highlights for scikit-learn 1.1
=======================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 1.1! Many bug fixes
and improvements were added, as well as some new key features. We detai... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_0_23_0.py | examples/release_highlights/plot_release_highlights_0_23_0.py | # ruff: noqa: CPY001
"""
========================================
Release Highlights for scikit-learn 0.23
========================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 0.23! Many bug fixes
and improvements were added, as well as some new key features. We d... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/release_highlights/plot_release_highlights_0_24_0.py | examples/release_highlights/plot_release_highlights_0_24_0.py | # ruff: noqa: CPY001, E501
"""
========================================
Release Highlights for scikit-learn 0.24
========================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 0.24! Many bug fixes
and improvements were added, as well as some new key features... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/gaussian_process/plot_gpr_noisy_targets.py | examples/gaussian_process/plot_gpr_noisy_targets.py | """
=========================================================
Gaussian Processes regression: basic introductory example
=========================================================
A simple one-dimensional regression example computed in two different ways:
1. A noise-free case
2. A noisy case with known noise-level per ... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/gaussian_process/plot_gpc_iris.py | examples/gaussian_process/plot_gpc_iris.py | """
=====================================================
Gaussian process classification (GPC) on iris dataset
=====================================================
This example illustrates the predicted probability of GPC for an isotropic
and anisotropic RBF kernel on a two-dimensional version for the iris-dataset.
... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
scikit-learn/scikit-learn | https://github.com/scikit-learn/scikit-learn/blob/6dce55ebff962076625db46ab70b6b1c939f423b/examples/gaussian_process/plot_gpr_prior_posterior.py | examples/gaussian_process/plot_gpr_prior_posterior.py | """
==========================================================================
Illustration of prior and posterior Gaussian process for different kernels
==========================================================================
This example illustrates the prior and posterior of a
:class:`~sklearn.gaussian_process.Ga... | python | BSD-3-Clause | 6dce55ebff962076625db46ab70b6b1c939f423b | 2026-01-04T14:38:25.175347Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.