This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy import sparse as sp | |
| def generate_data(n_samples, n_features, n_classes=2, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
| rng = np.random.RandomState(random_state) | |
| if X_density < 1: | |
| X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
| else: | |
| X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) | |
| y = np.round(rng.randint(n_classes,size=(n_samples,))).astype(dtype) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from functools import partial | |
| from time import perf_counter | |
| from statistics import mean, stdev | |
| from itertools import product | |
| import csv | |
| from pathlib import Path | |
| from sklearn.neighbors import KNeighborsClassifier | |
| results_path = 'local_artifacts/benchmarks/pwd_labels/predict_proba/large_wide/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compile with annotated view to compare generated instructions | |
| # and presence of `__pyx_vtabstruct_*` | |
| from cython cimport final | |
| # Typedef function pointer | |
| ctypedef int (*f_type)(A) | |
| # Ancestor, serves as interface/ABC | |
| cdef class A: | |
| cdef f_type func |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import scipy.sparse as sp | |
| def generate_data(n_samples, n_features, n_classes=2, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
| rng = np.random.RandomState(random_state) | |
| if X_density < 1: | |
| X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
| else: | |
| X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) | |
| y = np.round(rng.randint(n_classes,size=(n_samples,))).astype(dtype) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import scipy.sparse as sp | |
| def generate_data(n_samples, n_features, n_classes=2, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
| rng = np.random.RandomState(random_state) | |
| if X_density < 1: | |
| X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
| else: | |
| X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) | |
| y = np.round(rng.randint(n_classes,size=(n_samples,))).astype(dtype) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import numpy as np | |
| import scipy.sparse as sp | |
| def generate_data(n_samples, n_features, n_classes=2, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
| rng = np.random.RandomState(random_state) | |
| if X_density < 1: | |
| X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
| else: | |
| X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| from functools import partial | |
| from time import perf_counter | |
| from statistics import mean, stdev | |
| from itertools import product | |
| import csv | |
| from sklearn.neighbors import KNeighborsClassifier | |
| import numpy as np | |
| def make_data(n_samples, n_features, n_classes, n_outs, random_state=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| from sklearn.compose import ColumnTransformer | |
| from sklearn.datasets import fetch_openml | |
| from sklearn.linear_model import LogisticRegression | |
| from sklearn.pipeline import make_pipeline | |
| from sklearn.preprocessing import OneHotEncoder, FunctionTransformer, StandardScaler, KBinsDiscretizer | |
| from sklearn.model_selection import train_test_split | |
| import joblib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import numpy as np | |
| import scipy.sparse as sp | |
| def generate_data(n_samples, n_features, X_density=1, y_sparse=False, dtype=np.float64, random_state=None): | |
| rng = np.random.RandomState(random_state) | |
| if X_density < 1: | |
| X = sp.random(n_samples, n_features, format="csr", density=X_density, random_state=rng) | |
| else: | |
| X = np.round(rng.rand(n_samples,n_features)*50).astype(dtype) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %% | |
| import numpy as np | |
| import pandas as pd | |
| from sklearn.compose import ColumnTransformer | |
| from sklearn.datasets import fetch_openml | |
| from sklearn.impute import SimpleImputer | |
| from sklearn.linear_model import LogisticRegression | |
| from sklearn.pipeline import make_pipeline | |
| from sklearn.preprocessing import OneHotEncoder | |
| from sklearn.preprocessing import StandardScaler |