From 04308d85062b46fa0ba49f604b7a0401f1cf594b Mon Sep 17 00:00:00 2001 From: Eduardo Blancas Date: Wed, 18 Sep 2024 10:07:10 -0600 Subject: [PATCH] remoes telemetry --- CHANGELOG.md | 2 ++ doc/reference/community.md | 3 --- src/sklearn_evaluation/plot/grid_search.py | 2 -- src/sklearn_evaluation/plot/ks_statistics.py | 2 -- src/sklearn_evaluation/plot/learning_curve.py | 2 -- src/sklearn_evaluation/plot/metrics.py | 2 -- src/sklearn_evaluation/plot/pca.py | 2 -- src/sklearn_evaluation/plot/precision_recall.py | 4 ---- src/sklearn_evaluation/plot/regression.py | 5 +---- src/sklearn_evaluation/plot/roc.py | 3 --- src/sklearn_evaluation/plot/target_analysis.py | 2 -- src/sklearn_evaluation/plot/validation_curve.py | 2 -- src/sklearn_evaluation/report/model_evaluator.py | 2 -- src/sklearn_evaluation/report/models_comparer.py | 2 -- src/sklearn_evaluation/report/report.py | 2 -- 15 files changed, 3 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ee258b..26906ca4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.12.2dev +- [Feature] Removes telemetry + ## 0.12.1 (2024-02-07) - [Feature] Adds `ploomber-extension` as dependency diff --git a/doc/reference/community.md b/doc/reference/community.md index a0ee4093..5471a3fd 100644 --- a/doc/reference/community.md +++ b/doc/reference/community.md @@ -4,6 +4,3 @@ [See here](https://docs.ploomber.io/en/latest/community/coc.html) -## Telemetry - -[See here](https://docs.ploomber.io/en/latest/community/user-stats.html) diff --git a/src/sklearn_evaluation/plot/grid_search.py b/src/sklearn_evaluation/plot/grid_search.py index f95a0d82..8901a104 100644 --- a/src/sklearn_evaluation/plot/grid_search.py +++ b/src/sklearn_evaluation/plot/grid_search.py @@ -7,7 +7,6 @@ import matplotlib.pyplot as plt import numpy as np from six import string_types -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from sklearn_evaluation.plot.matplotlib.bar import BarShifter @@ -50,7 +49,6 @@ def _validate_kind_input(kind, valid): validate.keys(valid, passed=kind, name="kind") -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def grid_search( cv_results_, change, subset=None, kind="line", cmap=None, ax=None, sort=True diff --git a/src/sklearn_evaluation/plot/ks_statistics.py b/src/sklearn_evaluation/plot/ks_statistics.py index 24ffb82e..a341cf47 100644 --- a/src/sklearn_evaluation/plot/ks_statistics.py +++ b/src/sklearn_evaluation/plot/ks_statistics.py @@ -29,7 +29,6 @@ import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import apply_theme @@ -141,7 +140,6 @@ def _binary_ks_curve(y_true, y_score): @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def ks_statistic( y_true, diff --git a/src/sklearn_evaluation/plot/learning_curve.py b/src/sklearn_evaluation/plot/learning_curve.py index 1d61ee95..83c33516 100644 --- a/src/sklearn_evaluation/plot/learning_curve.py +++ b/src/sklearn_evaluation/plot/learning_curve.py @@ -1,12 +1,10 @@ import numpy as np import matplotlib.pyplot as plt -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import apply_theme @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def learning_curve(train_scores, test_scores, train_sizes, ax=None): """Plot a learning curve diff --git a/src/sklearn_evaluation/plot/metrics.py b/src/sklearn_evaluation/plot/metrics.py index 2556d5fc..b18eb133 100644 --- a/src/sklearn_evaluation/plot/metrics.py +++ b/src/sklearn_evaluation/plot/metrics.py @@ -1,12 +1,10 @@ import numpy as np from sklearn_evaluation.metrics import compute_at_thresholds from sklearn_evaluation.plot.util import set_default_ax -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from ploomber_core.exceptions import modify_exceptions @set_default_ax -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def metrics_at_thresholds(fn, y_true, y_score, n_thresholds=10, start=0.0, ax=None): """Plot metrics at increasing thresholds""" diff --git a/src/sklearn_evaluation/plot/pca.py b/src/sklearn_evaluation/plot/pca.py index 64ae51a7..756ef24d 100644 --- a/src/sklearn_evaluation/plot/pca.py +++ b/src/sklearn_evaluation/plot/pca.py @@ -1,6 +1,5 @@ from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import apply_theme, get_color_palette @@ -38,7 +37,6 @@ def _validate_inputs(X, n_components, target_names, colors, ax): @apply_theme() @modify_exceptions -@SKLearnEvaluationLogger.log(feature="plot") def pca(X, y=None, target_names=None, n_components=2, colors=None, ax=None): """ Plot principle component analysis curve. diff --git a/src/sklearn_evaluation/plot/precision_recall.py b/src/sklearn_evaluation/plot/precision_recall.py index ce70e3cf..5b89c07d 100644 --- a/src/sklearn_evaluation/plot/precision_recall.py +++ b/src/sklearn_evaluation/plot/precision_recall.py @@ -4,7 +4,6 @@ from sklearn.metrics import auc from sklearn.metrics import precision_recall_curve from sklearn.preprocessing import label_binarize -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from sklearn_evaluation.util import is_column_vector, is_row_vector from sklearn_evaluation.plot.plot import AbstractComposedPlot, AbstractPlot from sklearn_evaluation import __version__ @@ -133,7 +132,6 @@ class PrecisionRecall(AbstractPlot): """ @modify_exceptions - @SKLearnEvaluationLogger.log(feature="plot", action="precision-recall-init") def __init__(self, precision, recall, label=None): self.precision = precision self.recall = recall @@ -204,7 +202,6 @@ def plot(self, ax=None): def _from_data(cls): pass - @SKLearnEvaluationLogger.log(feature="plot", action="precision-recall-add") def __add__(self, another): return PrecisionRecallAdd( precisions=[self.precision, another.precision], @@ -327,7 +324,6 @@ def plot(self, ax=None): @modify_exceptions -@SKLearnEvaluationLogger.log(feature="plot") def precision_recall(y_true, y_score, ax=None): """ Plot precision-recall curve. diff --git a/src/sklearn_evaluation/plot/regression.py b/src/sklearn_evaluation/plot/regression.py index c31c98a4..d1500c48 100644 --- a/src/sklearn_evaluation/plot/regression.py +++ b/src/sklearn_evaluation/plot/regression.py @@ -22,7 +22,7 @@ import numpy as np import pandas as pd -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger + from sklearn.linear_model import LinearRegression from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import apply_theme, get_color_palette @@ -43,7 +43,6 @@ def _check_parameter_validity(y_true, y_pred): @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def residuals(y_true, y_pred, ax=None): """ @@ -89,7 +88,6 @@ def residuals(y_true, y_pred, ax=None): @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def prediction_error(y_true, y_pred, ax=None): """ @@ -157,7 +155,6 @@ def prediction_error(y_true, y_pred, ax=None): @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def cooks_distance(X, y, ax=None): """Plots cooks distance. diff --git a/src/sklearn_evaluation/plot/roc.py b/src/sklearn_evaluation/plot/roc.py index c0e89b0b..bd02a8d3 100644 --- a/src/sklearn_evaluation/plot/roc.py +++ b/src/sklearn_evaluation/plot/roc.py @@ -2,7 +2,6 @@ import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc from sklearn.preprocessing import label_binarize, LabelBinarizer -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from sklearn_evaluation.util import ( is_column_vector, is_row_vector, @@ -350,7 +349,6 @@ class ROC(AbstractPlot): .. versionadded:: 0.8.4 """ - @SKLearnEvaluationLogger.log(feature="plot", action="roc-init") @modify_exceptions def __init__(self, fpr, tpr, label=None): if fpr is None or tpr is None: @@ -389,7 +387,6 @@ def __init__(self, fpr, tpr, label=None): self.tpr = tpr self.label = label - @SKLearnEvaluationLogger.log(feature="plot", action="roc-add") def __add__(self, other): roc_add_result = ROCAdd(self, other) roc_add_result.plot() diff --git a/src/sklearn_evaluation/plot/target_analysis.py b/src/sklearn_evaluation/plot/target_analysis.py index 0d93668f..bd314012 100644 --- a/src/sklearn_evaluation/plot/target_analysis.py +++ b/src/sklearn_evaluation/plot/target_analysis.py @@ -20,7 +20,6 @@ import numpy as np import matplotlib.pyplot as plt -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from sklearn.utils.multiclass import unique_labels, type_of_target from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import get_color_palette, apply_theme @@ -42,7 +41,6 @@ def _validate_target(y): @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def target_analysis(y_train, y_test=None, labels=None, colors=None, ax=None): """Target analysis plot for visualising class imbalance. diff --git a/src/sklearn_evaluation/plot/validation_curve.py b/src/sklearn_evaluation/plot/validation_curve.py index 8c0d6058..69b8aca9 100644 --- a/src/sklearn_evaluation/plot/validation_curve.py +++ b/src/sklearn_evaluation/plot/validation_curve.py @@ -1,12 +1,10 @@ import numpy as np import matplotlib.pyplot as plt -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger from ploomber_core.exceptions import modify_exceptions from sklearn_evaluation.plot.style import apply_theme @apply_theme() -@SKLearnEvaluationLogger.log(feature="plot") @modify_exceptions def validation_curve( train_scores, test_scores, param_range, param_name=None, semilogx=False, ax=None diff --git a/src/sklearn_evaluation/report/model_evaluator.py b/src/sklearn_evaluation/report/model_evaluator.py index 2e6d45ff..dfc98500 100644 --- a/src/sklearn_evaluation/report/model_evaluator.py +++ b/src/sklearn_evaluation/report/model_evaluator.py @@ -11,7 +11,6 @@ from sklearn_evaluation.report import ModelHeuristics, ReportSection import time import numpy as np -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger COMMUNITY_LINK = "https://ploomber.io/community" @@ -276,7 +275,6 @@ def check_array_balance(self, array) -> bool: return all(expected_range.in_range(w) for w in weights) -@SKLearnEvaluationLogger.log(feature="report", action="evaluate_model") def evaluate_model(model, y_true, y_pred, X_test=None, y_score=None, report_title=None): """ Evaluates a given model and generates an HTML report diff --git a/src/sklearn_evaluation/report/models_comparer.py b/src/sklearn_evaluation/report/models_comparer.py index a1d98c9b..327a1191 100644 --- a/src/sklearn_evaluation/report/models_comparer.py +++ b/src/sklearn_evaluation/report/models_comparer.py @@ -1,7 +1,6 @@ from sklearn_evaluation import plot from sklearn_evaluation.report.util import run_if_args_are_not_none, check_model from sklearn_evaluation.report import ModelHeuristics, ReportSection, ModelEvaluator -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger class ModelsComparer(ModelHeuristics): @@ -217,7 +216,6 @@ def add_combined_pr(self, X_test, y_true): self._add_section_to_report(combined_pr_section) -@SKLearnEvaluationLogger.log(feature="report", action="compare_models") def compare_models(model_a, model_b, X_test, y_true, report_title=None): """ Compares two models and generates an HTML report diff --git a/src/sklearn_evaluation/report/report.py b/src/sklearn_evaluation/report/report.py index fc245014..fdbb2fcf 100644 --- a/src/sklearn_evaluation/report/report.py +++ b/src/sklearn_evaluation/report/report.py @@ -1,6 +1,5 @@ from jinja2 import Template from pathlib import Path -from sklearn_evaluation.telemetry import SKLearnEvaluationLogger try: import mistune @@ -36,6 +35,5 @@ def __init__(self, evaluator, template=None): def _repr_html_(self): return self.rendered - @SKLearnEvaluationLogger.log(feature="report", action="save") def save(self, path): Path(path).write_text(self.rendered)