Functions#

Summary#

function

class parent

truncated documentation

StrOptions

Dummy replacement for a class introduced in scikit-learn==1.1.

_adjust_weights

Changes weights mapped to every cluster. weights < 1 are used for big clusters, weights > 1 are used for small …

_assert_dict_equal

_assert_list_equal

_assert_tuple_equal

_assign_labels_array

Compute label assignment and inertia for a dense array Return the inertia (sum of squared distances to the centers). …

_assign_labels_csr

Compute label assignment and inertia for a CSR input Return the inertia (sum of squared distances to the centers).

_centers_dense

M step of the K-means EM algorithm Computation of cluster centers / means.

_centers_dense

M step of the K-means EM algorithm. Computation of cluster centers / means.

_centers_sparse

M step of the K-means EM algorithm Computation of cluster centers / means.

_combinations_poly

Computes all polynomial features combinations.

_common_get_transform

_compute_balance

Computes weights difference.

_compute_strategy_coefficient

Creates a matrix

_constraint_association

Completes the constraint k-means.

_constraint_association_distance

Completes the constraint k-means, the function sorts points by distance to the closest cluster and associates …

_constraint_association_gain

Completes the constraint k-means. Follows the method described in Same-size k-Means Variation. …

_constraint_association_weights

Associates points to clusters.

_constraint_kmeans_weights

Runs KMeans iterator but weights cluster among them.

_decision_function_piecewise_estimator

_fit_piecewise_estimator

_get_column_name

Returns a unique column name not in the existing dataframe.

_get_test_instance

_get_tree

Returns the tree object.

_inertia

Computes total weighted inertia.

_init_centroids

Compute the initial centroids

_k_init

Init n_clusters seeds according to k-means++

_kmeans_single_lloyd

A single run of k-means, assumes preparation completed prior.

_labels_inertia

E step of the K-means EM algorithm. Computes the labels and the inertia of the given samples and centers. This …

_labels_inertia_precompute_dense

Computes labels and inertia using a full distance matrix. This will overwrite the ‘distances’ array in-place.

_labels_inertia_skl

E step of the K-means EM algorithm. Compute the labels and the inertia of the given samples and centers. This will …

_labels_inertia_weights

Computes weighted inertia. It also adds a fraction of the whole inertia depending on how balanced the clusters are. …

_pipeline_info

Internal function to convert a pipeline into some graph.

_predict_piecewise_estimator

_predict_proba_piecewise_estimator

_randomize_index

Randomizes index depending on the value. Swap indexes. Modifies index.

_setup_hook

if this function is added to the module, the help automation and unit tests call it first before anything goes on …

_switch_clusters

Tries to switch clusters. Modifies labels inplace.

_test_criterion_check

_test_criterion_check(Criterion criterion)

_test_criterion_impurity_improvement

_test_criterion_impurity_improvement(Criterion criterion, double impurity_parent, double impurity_left, double impurity_right) …

_test_criterion_init

_test_criterion_init(Criterion criterion, const DOUBLE_t[:,

_test_criterion_node_impurity

_test_criterion_node_impurity(Criterion criterion) Test purposes. Methods cannot be directly called from python.

_test_criterion_node_impurity_children

_test_criterion_node_impurity_children(Criterion criterion) Test purposes. Methods cannot be directly called from python. …

_test_criterion_node_value

_test_criterion_node_value(Criterion criterion) Test purposes. Methods cannot be directly called from python.

_test_criterion_printf

_test_criterion_printf(Criterion crit) Test purposes. Methods cannot be directly called from python.

_test_criterion_proxy_impurity_improvement

_test_criterion_proxy_impurity_improvement(Criterion criterion) Test purposes. Methods cannot be directly called from python. …

_test_criterion_update

_test_criterion_update(Criterion criterion, SIZE_t new_pos) Test purposes. Methods cannot be directly called from python. …

_tolerance

Return a tolerance which is independent of the dataset

_transform_iall

Computes the polynomial features

_transform_ionly

Computes the polynomial features

absolute_loss

Computes the absolute loss for regression.

aggregate_timeseries

Aggregates timeseries assuming the data is in a dataframe.

alter_pipeline_for_debugging

Overwrite methods transform, predict, predict_proba or decision_function to collect the last inputs and outputs …

artificial_data

Generates articial data every minutes.

assert_criterion_equal

assert_criterion_equal(Criterion c1, Criterion c2)

assert_estimator_equal

Checks that two models are equal.

build_ts_X_y

Builds standard X, y based in the given one.

check

Checks the library is working. It raises an exception. If you want to disable the logs:

check_ts_X_y

Checks that datasets (X, y) was built with function build_ts_X_y().

clone_with_fitted_parameters

Clones an estimator with the fitted results.

comparable_metric

Applies function on either the true target or/and the predictions before computing r2 score.

constraint_kmeans

Completes the constraint k-means.

constraint_predictions

Computes the predictions but tries to associates the same numbers of points in each cluster.

dgelss

dgelss(double[:,

digitize2tree

Builds a decision tree which returns the same result as lambda x: numpy.digitize(x, bins, right=right) (see numpy.digitize). …

enumerate_pipeline_models

Enumerates all the models within a pipeline.

find_ts_group_pattern

Clusters times series to find similar patterns.

float_sign

Returns 1 if a > 0, otherwise -1

format_function_call

Formats a function call with named parameters.

format_parameters

Formats a list of parameters.

format_value

Formats a value to be included in a string.

is_vector

Tells if X is a vector.

isskl023

Tells if scikit-learn is more recent than 0.23.

likelihood

Computes \sum_i y_i f(\theta (x_i - x_0)) + (1 - y_i) (1 - f(\theta (x_i - x_0))) where f(x_i) is \frac{1}{1 + e^{-x}}. …

linearize_matrix

Linearizes a matrix into a new one with 3 columns value, row, column. The output format is similar to :epkg:`csr_matrix`

logistic

Computes \frac{1}{1 + e^{-x}}.

model_featurizer

Converts a machine learned model into a function which converts a vector into features produced by the model. It …

model_featurizer_keras

Builds a featurizer from a keras model It returns a function which returns the output of one particular …

model_featurizer_lr

Builds a featurizer from a :epkg:`scikit-learn:linear_model:LogisticRegression`. It returns a function which returns …

model_featurizer_rfc

Builds a featurizer from a :epkg:`scikit-learn:ensemble:RandomForestClassifier`. It returns a function which returns …

model_featurizer_torch

Builds a featurizer from a torch model It returns a function which returns the output of one particular …

non_linear_correlations

Computes non linear correlations.

pipeline2dot

Exports a scikit-learn pipeline to DOT language. See Visualize a scikit-learn pipeline for an example.

pipeline2str

Exports a scikit-learn pipeline to text.

plot_gallery_images

Plots a gallery of images using matplotlib.

plot_week_timeseries

Shows a timeseries dispatched by days as bars.

predict_leaves

Returns the leave every observations of X falls into.

r2_score_comparable

Applies function on either the true target or/and the predictions before computing r2 score.

test_sklearn_clone

Tests that a cloned model is similar to the original one.

test_sklearn_grid_search_cv

Creates a model, checks that a grid search works with it.

test_sklearn_pickle

Creates a model, fit, predict and check the prediction are similar after the model was pickled, unpickled.

train_test_split_with_none

Splits into train and test data even if they are None.

tree_add_node

tree_add_node(tree, parent, is_left, is_leaf, feature, threshold, impurity, n_node_samples, weighted_n_node_samples) …

tree_find_common_node

Finds the common node to nodes i and j.

tree_find_path_to_root

Lists nodes involved into the path to find node i.

tree_leave_index

Returns the indices of every leave in a tree.

tree_leave_neighbors

The function determines which leaves are neighbors. The method uses some memory as it creates creates a grid of …

tree_node_parents

Returns a dictionary {node_id: parent_id}.

tree_node_range

Determines the ranges for a node all dimensions. nan means infinity.

ts_mape

Computes \frac{\sum_i | \hat{Y_t} - Y_t |} {\sum_i | Y_t - Y_{t-1} |}. It compares the prediction to what …

wrap_predict_keras

Checks types and dimension. Calls fct and returns the approriate type. A vector if X is a vector, the raw output …

wrap_predict_sklearn

Checks types and dimension. Calls fct and returns the approriate type. A vector if X is a vector, the raw output …

wrap_predict_torch

Checks types and dimension. Calls fct and returns the approriate type. A vector if X is a vector, the raw output …