From 4dbe16863a7a3e78eb9ef08ff3214958013f09f1 Mon Sep 17 00:00:00 2001 From: yaniv-shulman <145748670+yaniv-shulman@users.noreply.github.com> Date: Mon, 27 Nov 2023 11:12:40 +0800 Subject: [PATCH] Bootstrap inference (#11) * Added bootstrap inference and confidence intervals. * Added coverage to tests and related configuration. Added xdist to run tests in parallel and slow markers. * Changes to tests to use parameterization and more unit tests. * Changed README.md to focus on users and added CONTRIBUTE.md. Added an example basic usage notebook in docs. --- .gitignore | 2 + CONTRIBUTE.md | 147 + README.md | 178 +- docs/usage.ipynb | 9058 +++++++++++++++++++++++++++++ poetry.lock | 307 +- pyproject.toml | 15 +- src/rsklpr/rsklpr.py | 127 +- tests/rsklpr_tests/test_rsklpr.py | 482 +- 8 files changed, 9846 insertions(+), 470 deletions(-) create mode 100644 CONTRIBUTE.md create mode 100644 docs/usage.ipynb diff --git a/.gitignore b/.gitignore index 9474e77..7eb9f13 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ +.coverage .ipynb_checkpoints/ *.html .ruff_cache/ .mypy_cache/ +.pytest_cache/ /dist/ # Compiled Python bytecode diff --git a/CONTRIBUTE.md b/CONTRIBUTE.md new file mode 100644 index 0000000..f37456c --- /dev/null +++ b/CONTRIBUTE.md @@ -0,0 +1,147 @@ +# Robust Local Polynomial Regression with Similarity Kernels # + +This repository is intended to share and facilitate community contribution for completing the research and implementation +presented in the [Robust Local Polynomial Regression with Similarity Kernels draft paper](https://github.com/yaniv-shulman/rsklpr/tree/main/paper/rsklpr.pdf). The repository contains +the source for the paper and a demonstrative implementation of the proposed method including several experimental results. +Note the paper is a draft and the code is for demonstrative purposes still so both may contain issues. + +### Contribution and feedback ### + +Contributions and feedback are most welcome to the paper and code in any area related to: +- Further development of the method and completing the paper: + - Asymptotic analysis of the estimator + - Improving related work coverage + - Improving or adding experiments and the presentation of experiments including comparison to other robust LPR methods + - Experimenting with robust estimators e.g. robust losses, robust bandwidth estimators and robust KDEs + - Proposing and experimenting with different similarity kernels + - Fixing issues if found +- Adding and improving functions in the implementation: + - Proposing and experimenting with additional kernels + - Improving numerical stability + - Removing statsmodels dependency + - Implementing in other languages + - Speed and multiprocessing +- Productionzing the code: + - Improving input checks and error handling + - Tests + - Logging + - Automation +- And more... + +To contribute please submit a pull request, create an issue or get in touch by email to the address specified in the +paper. + +### How do I get set up? ### +The easiest way to setup for development or explore the code is to create or activate a Poetry virtual environment by +executing configure.sh. The included development environment uses Python 3.8 or higher, and Poetry 1.6.1 or higher is recommended. +If you require any help getting setup please get in touch by email to the address specified in the paper. + +### Example usage for developers ### + +```python +import numpy as np +import pandas as pd + +from experiments.common import plot_results, ExperimentConfig +from experiments.data.synthetic_benchmarks import benchmark_curve_1 +from rsklpr.rsklpr import Rsklpr + +experiment_config: ExperimentConfig = ExperimentConfig( + data_provider=benchmark_curve_1, + size_neighborhood=20, + noise_ratio=0.3, + hetero=True, + num_points=150, + bw1=[0.4], + bw2="normal_reference", + k2="joint", +) + +x: np.ndarray +y: np.ndarray +y_true: np.ndarray + +x, y, y_true = experiment_config.data_provider( + experiment_config.noise_ratio, + experiment_config.hetero, + experiment_config.num_points, +) + +rsklpr: Rsklpr = Rsklpr( + size_neighborhood=experiment_config.size_neighborhood, + bw1=experiment_config.bw1, + bw2=experiment_config.bw2, +) + +y_hat: np.ndarray = rsklpr( + x=x, + y=y, +) + +estimates: pd.DataFrame = pd.DataFrame(data=y_hat, columns=["y_hat"]) + +plot_results( + x=x, + y=y, + y_true=y_true, + estimates=estimates, + title="Example usage", +) +``` +![Example usage curve_plot](./example_usage_curve.png) + + +```python +import numpy as np +import pandas as pd + +from experiments.common import plot_results, ExperimentConfig +from experiments.data.synthetic_benchmarks import benchmark_plane_2 +from rsklpr.rsklpr import Rsklpr + +experiment_config: ExperimentConfig = ExperimentConfig( + data_provider=benchmark_plane_2, + size_neighborhood=20, + noise_ratio=0.1, + hetero=True, + num_points=100, + bw1=[0.4], + bw2="normal_reference", + k2="joint", +) + +x: np.ndarray +y: np.ndarray +y_true: np.ndarray + +x, y, y_true = experiment_config.data_provider( + experiment_config.noise_ratio, + experiment_config.hetero, + experiment_config.num_points, +) + +rsklpr: Rsklpr = Rsklpr( + size_neighborhood=experiment_config.size_neighborhood, + bw1=experiment_config.bw1, + bw2=experiment_config.bw2, +) + +y_hat: np.ndarray = rsklpr( + x=x, + y=y, +) + +estimates: pd.DataFrame = pd.DataFrame(data=y_hat, columns=["y_hat"]) + +plot_results( + x=x, + y=y, + y_true=y_true, + estimates=estimates, + title="Example usage", +) +``` +![Example usage plane_plot](./example_usage_plane.png) +### Experimental results ### +The experimental results are available as interactive Jupyter notebooks at +https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/src/experiments/ diff --git a/README.md b/README.md index 0ba39fc..8b0f5e3 100644 --- a/README.md +++ b/README.md @@ -1,147 +1,47 @@ # Robust Local Polynomial Regression with Similarity Kernels # -This repository is intended to share and facilitate community contribution for completing the research and implementation -presented in the [Robust Local Polynomial Regression with Similarity Kernels draft paper](https://github.com/yaniv-shulman/rsklpr/tree/main/paper/rsklpr.pdf). The repository contains -the source for the paper and a demonstrative implementation of the proposed method including several experimental results. -Note the paper is a draft and the code is for demonstrative purposes still so both may contain issues. - -### Contribution and feedback ### - -Contributions and feedback are most welcome to the paper and code in any area related to: -- Further development of the method and completing the paper: - - Asymptotic analysis of the estimator - - Improving related work coverage - - Improving or adding experiments and the presentation of experiments including comparison to other robust LPR methods - - Experimenting with robust estimators e.g. robust losses, robust bandwidth estimators and robust KDEs - - Proposing and experimenting with different similarity kernels - - Fixing issues if found -- Adding and improving functions in the implementation: - - Proposing and experimenting with additional kernels - - Improving numerical stability - - Confidence intervals - - Implementing in other languages - - Speed and multiprocessing -- Productionzing the code: - - Improving input checks and error handling - - Tests - - Logging - - Automation -- And more... - -To contribute please submit a pull request, create an issue or get in touch by email to the address specified in the -paper. - -### How do I get set up? ### -The easiest way to setup for development or explore the code is to create or activate a Poetry virtual environment by -executing configure.sh. The included development environment uses Python 3.8 or higher, and Poetry 1.6.1 or higher is recommended. -If you require any help getting setup please get in touch by email to the address specified in the paper. - -### Example usage for developers ### - -```python -import numpy as np -import pandas as pd - -from experiments.common import plot_results, ExperimentConfig -from experiments.data.synthetic_benchmarks import benchmark_curve_1 -from rsklpr.rsklpr import Rsklpr - -experiment_config: ExperimentConfig = ExperimentConfig( - data_provider=benchmark_curve_1, - size_neighborhood=20, - noise_ratio=0.3, - hetero=True, - num_points=150, - bw1=[0.4], - bw2="normal_reference", - k2="joint", -) - -x: np.ndarray -y: np.ndarray -y_true: np.ndarray - -x, y, y_true = experiment_config.data_provider( - experiment_config.noise_ratio, - experiment_config.hetero, - experiment_config.num_points, -) - -rsklpr: Rsklpr = Rsklpr( - size_neighborhood=experiment_config.size_neighborhood, - bw1=experiment_config.bw1, - bw2=experiment_config.bw2, -) - -y_hat: np.ndarray = rsklpr( - x=x, - y=y, -) - -estimates: pd.DataFrame = pd.DataFrame(data=y_hat, columns=["y_hat"]) - -plot_results( - x=x, - y=y, - y_true=y_true, - estimates=estimates, - title="Example usage", -) +## TL;DR ## +This library is useful to perform regression when: +1. There are no particular assumptions on the underlying function except that it is "reasonably smooth". In particular, +you don't know which parametric model to specify or if an appropriate model exists. +1. There are no particular assumptions on the type and intensity of noise present. +1. There are no particular assumptions on the presence of outliers and their extent. +1. You may want to predict in locations not explicitly present in the dataset but also not too far from existing +observations or far outside the areas where observations exist. +1. The independent inputs are univariate or multivariate. +1. The dependent variable is univariate. +1. You want a straightforward hassle-free way to tune the model and the smoothness of fit. +1. You may want to calculate confidence intervals. + +If the above use cases hold then this library could be useful for you. Have a look at this notebook +https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/docs/usage.ipynb for an example of how to use +this library to perform regression easily. + +## Installation ## +Install from [PyPI](https://pypi.org/project/rsklpr/) using pip (preferred method): +```bash +pip install rsklpr ``` -![Example usage curve_plot](./example_usage_curve.png) - - -```python -import numpy as np -import pandas as pd - -from experiments.common import plot_results, ExperimentConfig -from experiments.data.synthetic_benchmarks import benchmark_plane_2 -from rsklpr.rsklpr import Rsklpr -experiment_config: ExperimentConfig = ExperimentConfig( - data_provider=benchmark_plane_2, - size_neighborhood=20, - noise_ratio=0.1, - hetero=True, - num_points=100, - bw1=[0.4], - bw2="normal_reference", - k2="joint", -) +## Details ## +Local polynomial regression (LPR) is a powerful and flexible statistical technique that has gained increasing popularity +in recent years due to its ability to model complex relationships between variables. Local polynomial regression +generalizes the polynomial regression and moving average methods by fitting a low-degree polynomial to a nearest +neighbors subset of the data at the location. The polynomial is fitted using weighted ordinary least squares, giving +more weight to nearby points and less weight to points further away. Local polynomial regression is however susceptible +to outliers and high leverage points which may cause an adverse impact on the estimation accuracy. This library +implements a variant of LPR presented in the +[Robust Local Polynomial Regression with Similarity Kernels draft paper](https://github.com/yaniv-shulman/rsklpr/tree/main/paper/rsklpr.pdf) which uses a generalized similarity kernel +that assign robust weights to mitigate the adverse effect of outliers in the local neighborhood by estimating and +utilizing the density at the local locations. -x: np.ndarray -y: np.ndarray -y_true: np.ndarray -x, y, y_true = experiment_config.data_provider( - experiment_config.noise_ratio, - experiment_config.hetero, - experiment_config.num_points, -) - -rsklpr: Rsklpr = Rsklpr( - size_neighborhood=experiment_config.size_neighborhood, - bw1=experiment_config.bw1, - bw2=experiment_config.bw2, -) - -y_hat: np.ndarray = rsklpr( - x=x, - y=y, -) +### Experimental results ### +The experimental results and demonstration of the library for various experimental settings are available as interactive +Jupyter notebooks at https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/src/experiments/ -estimates: pd.DataFrame = pd.DataFrame(data=y_hat, columns=["y_hat"]) -plot_results( - x=x, - y=y, - y_true=y_true, - estimates=estimates, - title="Example usage", -) -``` -![Example usage plane_plot](./example_usage_plane.png) -### Experimental results ### -The experimental results are available as interactive Jupyter notebooks at -https://nbviewer.org/github/yaniv-shulman/rsklpr/tree/main/src/experiments/ +## Contribution and feedback ## +The paper is work in progress and the library in early stages of development but both are in a useful state. +Contributions and feedback are most welcome both to the paper and the code. Please see +[CONTRIBUTE.md](https://github.com/yaniv-shulman/rsklpr/tree/main/CONTRIBUTE.md) for further details. diff --git a/docs/usage.ipynb b/docs/usage.ipynb new file mode 100644 index 0000000..9386838 --- /dev/null +++ b/docs/usage.ipynb @@ -0,0 +1,9058 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "source": [ + "# Basic usage example #\n", + "This notebook demonstrates how to use the library to perform regression without delving into technical details. The interested reader is referred to the [Robust Local Polynomial Regression with Similarity Kernels draft paper](https://github.com/yaniv-shulman/rsklpr/tree/main/paper/rsklpr.pdf). It is assumed that the library is installed in the environment that you are using. You can install the library from [PyPI](https://pypi.org/project/rsklpr/) using pip:\n", + "```bash\n", + "pip install rsklpr\n", + "```\n", + "\n", + "To begin lets define a function that generates some data to perform regression on." + ], + "metadata": { + "collapsed": false + }, + "id": "df4e8b96e11d5b55" + }, + { + "cell_type": "code", + "execution_count": 1, + "outputs": [], + "source": [ + "from typing import Tuple\n", + "\n", + "import numpy as np\n", + "\n", + "\n", + "def benchmark_curve_1(noise_ratio: float, hetero: bool, num_points: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:\n", + " \"\"\"\n", + " Generates a dataset of points sampled from smooth curve with added noise. In the case of heteroscedastic noise the\n", + " noise scale is sampled from a uniform distribution up to noise_ratio of the response range.\n", + "\n", + " Args:\n", + " noise_ratio: The ratio of noise of the response range used to generate noise.\n", + " hetero: True to generate heteroscedastic noise, False for homoscedastic noise.\n", + " num_points: The number of points sampled from the curve.\n", + "\n", + " Returns:\n", + " The predictor, response and ground truth.\n", + " \"\"\"\n", + " generator: np.random.Generator = np.random.default_rng(seed=14)\n", + " x_: np.ndarray = np.linspace(start=0.0, stop=1.0, num=num_points)\n", + " x_ += generator.normal(scale=1 / np.sqrt(num_points), size=x_.shape[0])\n", + " sort_idx: np.ndarray = np.argsort(a=x_)\n", + " x_ = x_[sort_idx]\n", + "\n", + " y_true_: np.ndarray = np.sqrt(np.abs(np.power(x_, 3) - 4 * np.power(x_, 4) / 3)) + (\n", + " 0.31 * x_ / np.max(x_) * np.sin(x_ * 3 * np.pi) * np.sin(x_ * 3 * np.pi)\n", + " )\n", + "\n", + " scale: np.ndarray\n", + "\n", + " if hetero:\n", + " scale = generator.uniform(low=0.001, high=noise_ratio * (y_true_.max() - y_true_.min()), size=x_.shape[0])\n", + " else:\n", + " scale = np.full(shape=x_.shape[0], fill_value=noise_ratio * (y_true_.max() - y_true_.min()))\n", + "\n", + " y_: np.ndarray = y_true_ + generator.normal(scale=scale)\n", + "\n", + " return (\n", + " x_,\n", + " y_,\n", + " y_true_,\n", + " )" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:31.159270970Z", + "start_time": "2023-11-27T02:50:31.006545617Z" + } + }, + "id": "c23ce514f76767a1" + }, + { + "cell_type": "markdown", + "source": [ + "Next, define a function to plot our data and regression results." + ], + "metadata": { + "collapsed": false + }, + "id": "eec286e69027c48e" + }, + { + "cell_type": "code", + "execution_count": 2, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from typing import Optional\n", + "import plotly\n", + "import plotly.graph_objects as go\n", + "\n", + "\n", + "def plot_results_1d(\n", + " x_: np.ndarray,\n", + " y_: np.ndarray,\n", + " y_true_: Optional[np.ndarray] = None,\n", + " estimates_: Optional[pd.DataFrame] = None,\n", + " title: str = \"\",\n", + ") -> None:\n", + " \"\"\"\n", + " Plots a scatter plot of all columns in the provided dataframe where each column is treated as a separate variable.\n", + " It is assumed all plots share the same x coordinates.\n", + "\n", + " Args:\n", + " x_: The predictors X for all observations with shape [N,K] where N is the number of observations and K is the\n", + " dimension of X.\n", + " y_: The corresponding response for all observations.\n", + " y_true_: The ground truth response at the locations x.\n", + " estimates_: The estimates y_hat given x. it is assumed each column in the dataframe is the results of a\n", + " different estimator.\n", + " title: The plot title.\n", + " \"\"\"\n", + " fig = go.Figure()\n", + " fig.add_trace(go.Scatter(x=x_, y=y_, mode=\"markers\", name=\"data\"))\n", + "\n", + " if y_true_ is not None:\n", + " fig.add_trace(go.Scatter(x=x_, y=y_true_, mode=\"markers\", name=\"y_true\"))\n", + "\n", + " if estimates_ is not None:\n", + " for c in estimates_.columns:\n", + " fig.add_trace(go.Scatter(x=estimates_.index, y=estimates_[c], mode=\"lines+markers\", name=c))\n", + "\n", + " fig.update_layout(\n", + " go.Layout(\n", + " title=title,\n", + " autosize=True,\n", + " height=500,\n", + " )\n", + " )\n", + "\n", + " plotly.offline.iplot(fig)" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:31.322576904Z", + "start_time": "2023-11-27T02:50:31.174121757Z" + } + }, + "id": "5f700b91e93981d2" + }, + { + "cell_type": "markdown", + "source": [ + "We can now use the function to generate some data as well as the ground truth and plot it." + ], + "metadata": { + "collapsed": false + }, + "id": "f1e0d62ded816bef" + }, + { + "cell_type": "code", + "execution_count": 3, + "outputs": [], + "source": [ + "x: np.ndarray\n", + "y: np.ndarray\n", + "y_true: np.ndarray\n", + "\n", + "x, y, y_true = benchmark_curve_1(noise_ratio=0.15, hetero=True, num_points=100)" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:31.335238675Z", + "start_time": "2023-11-27T02:50:31.327620105Z" + } + }, + "id": "ee4eeaea95e7b19c" + }, + { + "cell_type": "code", + "execution_count": 4, + "outputs": [ + { + "data": { + "text/html": " \n " + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Generated noisy data and ground truth" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plot_results_1d(x_=x, y_=y, y_true_=y_true, title=\"Generated noisy data and ground truth\")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:31.677200870Z", + "start_time": "2023-11-27T02:50:31.339450648Z" + } + }, + "id": "fc461aed32a8612d" + }, + { + "cell_type": "markdown", + "source": [ + "To perform regression we need to instantiate a Rsklpr object, fit the data and predict the outputs. The main parameter that requires attention and has the largest impact is the size_neighborhood. Having a larger neighborhood thus including more datapoints results in a smoother estimate with lower variance but increases the bias. Let's regress the data with a few neighborhood sizes to see the impact." + ], + "metadata": { + "collapsed": false + }, + "id": "4aa77d4228643ac4" + }, + { + "cell_type": "code", + "execution_count": 5, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "y_hat", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.08693539645809177, + 0.045460834747357654, + 0.05173413416379722, + 0.029686350695720225, + 0.0493064643793321, + 0.0482866607140492, + 0.034999053414197845, + 0.016320346216321044, + 0.022353491172447913, + 0.06366408701744372, + 0.06625371912593196, + 0.07448747161114735, + 0.07417099980787353, + 0.0765857117167782, + 0.11058316956608578, + 0.11262540072751356, + 0.1166777537087029, + 0.1176457728305672, + 0.1280926769345281, + 0.13665526210507528, + 0.14524738641639448, + 0.14519003728544239, + 0.14556749355782497, + 0.14658818385905886, + 0.1494937030947727, + 0.14966961633344655, + 0.1500162788824595, + 0.15177461928766903, + 0.1540641727395877, + 0.15443169514488947, + 0.1561792513990408, + 0.1569449211640406, + 0.1771144186601939, + 0.21041675747674124, + 0.21669990087682064, + 0.2205292303676713, + 0.22331745943415837, + 0.23182235180694033, + 0.23793471326018098, + 0.24380523940636098, + 0.24533005906509442, + 0.25291124648692465, + 0.2897416407548251, + 0.2928572582052692, + 0.3078840387802713, + 0.31171154232069914, + 0.3130412118003125, + 0.3158347233704571, + 0.31877167640021997, + 0.3244465587610434, + 0.32615554461370044, + 0.33691505529901716, + 0.31514339740082126, + 0.31283890889281374, + 0.31159478930272244, + 0.3097118082805911, + 0.2838310566437499, + 0.2779004097490117, + 0.2759061830100618, + 0.27358311600251617, + 0.26767590445427886, + 0.26496095788799706, + 0.26472448067265564, + 0.26167285684233577, + 0.2402799620715758, + 0.23700112362288211, + 0.23645037853387896, + 0.23118028893678802, + 0.17705027633802808, + 0.1735578350947157, + 0.17099655767333696, + 0.173800311645212, + 0.1627460215960237, + 0.16284563004567743, + 0.16498313630743144, + 0.16565815320355431, + 0.18361560425743478, + 0.1856611345192941, + 0.18802686988534045, + 0.194307770622674, + 0.39149725038067373, + 0.41301982335868753, + 0.440257129857571, + 0.46670777640683175, + 0.5141042632242714, + 0.5217996044687792, + 0.5222702031165762, + 0.5307600669911673, + 0.5324346389210849, + 0.5413380170214068, + 0.5424660649189854, + 0.5467875255576473, + 0.5491871263897349, + 0.5565480962156579, + 0.5755924464368548, + 0.5797835088643332, + 0.5850039987841178, + 0.6220268164712706, + 0.6847268121681429, + 0.7859265256611015 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Regression with size_neighborhood=30" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from rsklpr.rsklpr import Rsklpr\n", + "\n", + "rsklpr: Rsklpr = Rsklpr(size_neighborhood=30)\n", + "y_hat: np.ndarray = rsklpr(x=x, y=y)\n", + "plot_results_1d(\n", + " x_=x,\n", + " y_=y,\n", + " y_true_=y_true,\n", + " estimates_=pd.DataFrame(data=y_hat, columns=[\"y_hat\"], index=x),\n", + " title=\"Regression with size_neighborhood=30\",\n", + ")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:32.373953018Z", + "start_time": "2023-11-27T02:50:31.803532494Z" + } + }, + "id": "b170de3a00f5ae5c" + }, + { + "cell_type": "markdown", + "source": [ + "Note that calling the model directly as ```python rsklpr(x=x, y=y) ``` is a shortform for calling fit and predict on all locations given in the dataset. We can also make the curve smoother by increasing the number of datapoints in the neighborhood. " + ], + "metadata": { + "collapsed": false + }, + "id": "9b6c300b7b1797a0" + }, + { + "cell_type": "code", + "execution_count": 6, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "y_hat", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.052865748864498366, + 0.03774968288814318, + 0.04238464184937269, + 0.02092231068434152, + 0.035938865391689404, + 0.036433766935911265, + 0.03756985457063519, + 0.046170622920938195, + 0.05061108020154634, + 0.07845126146268071, + 0.08067713445720298, + 0.08765688456287286, + 0.09092624932913113, + 0.09262683862219906, + 0.11043789597719061, + 0.11290358798991026, + 0.11943082882118089, + 0.1177443022168739, + 0.12632034913133322, + 0.1303860729744926, + 0.1397967324089767, + 0.1407091309324106, + 0.1436635198398315, + 0.14672612818553066, + 0.15202256844283935, + 0.152476919764446, + 0.1531513517917394, + 0.1558356491600239, + 0.15951626433563126, + 0.16476636917580206, + 0.162975935991337, + 0.1645433402900232, + 0.18170398500547097, + 0.2035166080258515, + 0.20928805716767185, + 0.2133191869376616, + 0.2156367663725815, + 0.22188633120299311, + 0.22639203043124623, + 0.23279585047933066, + 0.23523261107040053, + 0.24635853638332716, + 0.2836350108736574, + 0.2867524433643722, + 0.29658617534281273, + 0.2983210350708149, + 0.2987715127285797, + 0.30003655204515545, + 0.30156040089793723, + 0.3042057227381896, + 0.3063594965457026, + 0.3147764783891575, + 0.3098870096956018, + 0.3087481214017048, + 0.30782872548047957, + 0.30530898556784425, + 0.27286801567506436, + 0.2676905956811702, + 0.26507655172066824, + 0.2611837087782803, + 0.258372352236219, + 0.25712683733075836, + 0.2570186661921152, + 0.2541539429585812, + 0.24153607456903414, + 0.23893888227530616, + 0.2384701776820904, + 0.23407987582816403, + 0.20525410619095963, + 0.20271856012816558, + 0.19876296815038758, + 0.1802172853476568, + 0.18107377790522844, + 0.18113896667081353, + 0.182433185614921, + 0.1828434713826464, + 0.19445226748952563, + 0.19665177625154773, + 0.19953875543964728, + 0.20735719152870594, + 0.418459926742759, + 0.4401694064298065, + 0.46155445384005295, + 0.48325232522143824, + 0.5139023471917296, + 0.5246536513781948, + 0.5251861478143851, + 0.5332125274402176, + 0.5345038132384837, + 0.5413064982467475, + 0.542184592521426, + 0.5458825255106422, + 0.5481376832262463, + 0.553136287699672, + 0.5668647658512889, + 0.5706142463493856, + 0.5755787561708559, + 0.6034478027332153, + 0.6549178427677869, + 0.7902412075014402 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Regression with size_neighborhood=60" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "rsklpr = Rsklpr(size_neighborhood=60)\n", + "y_hat = rsklpr(x=x, y=y)\n", + "plot_results_1d(\n", + " x_=x,\n", + " y_=y,\n", + " y_true_=y_true,\n", + " estimates_=pd.DataFrame(data=y_hat, columns=[\"y_hat\"], index=x),\n", + " title=\"Regression with size_neighborhood=60\",\n", + ")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:32.490381264Z", + "start_time": "2023-11-27T02:50:32.377339525Z" + } + }, + "id": "119f22f68c8526ce" + }, + { + "cell_type": "code", + "execution_count": 7, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "y_hat", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.06787252233434321, + 0.04769586243876647, + 0.048760319473612826, + 0.04126779838611459, + 0.04813440533737545, + 0.048519589266502, + 0.05118614819744777, + 0.06334917379323118, + 0.06616960755935228, + 0.08570322219737744, + 0.08755366687852131, + 0.09335386684166297, + 0.09604263125420082, + 0.09742661715593802, + 0.1117927174557347, + 0.11391636515277198, + 0.11970717916019988, + 0.12321131423024953, + 0.12952980324931287, + 0.13221434352311137, + 0.13817275691733613, + 0.13876258024989716, + 0.14067156485492413, + 0.1426103402020963, + 0.14589389929587349, + 0.14608936865278316, + 0.14638148582330934, + 0.14779765751532142, + 0.15541516891786267, + 0.16031551382295073, + 0.16261756342460343, + 0.16383349284657497, + 0.17555590031716967, + 0.19109215238013785, + 0.1955463772849971, + 0.19969543564705408, + 0.20166937351240696, + 0.20754398350905084, + 0.2122202842314957, + 0.2212369069941523, + 0.22487175599373527, + 0.23897140690815927, + 0.2657538313641318, + 0.2690730449932397, + 0.2814627523531423, + 0.28462729437535444, + 0.28558630891105463, + 0.2883514798680143, + 0.2910792748806703, + 0.2968069790609054, + 0.29843251393575954, + 0.3025606093120127, + 0.2981555102850228, + 0.2966514940336805, + 0.29548370257349305, + 0.292325924546414, + 0.2661473358626857, + 0.2626309873756484, + 0.2607637901767097, + 0.25810942411371784, + 0.2564573987044126, + 0.25575738537256515, + 0.2556976388475644, + 0.25418344285975125, + 0.24815763698936777, + 0.2470246291878315, + 0.2468211826027868, + 0.24494580712881542, + 0.23244846616123208, + 0.23108661780898826, + 0.2292909974339023, + 0.21982036289264745, + 0.22595244219434887, + 0.22612809637281828, + 0.229164717592044, + 0.23004675494209853, + 0.24794513644459046, + 0.2504043581651002, + 0.2533731551153642, + 0.2604329055480365, + 0.38812965861479587, + 0.41133978998798204, + 0.43946938739988617, + 0.47044711810970496, + 0.5077978469096743, + 0.5208825209147679, + 0.5215302662195767, + 0.5307440145813949, + 0.5320798420159838, + 0.5390077671694007, + 0.5399577512232309, + 0.5451840317518407, + 0.5496758172493174, + 0.5549116774655793, + 0.5663186888088686, + 0.5696600944572434, + 0.5740691191347054, + 0.5933196671703043, + 0.6220622887876328, + 0.7752058942891915 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Regression with size_neighborhood=100" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "rsklpr = Rsklpr(size_neighborhood=100)\n", + "y_hat = rsklpr(x=x, y=y)\n", + "plot_results_1d(\n", + " x_=x,\n", + " y_=y,\n", + " y_true_=y_true,\n", + " estimates_=pd.DataFrame(data=y_hat, columns=[\"y_hat\"], index=x),\n", + " title=\"Regression with size_neighborhood=100\",\n", + ")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:32.602406113Z", + "start_time": "2023-11-27T02:50:32.491301467Z" + } + }, + "id": "b80070becd456e20" + }, + { + "cell_type": "markdown", + "source": [ + "The library can also predict values in location not present in the original dataset" + ], + "metadata": { + "collapsed": false + }, + "id": "492d64f8ff01d4cd" + }, + { + "cell_type": "code", + "execution_count": 8, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "y_hat", + "x": [ + -0.2621940268810562, + -0.23449094916988356, + -0.20678787145871091, + -0.17908479374753827, + -0.15138171603636563, + -0.12367863832519296, + -0.09597556061402032, + -0.06827248290284768, + -0.04056940519167504, + -0.012866327480502399, + 0.01483675023067027, + 0.04253982794184291, + 0.07024290565301555, + 0.0979459833641882, + 0.12564906107536084, + 0.15335213878653348, + 0.18105521649770612, + 0.20875829420887876, + 0.2364613719200514, + 0.2641644496312241, + 0.29186752734239674, + 0.3195706050535694, + 0.347273682764742, + 0.37497676047591466, + 0.4026798381870873, + 0.43038291589825994, + 0.4580859936094326, + 0.4857890713206052, + 0.5134921490317779, + 0.5411952267429505, + 0.5688983044541231, + 0.5966013821652958, + 0.6243044598764684, + 0.6520075375876411, + 0.6797106152988137, + 0.7074136930099864, + 0.735116770721159, + 0.7628198484323317, + 0.7905229261435044, + 0.818226003854677, + 0.8459290815658497, + 0.8736321592770223, + 0.901335236988195, + 0.9290383146993676, + 0.9567413924105402, + 0.9844444701217129, + 1.0121475478328854, + 1.0398506255440583, + 1.0675537032552307, + 1.0952567809664036 + ], + "y": [ + 0.0913540054755146, + 0.09186142246116044, + 0.08211349630940944, + 0.042796861734564304, + 0.043557460636489485, + 0.04554269198253168, + 0.050652897156908294, + 0.044496207504853336, + 0.024932330660686817, + 0.04211861367218278, + 0.040535343967536705, + 0.01649309217744515, + 0.022824560529127347, + 0.06023401623346464, + 0.07774685575926962, + 0.10392411017506907, + 0.11737972269912687, + 0.1363273740941545, + 0.14458419202051995, + 0.14951814204558914, + 0.1546819316551949, + 0.1585133941555914, + 0.1922017087391295, + 0.2296583637739059, + 0.24372884593263944, + 0.25830318755062825, + 0.2923584818113017, + 0.3118003370890316, + 0.32583539697225705, + 0.3199323992650886, + 0.30449245129131897, + 0.28355315791253727, + 0.2611505122223357, + 0.21794195545121992, + 0.17628798910334706, + 0.16411892429155525, + 0.19341409659612782, + 0.3042154289021535, + 0.42637667898063414, + 0.4730646012361335, + 0.5147317459523975, + 0.5321990733319709, + 0.5455128713573144, + 0.5528102073481372, + 0.5716081324781326, + 0.5954584533638705, + 0.6496637806604807, + 0.711149976298019, + 0.7560453168283515, + 0.7850575525751164 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Regression in linearly spaced locations" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "rsklpr = Rsklpr(size_neighborhood=35)\n", + "rsklpr.fit(x=x, y=y)\n", + "x_linspace: np.ndarray = np.linspace(start=x.min(), stop=x.max())\n", + "y_hat = rsklpr.predict(x=x_linspace)\n", + "plot_results_1d(\n", + " x_=x,\n", + " y_=y,\n", + " y_true_=y_true,\n", + " estimates_=pd.DataFrame(data=y_hat, columns=[\"y_hat\"], index=x_linspace),\n", + " title=\"Regression in linearly spaced locations\",\n", + ")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:32.667331467Z", + "start_time": "2023-11-27T02:50:32.599321144Z" + } + }, + "id": "925f96669e46a5b5" + }, + { + "cell_type": "markdown", + "source": [ + "We can also use the library to calculate confidence intervals for the prediction. In this case we calculate the 95% confidence intervals at the linearly spaced locations." + ], + "metadata": { + "collapsed": false + }, + "id": "acb77bad32d0c739" + }, + { + "cell_type": "code", + "execution_count": 9, + "outputs": [ + { + "data": { + "application/vnd.plotly.v1+json": { + "data": [ + { + "mode": "markers", + "name": "data", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.1191803185843851, + 0.049811093885267915, + 0.061540226495149876, + 0.0013762966927779747, + 0.33011327978584265, + 0.0028016920574798175, + -0.018016182333556743, + -0.13475603292238464, + 0.016424942045166105, + 0.06316524913103082, + 0.02166744082832109, + 0.09766151574695812, + 0.09090549793114422, + 0.06689146678957547, + 0.16179459444413052, + 0.12443357341669295, + 0.1631650247912569, + 0.038855113399051414, + 0.12841036368335207, + 0.183214077336861, + 0.39570107775443547, + 0.1073633367019008, + 0.11826487922134708, + 0.17029988799114418, + 0.15250691605270672, + 0.1178555476891144, + 0.1994147735064709, + 0.13600793661464475, + 0.18074037888883446, + 0.02869848500206705, + 0.12300210634145065, + 0.14017714839182097, + 0.14079634648627437, + 0.25920963900419897, + 0.19998893320546, + 0.17214220553933704, + 0.379565738443743, + 0.20399736643110541, + 0.3060974115360755, + 0.28054457327836957, + 0.20658826381454637, + 0.24848552557269682, + 0.29923855871226346, + 0.2803165922239966, + 0.3049611492304679, + 0.37833477545305483, + 0.34762176545168, + 0.21952270244910357, + 0.5372041316713028, + 0.29688899927524337, + 0.4042488451359492, + 0.4364238516121898, + 0.3705794138731636, + 0.280307274231896, + 0.3292219792574228, + 0.3083241905997943, + 0.28663423553925, + 0.2723642427956192, + 0.30852468552248574, + 0.31176076624427695, + 0.23856588303835238, + 0.2660273570908446, + 0.3370976037894936, + 0.11549407224434381, + 0.2428781567635641, + 0.09011049604729682, + 0.31525652377686375, + 0.21342624029812785, + 0.16797962931678445, + 0.05561311952347106, + 0.17480132891284392, + 0.18533435819326427, + 0.11241160294394752, + 0.13096888739516416, + 0.16147029490348405, + 0.16854889154648367, + 0.15338038067836843, + 0.17324006390595226, + 0.33435695116865805, + 0.2361276238047269, + 0.286040759205153, + 0.5441203927673431, + 0.5629092927848828, + 0.41881491683734573, + 0.5460187582043701, + 0.496449631739897, + 0.5186881585119715, + 0.48477066112949485, + 0.6269316354967817, + 0.5542870819313165, + 0.564156339858511, + 0.5550855630673031, + 0.5067325733222441, + 0.5374322541879143, + 0.556272268791394, + 0.620920077923215, + 0.4579706192934344, + 0.6083521898108901, + 0.7578020505384726, + 0.7858166096159729 + ], + "type": "scatter" + }, + { + "mode": "markers", + "name": "y_true", + "x": [ + -0.2621940268810562, + -0.13714701309275049, + -0.08784640673486305, + -0.030850187819932928, + 0.0026945061031015682, + 0.00508082404577135, + 0.023420285885473083, + 0.0639133229529901, + 0.06955197700381686, + 0.10676759267748642, + 0.11042820716088642, + 0.12189147347515301, + 0.12723831565926966, + 0.1299889001989774, + 0.15856742743090813, + 0.16294460288605572, + 0.17526568776616297, + 0.18313190217442732, + 0.19818237049366424, + 0.2051698200776125, + 0.2234140392549424, + 0.22557661575196092, + 0.23325382540157508, + 0.24272632878986972, + 0.2677355789124005, + 0.26961608102827483, + 0.2723327771560209, + 0.2838849238217034, + 0.3110066434093784, + 0.3204850492503619, + 0.3242489208553885, + 0.3261202340267171, + 0.3419538108173584, + 0.36077653751263666, + 0.3662387707270556, + 0.37142952223799286, + 0.3739342735453117, + 0.3816105667328741, + 0.3878935537487197, + 0.4003004221025975, + 0.40527121312475006, + 0.4233257386571563, + 0.454808529100877, + 0.45904654530523314, + 0.4767598929607979, + 0.4818862497761771, + 0.4835122127396662, + 0.48840380476445205, + 0.49346997881851956, + 0.5055829134345279, + 0.5096475587184862, + 0.5355460346714367, + 0.5506679981386633, + 0.5537155683748481, + 0.5558811278910932, + 0.5611597024600908, + 0.6017430838823248, + 0.6086036965610636, + 0.6124341648911753, + 0.6179953298555498, + 0.6214719714446114, + 0.6229490226067329, + 0.6230747364674994, + 0.6262140841270676, + 0.6382898144495655, + 0.6404266769431961, + 0.6408098433696546, + 0.6442433059997603, + 0.6649202653253814, + 0.6671150158690536, + 0.6700960311873938, + 0.6934092794646858, + 0.715545927551773, + 0.7157866279988553, + 0.7194650879706673, + 0.7204069994801902, + 0.7341419845009008, + 0.7355758878330942, + 0.7372147956104544, + 0.7408130382142839, + 0.782769896876621, + 0.7899755293337545, + 0.7998856223207204, + 0.8136859987131889, + 0.8392010754973859, + 0.85350517453068, + 0.8543533066150426, + 0.8686804832330532, + 0.8711885240578958, + 0.887132895264158, + 0.8897792464320593, + 0.9067714007439831, + 0.9232108585117856, + 0.9397683767912604, + 0.9653060322867386, + 0.9711215074309083, + 0.9781271369870336, + 1.0015277239896265, + 1.0249338830634431, + 1.0952567809664036 + ], + "y": [ + 0.12731633461957972, + 0.01934914913687403, + 0.014031043165993991, + 0.004811305448886617, + 1.4010838617521914E-4, + 3.642268487549952E-4, + 0.0038455225428482725, + 0.021261612046873164, + 0.024786217800552228, + 0.05387724353192527, + 0.05715380220194499, + 0.06765690752626724, + 0.07262281843313775, + 0.07517946916146598, + 0.10069130797522712, + 0.10425563972617358, + 0.11351338477929776, + 0.11872800628546665, + 0.1269653627567095, + 0.1299619674077417, + 0.13529204628172442, + 0.1356947308575982, + 0.13676610639503237, + 0.13739343584875824, + 0.13654656053562622, + 0.13640923527251594, + 0.1362092347029089, + 0.1354662091052353, + 0.13653496774795112, + 0.1386235014806803, + 0.13978326566872012, + 0.14043537559103514, + 0.1481317622983789, + 0.1627886159655451, + 0.1681970232999818, + 0.1738066943470976, + 0.17667313417060482, + 0.18607649887824884, + 0.19442369801931544, + 0.2123899500858094, + 0.22004358060334084, + 0.24918578549271558, + 0.2991806609134927, + 0.3052301202270735, + 0.32726740754475736, + 0.332463028485542, + 0.33398445864882254, + 0.3381753994992158, + 0.34187810913161754, + 0.3479255949201826, + 0.3490280796288381, + 0.34476598660429303, + 0.33360402400924616, + 0.3306581419427155, + 0.32843427982249335, + 0.32258336453097347, + 0.263732587910332, + 0.25279006163216955, + 0.2467418646957159, + 0.2381135132305177, + 0.23284547762697, + 0.23064304617608333, + 0.2304566590082362, + 0.22586012993529403, + 0.20942491097673627, + 0.2067582262199809, + 0.20628860404375, + 0.20220067718166967, + 0.18266612305959162, + 0.181140872469366, + 0.17924179015573047, + 0.17081438909057495, + 0.16975671423396294, + 0.16974812143126178, + 0.16953249225876094, + 0.16944444487106564, + 0.1647665626564842, + 0.16363190141243594, + 0.16207428748120772, + 0.15734461213254008, + 0.31969789012911026, + 0.35039084664540354, + 0.38913681984745374, + 0.43638078467475583, + 0.5019273423481623, + 0.5258753717872753, + 0.5270113655110031, + 0.5416468609082469, + 0.5433672244778102, + 0.5491753805481521, + 0.5493806754702031, + 0.5468974903174653, + 0.540869483928541, + 0.5351552484130071, + 0.5363392015202572, + 0.5394948973879891, + 0.5451194788480829, + 0.5804980008807575, + 0.6439697617245795, + 0.9672480931765578 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "y_hat", + "x": [ + -0.2621940268810562, + -0.23449094916988356, + -0.20678787145871091, + -0.17908479374753827, + -0.15138171603636563, + -0.12367863832519296, + -0.09597556061402032, + -0.06827248290284768, + -0.04056940519167504, + -0.012866327480502399, + 0.01483675023067027, + 0.04253982794184291, + 0.07024290565301555, + 0.0979459833641882, + 0.12564906107536084, + 0.15335213878653348, + 0.18105521649770612, + 0.20875829420887876, + 0.2364613719200514, + 0.2641644496312241, + 0.29186752734239674, + 0.3195706050535694, + 0.347273682764742, + 0.37497676047591466, + 0.4026798381870873, + 0.43038291589825994, + 0.4580859936094326, + 0.4857890713206052, + 0.5134921490317779, + 0.5411952267429505, + 0.5688983044541231, + 0.5966013821652958, + 0.6243044598764684, + 0.6520075375876411, + 0.6797106152988137, + 0.7074136930099864, + 0.735116770721159, + 0.7628198484323317, + 0.7905229261435044, + 0.818226003854677, + 0.8459290815658497, + 0.8736321592770223, + 0.901335236988195, + 0.9290383146993676, + 0.9567413924105402, + 0.9844444701217129, + 1.0121475478328854, + 1.0398506255440583, + 1.0675537032552307, + 1.0952567809664036 + ], + "y": [ + 0.0913540054755146, + 0.09186142246116044, + 0.08211349630940944, + 0.042796861734564304, + 0.043557460636489485, + 0.04554269198253168, + 0.050652897156908294, + 0.044496207504853336, + 0.024932330660686817, + 0.04211861367218278, + 0.040535343967536705, + 0.01649309217744515, + 0.022824560529127347, + 0.06023401623346464, + 0.07774685575926962, + 0.10392411017506907, + 0.11737972269912687, + 0.1363273740941545, + 0.14458419202051995, + 0.14951814204558914, + 0.1546819316551949, + 0.1585133941555914, + 0.1922017087391295, + 0.2296583637739059, + 0.24372884593263944, + 0.25830318755062825, + 0.2923584818113017, + 0.3118003370890316, + 0.32583539697225705, + 0.3199323992650886, + 0.30449245129131897, + 0.28355315791253727, + 0.2611505122223357, + 0.21794195545121992, + 0.17628798910334706, + 0.16411892429155525, + 0.19341409659612782, + 0.3042154289021535, + 0.42637667898063414, + 0.4730646012361335, + 0.5147317459523975, + 0.5321990733319709, + 0.5455128713573144, + 0.5528102073481372, + 0.5716081324781326, + 0.5954584533638705, + 0.6496637806604807, + 0.711149976298019, + 0.7560453168283515, + 0.7850575525751164 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "conf_0.025", + "x": [ + -0.2621940268810562, + -0.23449094916988356, + -0.20678787145871091, + -0.17908479374753827, + -0.15138171603636563, + -0.12367863832519296, + -0.09597556061402032, + -0.06827248290284768, + -0.04056940519167504, + -0.012866327480502399, + 0.01483675023067027, + 0.04253982794184291, + 0.07024290565301555, + 0.0979459833641882, + 0.12564906107536084, + 0.15335213878653348, + 0.18105521649770612, + 0.20875829420887876, + 0.2364613719200514, + 0.2641644496312241, + 0.29186752734239674, + 0.3195706050535694, + 0.347273682764742, + 0.37497676047591466, + 0.4026798381870873, + 0.43038291589825994, + 0.4580859936094326, + 0.4857890713206052, + 0.5134921490317779, + 0.5411952267429505, + 0.5688983044541231, + 0.5966013821652958, + 0.6243044598764684, + 0.6520075375876411, + 0.6797106152988137, + 0.7074136930099864, + 0.735116770721159, + 0.7628198484323317, + 0.7905229261435044, + 0.818226003854677, + 0.8459290815658497, + 0.8736321592770223, + 0.901335236988195, + 0.9290383146993676, + 0.9567413924105402, + 0.9844444701217129, + 1.0121475478328854, + 1.0398506255440583, + 1.0675537032552307, + 1.0952567809664036 + ], + "y": [ + -0.027561763577570925, + -0.020013490218931104, + -0.012494729487275705, + -0.005012003733381616, + 0.002414301073507834, + -0.028609602081720142, + -0.022242378305659304, + -0.01787646066028232, + -0.009947750901451183, + -0.0024872127833244716, + -0.00907441636275651, + -0.11152745947109306, + -0.1125063133883657, + 0.0335646645443035, + 0.05605198398414458, + 0.0824406996452497, + 0.08422623576854793, + 0.11592618968439938, + 0.1274263242056984, + 0.1309717363796289, + 0.12735822682238643, + 0.10181971426851685, + 0.1626165427944235, + 0.20770823022586946, + 0.22838475638236866, + 0.23982169330612493, + 0.267020814930724, + 0.27746883539189704, + 0.2964680996848923, + 0.29816989346536904, + 0.2848273782264329, + 0.2609006879334351, + 0.21550154540177666, + 0.17723129392601206, + 0.13218509124249894, + 0.1545822057912699, + 0.14913491724200234, + 0.18530362103651785, + 0.3316522011845406, + 0.42039282955559093, + 0.4790667432808437, + 0.5068379611687347, + 0.5225700353634597, + 0.5251536626276655, + 0.5340265966093664, + 0.5375999032612436, + 0.5478264316822801, + 0.6020274532370171, + 0.6117270242918317, + 0.6188664933555855 + ], + "type": "scatter" + }, + { + "mode": "lines+markers", + "name": "conf_0.975", + "x": [ + -0.2621940268810562, + -0.23449094916988356, + -0.20678787145871091, + -0.17908479374753827, + -0.15138171603636563, + -0.12367863832519296, + -0.09597556061402032, + -0.06827248290284768, + -0.04056940519167504, + -0.012866327480502399, + 0.01483675023067027, + 0.04253982794184291, + 0.07024290565301555, + 0.0979459833641882, + 0.12564906107536084, + 0.15335213878653348, + 0.18105521649770612, + 0.20875829420887876, + 0.2364613719200514, + 0.2641644496312241, + 0.29186752734239674, + 0.3195706050535694, + 0.347273682764742, + 0.37497676047591466, + 0.4026798381870873, + 0.43038291589825994, + 0.4580859936094326, + 0.4857890713206052, + 0.5134921490317779, + 0.5411952267429505, + 0.5688983044541231, + 0.5966013821652958, + 0.6243044598764684, + 0.6520075375876411, + 0.6797106152988137, + 0.7074136930099864, + 0.735116770721159, + 0.7628198484323317, + 0.7905229261435044, + 0.818226003854677, + 0.8459290815658497, + 0.8736321592770223, + 0.901335236988195, + 0.9290383146993676, + 0.9567413924105402, + 0.9844444701217129, + 1.0121475478328854, + 1.0398506255440583, + 1.0675537032552307, + 1.0952567809664036 + ], + "y": [ + 0.1138039452449765, + 0.1139758831990786, + 0.11412388446752307, + 0.11326912536124287, + 0.11281891900799877, + 0.24013088213390438, + 0.24510322015698283, + 0.2528952644721095, + 0.3232522308965309, + 0.3251397494877866, + 0.33015785954319177, + 0.1902959094501732, + 0.0724595377754495, + 0.08614436212591081, + 0.09911283909840779, + 0.1318162611740558, + 0.144988936342553, + 0.20694776916059884, + 0.22192889726829476, + 0.17334825655288333, + 0.17262010480190282, + 0.179902277838861, + 0.21422993358050613, + 0.2730405899942634, + 0.27773046008435137, + 0.28575681600332536, + 0.31545733663880915, + 0.3755134524802861, + 0.405226235813856, + 0.38274524775107743, + 0.32695300134330485, + 0.3026281810165612, + 0.2964672879768735, + 0.26347721151091574, + 0.20167292106733395, + 0.1999393348550357, + 0.26933904794755936, + 0.37081253043394247, + 0.5326358925819172, + 0.5358153199192002, + 0.5457101978415471, + 0.5620847090697692, + 0.5767105105904997, + 0.5831750808242953, + 0.6004883437913304, + 0.6329698603493739, + 0.7073909651047339, + 0.7579375301744085, + 0.7889566672424644, + 0.8196003326621042 + ], + "type": "scatter" + } + ], + "layout": { + "autosize": true, + "height": 500, + "template": { + "data": { + "barpolar": [ + { + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "barpolar" + } + ], + "bar": [ + { + "error_x": { + "color": "#f2f5fa" + }, + "error_y": { + "color": "#f2f5fa" + }, + "marker": { + "line": { + "color": "rgb(17,17,17)", + "width": 0.5 + }, + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "bar" + } + ], + "carpet": [ + { + "aaxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "baxis": { + "endlinecolor": "#A2B1C6", + "gridcolor": "#506784", + "linecolor": "#506784", + "minorgridcolor": "#506784", + "startlinecolor": "#A2B1C6" + }, + "type": "carpet" + } + ], + "choropleth": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "choropleth" + } + ], + "contourcarpet": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "contourcarpet" + } + ], + "contour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "contour" + } + ], + "heatmapgl": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmapgl" + } + ], + "heatmap": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "heatmap" + } + ], + "histogram2dcontour": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2dcontour" + } + ], + "histogram2d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "histogram2d" + } + ], + "histogram": [ + { + "marker": { + "pattern": { + "fillmode": "overlay", + "size": 10, + "solidity": 0.2 + } + }, + "type": "histogram" + } + ], + "mesh3d": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "type": "mesh3d" + } + ], + "parcoords": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "parcoords" + } + ], + "pie": [ + { + "automargin": true, + "type": "pie" + } + ], + "scatter3d": [ + { + "line": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatter3d" + } + ], + "scattercarpet": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattercarpet" + } + ], + "scattergeo": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattergeo" + } + ], + "scattergl": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scattergl" + } + ], + "scattermapbox": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scattermapbox" + } + ], + "scatterpolargl": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolargl" + } + ], + "scatterpolar": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterpolar" + } + ], + "scatter": [ + { + "marker": { + "line": { + "color": "#283442" + } + }, + "type": "scatter" + } + ], + "scatterternary": [ + { + "marker": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "type": "scatterternary" + } + ], + "surface": [ + { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + }, + "colorscale": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "type": "surface" + } + ], + "table": [ + { + "cells": { + "fill": { + "color": "#506784" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "header": { + "fill": { + "color": "#2a3f5f" + }, + "line": { + "color": "rgb(17,17,17)" + } + }, + "type": "table" + } + ] + }, + "layout": { + "annotationdefaults": { + "arrowcolor": "#f2f5fa", + "arrowhead": 0, + "arrowwidth": 1 + }, + "autotypenumbers": "strict", + "coloraxis": { + "colorbar": { + "outlinewidth": 0, + "ticks": "" + } + }, + "colorscale": { + "diverging": [ + [ + 0, + "#8e0152" + ], + [ + 0.1, + "#c51b7d" + ], + [ + 0.2, + "#de77ae" + ], + [ + 0.3, + "#f1b6da" + ], + [ + 0.4, + "#fde0ef" + ], + [ + 0.5, + "#f7f7f7" + ], + [ + 0.6, + "#e6f5d0" + ], + [ + 0.7, + "#b8e186" + ], + [ + 0.8, + "#7fbc41" + ], + [ + 0.9, + "#4d9221" + ], + [ + 1, + "#276419" + ] + ], + "sequential": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ], + "sequentialminus": [ + [ + 0.0, + "#0d0887" + ], + [ + 0.1111111111111111, + "#46039f" + ], + [ + 0.2222222222222222, + "#7201a8" + ], + [ + 0.3333333333333333, + "#9c179e" + ], + [ + 0.4444444444444444, + "#bd3786" + ], + [ + 0.5555555555555556, + "#d8576b" + ], + [ + 0.6666666666666666, + "#ed7953" + ], + [ + 0.7777777777777778, + "#fb9f3a" + ], + [ + 0.8888888888888888, + "#fdca26" + ], + [ + 1.0, + "#f0f921" + ] + ] + }, + "colorway": [ + "#636efa", + "#EF553B", + "#00cc96", + "#ab63fa", + "#FFA15A", + "#19d3f3", + "#FF6692", + "#B6E880", + "#FF97FF", + "#FECB52" + ], + "font": { + "color": "#f2f5fa" + }, + "geo": { + "bgcolor": "rgb(17,17,17)", + "lakecolor": "rgb(17,17,17)", + "landcolor": "rgb(17,17,17)", + "showlakes": true, + "showland": true, + "subunitcolor": "#506784" + }, + "hoverlabel": { + "align": "left" + }, + "hovermode": "closest", + "mapbox": { + "style": "dark" + }, + "paper_bgcolor": "rgb(17,17,17)", + "plot_bgcolor": "rgb(17,17,17)", + "polar": { + "angularaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "radialaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "scene": { + "xaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "yaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + }, + "zaxis": { + "backgroundcolor": "rgb(17,17,17)", + "gridcolor": "#506784", + "gridwidth": 2, + "linecolor": "#506784", + "showbackground": true, + "ticks": "", + "zerolinecolor": "#C8D4E3" + } + }, + "shapedefaults": { + "line": { + "color": "#f2f5fa" + } + }, + "sliderdefaults": { + "bgcolor": "#C8D4E3", + "bordercolor": "rgb(17,17,17)", + "borderwidth": 1, + "tickwidth": 0 + }, + "ternary": { + "aaxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "baxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + }, + "bgcolor": "rgb(17,17,17)", + "caxis": { + "gridcolor": "#506784", + "linecolor": "#506784", + "ticks": "" + } + }, + "title": { + "x": 0.05 + }, + "updatemenudefaults": { + "bgcolor": "#506784", + "borderwidth": 0 + }, + "xaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + }, + "yaxis": { + "automargin": true, + "gridcolor": "#283442", + "linecolor": "#506784", + "ticks": "", + "title": { + "standoff": 15 + }, + "zerolinecolor": "#283442", + "zerolinewidth": 2 + } + } + }, + "title": { + "text": "Regression in linearly spaced locations with 95% confidence intervals" + } + }, + "config": { + "showLink": false, + "linkText": "Export to plot.ly", + "plotlyServerURL": "https://plot.ly" + } + }, + "text/html": "
" + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "rsklpr = Rsklpr(size_neighborhood=35)\n", + "rsklpr.fit(x=x, y=y)\n", + "conf_low: np.ndarray\n", + "conf_high: np.ndarray\n", + "y_hat, conf_low, conf_high = rsklpr.predict_bootstrap(x=x_linspace)\n", + "\n", + "estimates: pd.DataFrame = pd.DataFrame(data=y_hat, columns=[\"y_hat\"], index=x_linspace)\n", + "estimates[\"conf_0.025\"] = conf_low\n", + "estimates[\"conf_0.975\"] = conf_high\n", + "\n", + "plot_results_1d(\n", + " x_=x,\n", + " y_=y,\n", + " y_true_=y_true,\n", + " estimates_=estimates,\n", + " title=\"Regression in linearly spaced locations with 95% confidence intervals\",\n", + ")" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2023-11-27T02:50:34.356046332Z", + "start_time": "2023-11-27T02:50:32.673479261Z" + } + }, + "id": "6acfea390453908d" + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/poetry.lock b/poetry.lock index 4c77129..1baade7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2,13 +2,13 @@ [[package]] name = "anyio" -version = "4.0.0" +version = "4.1.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.8" files = [ - {file = "anyio-4.0.0-py3-none-any.whl", hash = "sha256:cfdb2b588b9fc25ede96d8db56ed50848b0b649dca3dd1df0b11f683bb9e0b5f"}, - {file = "anyio-4.0.0.tar.gz", hash = "sha256:f7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a"}, + {file = "anyio-4.1.0-py3-none-any.whl", hash = "sha256:56a415fbc462291813a94528a779597226619c8e78af7de0507333f700011e5f"}, + {file = "anyio-4.1.0.tar.gz", hash = "sha256:5a0bec7085176715be77df87fc66d6c9d70626bd752fcc85f57cdbee5b3760da"}, ] [package.dependencies] @@ -17,9 +17,9 @@ idna = ">=2.8" sniffio = ">=1.1" [package.extras] -doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] -trio = ["trio (>=0.22)"] +doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (>=0.23)"] [[package]] name = "appnope" @@ -629,6 +629,73 @@ mypy = ["contourpy[bokeh,docs]", "docutils-stubs", "mypy (==1.4.1)", "types-Pill test = ["Pillow", "contourpy[test-no-images]", "matplotlib"] test-no-images = ["pytest", "pytest-cov", "wurlitzer"] +[[package]] +name = "coverage" +version = "7.3.2" +description = "Code coverage measurement for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "coverage-7.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d872145f3a3231a5f20fd48500274d7df222e291d90baa2026cc5152b7ce86bf"}, + {file = "coverage-7.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:310b3bb9c91ea66d59c53fa4989f57d2436e08f18fb2f421a1b0b6b8cc7fffda"}, + {file = "coverage-7.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f47d39359e2c3779c5331fc740cf4bce6d9d680a7b4b4ead97056a0ae07cb49a"}, + {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aa72dbaf2c2068404b9870d93436e6d23addd8bbe9295f49cbca83f6e278179c"}, + {file = "coverage-7.3.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:beaa5c1b4777f03fc63dfd2a6bd820f73f036bfb10e925fce067b00a340d0f3f"}, + {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:dbc1b46b92186cc8074fee9d9fbb97a9dd06c6cbbef391c2f59d80eabdf0faa6"}, + {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:315a989e861031334d7bee1f9113c8770472db2ac484e5b8c3173428360a9148"}, + {file = "coverage-7.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d1bc430677773397f64a5c88cb522ea43175ff16f8bfcc89d467d974cb2274f9"}, + {file = "coverage-7.3.2-cp310-cp310-win32.whl", hash = "sha256:a889ae02f43aa45032afe364c8ae84ad3c54828c2faa44f3bfcafecb5c96b02f"}, + {file = "coverage-7.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:c0ba320de3fb8c6ec16e0be17ee1d3d69adcda99406c43c0409cb5c41788a611"}, + {file = "coverage-7.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ac8c802fa29843a72d32ec56d0ca792ad15a302b28ca6203389afe21f8fa062c"}, + {file = "coverage-7.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:89a937174104339e3a3ffcf9f446c00e3a806c28b1841c63edb2b369310fd074"}, + {file = "coverage-7.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e267e9e2b574a176ddb983399dec325a80dbe161f1a32715c780b5d14b5f583a"}, + {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2443cbda35df0d35dcfb9bf8f3c02c57c1d6111169e3c85fc1fcc05e0c9f39a3"}, + {file = "coverage-7.3.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4175e10cc8dda0265653e8714b3174430b07c1dca8957f4966cbd6c2b1b8065a"}, + {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0cbf38419fb1a347aaf63481c00f0bdc86889d9fbf3f25109cf96c26b403fda1"}, + {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:5c913b556a116b8d5f6ef834038ba983834d887d82187c8f73dec21049abd65c"}, + {file = "coverage-7.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1981f785239e4e39e6444c63a98da3a1db8e971cb9ceb50a945ba6296b43f312"}, + {file = "coverage-7.3.2-cp311-cp311-win32.whl", hash = "sha256:43668cabd5ca8258f5954f27a3aaf78757e6acf13c17604d89648ecc0cc66640"}, + {file = "coverage-7.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:e10c39c0452bf6e694511c901426d6b5ac005acc0f78ff265dbe36bf81f808a2"}, + {file = "coverage-7.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4cbae1051ab791debecc4a5dcc4a1ff45fc27b91b9aee165c8a27514dd160836"}, + {file = "coverage-7.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:12d15ab5833a997716d76f2ac1e4b4d536814fc213c85ca72756c19e5a6b3d63"}, + {file = "coverage-7.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c7bba973ebee5e56fe9251300c00f1579652587a9f4a5ed8404b15a0471f216"}, + {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fe494faa90ce6381770746077243231e0b83ff3f17069d748f645617cefe19d4"}, + {file = "coverage-7.3.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6e9589bd04d0461a417562649522575d8752904d35c12907d8c9dfeba588faf"}, + {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d51ac2a26f71da1b57f2dc81d0e108b6ab177e7d30e774db90675467c847bbdf"}, + {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:99b89d9f76070237975b315b3d5f4d6956ae354a4c92ac2388a5695516e47c84"}, + {file = "coverage-7.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fa28e909776dc69efb6ed975a63691bc8172b64ff357e663a1bb06ff3c9b589a"}, + {file = "coverage-7.3.2-cp312-cp312-win32.whl", hash = "sha256:289fe43bf45a575e3ab10b26d7b6f2ddb9ee2dba447499f5401cfb5ecb8196bb"}, + {file = "coverage-7.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:7dbc3ed60e8659bc59b6b304b43ff9c3ed858da2839c78b804973f613d3e92ed"}, + {file = "coverage-7.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f94b734214ea6a36fe16e96a70d941af80ff3bfd716c141300d95ebc85339738"}, + {file = "coverage-7.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:af3d828d2c1cbae52d34bdbb22fcd94d1ce715d95f1a012354a75e5913f1bda2"}, + {file = "coverage-7.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:630b13e3036e13c7adc480ca42fa7afc2a5d938081d28e20903cf7fd687872e2"}, + {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c9eacf273e885b02a0273bb3a2170f30e2d53a6d53b72dbe02d6701b5296101c"}, + {file = "coverage-7.3.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d8f17966e861ff97305e0801134e69db33b143bbfb36436efb9cfff6ec7b2fd9"}, + {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b4275802d16882cf9c8b3d057a0839acb07ee9379fa2749eca54efbce1535b82"}, + {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:72c0cfa5250f483181e677ebc97133ea1ab3eb68645e494775deb6a7f6f83901"}, + {file = "coverage-7.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:cb536f0dcd14149425996821a168f6e269d7dcd2c273a8bff8201e79f5104e76"}, + {file = "coverage-7.3.2-cp38-cp38-win32.whl", hash = "sha256:307adb8bd3abe389a471e649038a71b4eb13bfd6b7dd9a129fa856f5c695cf92"}, + {file = "coverage-7.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:88ed2c30a49ea81ea3b7f172e0269c182a44c236eb394718f976239892c0a27a"}, + {file = "coverage-7.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b631c92dfe601adf8f5ebc7fc13ced6bb6e9609b19d9a8cd59fa47c4186ad1ce"}, + {file = "coverage-7.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d3d9df4051c4a7d13036524b66ecf7a7537d14c18a384043f30a303b146164e9"}, + {file = "coverage-7.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f7363d3b6a1119ef05015959ca24a9afc0ea8a02c687fe7e2d557705375c01f"}, + {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2f11cc3c967a09d3695d2a6f03fb3e6236622b93be7a4b5dc09166a861be6d25"}, + {file = "coverage-7.3.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:149de1d2401ae4655c436a3dced6dd153f4c3309f599c3d4bd97ab172eaf02d9"}, + {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:3a4006916aa6fee7cd38db3bfc95aa9c54ebb4ffbfc47c677c8bba949ceba0a6"}, + {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9028a3871280110d6e1aa2df1afd5ef003bab5fb1ef421d6dc748ae1c8ef2ebc"}, + {file = "coverage-7.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9f805d62aec8eb92bab5b61c0f07329275b6f41c97d80e847b03eb894f38d083"}, + {file = "coverage-7.3.2-cp39-cp39-win32.whl", hash = "sha256:d1c88ec1a7ff4ebca0219f5b1ef863451d828cccf889c173e1253aa84b1e07ce"}, + {file = "coverage-7.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b4767da59464bb593c07afceaddea61b154136300881844768037fd5e859353f"}, + {file = "coverage-7.3.2-pp38.pp39.pp310-none-any.whl", hash = "sha256:ae97af89f0fbf373400970c0a21eef5aa941ffeed90aee43650b81f7d7f47637"}, + {file = "coverage-7.3.2.tar.gz", hash = "sha256:be32ad29341b0170e795ca590e1c07e81fc061cb5b10c74ce7203491484404ef"}, +] + +[package.dependencies] +tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} + +[package.extras] +toml = ["tomli"] + [[package]] name = "cycler" version = "0.12.1" @@ -721,6 +788,20 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "execnet" +version = "2.0.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.7" +files = [ + {file = "execnet-2.0.2-py3-none-any.whl", hash = "sha256:88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41"}, + {file = "execnet-2.0.2.tar.gz", hash = "sha256:cc59bc4423742fd71ad227122eb0dd44db51efb3dc4095b45ac9a08c770096af"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + [[package]] name = "executing" version = "2.0.1" @@ -751,53 +832,53 @@ devel = ["colorama", "json-spec", "jsonschema", "pylint", "pytest", "pytest-benc [[package]] name = "fonttools" -version = "4.45.0" +version = "4.45.1" description = "Tools to manipulate font files" optional = false python-versions = ">=3.8" files = [ - {file = "fonttools-4.45.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:18138744540413eb2ebeff6ce8b9d617926f1ed08da5d1676f99f1966988264e"}, - {file = "fonttools-4.45.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0b3d240933045b9dbbe6e8c1e28ffe89be72c9be927b6e572e55be5e2b2604f7"}, - {file = "fonttools-4.45.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5853263505f407b69c0d1cbf3ed1c30f985b9505523989b20aa18a5231d4a08a"}, - {file = "fonttools-4.45.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4c21f306f1e71146cf7587916d6de5e9c4bf26057aad602a6c7fad4b6e05bf1f"}, - {file = "fonttools-4.45.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:1bb4f01018b9f4e2d7b07c2bf79e2ef498acb6f99321b72b5c44b1333481f569"}, - {file = "fonttools-4.45.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d0e6603c3b00604574d84fabbcf9dee81efa7c89d38ed4dcbf4e6c654e1ebb99"}, - {file = "fonttools-4.45.0-cp310-cp310-win32.whl", hash = "sha256:c3e676e50a0713c9a1e46185b806967d3c012643d1936ca814eb9ab62027c090"}, - {file = "fonttools-4.45.0-cp310-cp310-win_amd64.whl", hash = "sha256:e819f14d315024750b1ad2842da605051444b944cd983ea987359ace5213bcb9"}, - {file = "fonttools-4.45.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:a6d68b97b967a3361e0ddf14425e4fe030c9f19462b445ce0b190c4a6834eb46"}, - {file = "fonttools-4.45.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:619227c7b9088add4d4e5959bf0fa3c29a71c191baa8b989bf532645876b2168"}, - {file = "fonttools-4.45.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cafe001811ad1ac2a5d357fc99c490357d758569f69511d14da0311c02814e15"}, - {file = "fonttools-4.45.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:756c6f4324fd4bb4d7517462d7237ff65e45da7a002f9e6e08a48c25a11bf073"}, - {file = "fonttools-4.45.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ecc97628be1bf7fa93463e1e791915da66de51df8e655a5a6c846fd9b8ceaa98"}, - {file = "fonttools-4.45.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:636177ffc4479bc824a356c00a3c9a74a2ce591fa6057109321e0a0ffd126e40"}, - {file = "fonttools-4.45.0-cp311-cp311-win32.whl", hash = "sha256:cac462dbd9058778c89bc608ac29ba93ab3fbc37f305d260aa2d771cfb0fa694"}, - {file = "fonttools-4.45.0-cp311-cp311-win_amd64.whl", hash = "sha256:2bd3f33a5d5630cc20cf3f8631074cac6eafdb2aa3ac8745966c3b4bf93656b4"}, - {file = "fonttools-4.45.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:5b3da7791a58c97763d1704c2b76a9d654b8f2ef233e64248960bd2c6e669fe4"}, - {file = "fonttools-4.45.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4fbc3d8acb578ba0932fcabc01a962f23b0dd254ab103dd0606128fff0175095"}, - {file = "fonttools-4.45.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f69e07ebfd89d96485349dc10bd81a027fc0e927f988fa31bd9cd06359e06ed"}, - {file = "fonttools-4.45.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b122fe802839bfc8f9603233e5fcbdc98b5e27876f7945b426adfea983918a7b"}, - {file = "fonttools-4.45.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:8f8736e885700ae22970519b8f5c7f4c2f29c6e9459d05c649c4e99012c20b23"}, - {file = "fonttools-4.45.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:70f047ba37c6aac3d331b71bb784373e251bd86678da72526edc8585e79418e1"}, - {file = "fonttools-4.45.0-cp312-cp312-win32.whl", hash = "sha256:fdb43f68bce545f494fed1bfb60d2c32b53f410758919112923c2d600cb9a24c"}, - {file = "fonttools-4.45.0-cp312-cp312-win_amd64.whl", hash = "sha256:102a7ca8700a078265c002c29d2ae498edeb14b636375ceec2425b561ce08037"}, - {file = "fonttools-4.45.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:4b154cbf93515e4eb477f5cf99de79b46c17229781f321907940bdbabbd64708"}, - {file = "fonttools-4.45.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f546a1b676622638a12c721d89cfb513ad7189548eadac885cdd555e35021557"}, - {file = "fonttools-4.45.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45c5a0612049e0d06b467c3a0837d9efe37934acab64ba922f00e1d07c1555a7"}, - {file = "fonttools-4.45.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f27166d00e0cd3ea49461b053f55e75676f1109e5483170a14d70c397d082a4c"}, - {file = "fonttools-4.45.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:980ba4e673439db22a00501fac087957ce0731351b042816f6c02df81cadc612"}, - {file = "fonttools-4.45.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:83b70b99f3f55b046cb51ca20fc15702567710233b2cd757a79e1916c25a25f8"}, - {file = "fonttools-4.45.0-cp38-cp38-win32.whl", hash = "sha256:fe8ad943f62bf16273154ebcdf855c44a3b46eac36abea338c209209439b4eb6"}, - {file = "fonttools-4.45.0-cp38-cp38-win_amd64.whl", hash = "sha256:6fb1fdcee2b36e012283805ef0380e4508dbb504950b1c94d0343f8dbbad7d7e"}, - {file = "fonttools-4.45.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5bbcb75ffcea64543ab8203e132e2019b226f59a4a6958637e78c21f9ca560ff"}, - {file = "fonttools-4.45.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ade07953b35ebf66c445a5e02f28ecd038ea588dc7673c555afe319b6e3c5168"}, - {file = "fonttools-4.45.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54ac8be3f693062fc08550213edd40db8f4fe1dd095a1246ed18e887fc254d76"}, - {file = "fonttools-4.45.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc991712aaea9d545b13ec480aaf2ebd12ccdea180fce864dd9863f5134f5a06"}, - {file = "fonttools-4.45.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:420139743e21d832de230757fb7b0c285d8024d602af8064d9506fa055bb62ae"}, - {file = "fonttools-4.45.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:58da830a52c05f18a7cc8a279a8bdddf2e45cdc685b360699653fb3405557459"}, - {file = "fonttools-4.45.0-cp39-cp39-win32.whl", hash = "sha256:715e18f67f0587a16476c7f62b8ff9a165ddceb8c2a262fb08df9f71c7790f0e"}, - {file = "fonttools-4.45.0-cp39-cp39-win_amd64.whl", hash = "sha256:dd26fda8c879558216458a801c1dba52f35dca0e96640fd9c75e86b6574cf1c3"}, - {file = "fonttools-4.45.0-py3-none-any.whl", hash = "sha256:835cf5d0e1b37bbed1d64c286611cc4da9ff19df952400f191ba9142b3cb97f6"}, - {file = "fonttools-4.45.0.tar.gz", hash = "sha256:c1c79d7d4093396892575115c214b24f09e68997cb5c0ab2d99bfdaff74c64b6"}, + {file = "fonttools-4.45.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:45fa321c458ea29224067700954ec44493ae869b47e7c5485a350a149a19fb53"}, + {file = "fonttools-4.45.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0dc7617d96b1e668eea9250e1c1fe62d0c78c3f69573ce7e3332cc40e6d84356"}, + {file = "fonttools-4.45.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:03ed3bda541e86725f6b4e1b94213f13ed1ae51a5a1f167028534cedea38c010"}, + {file = "fonttools-4.45.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4f4a5870e3b56788fb196da8cf30d0dfd51a76dc3b907861d018165f76ae4c2"}, + {file = "fonttools-4.45.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:a3c11d9687479f01eddef729aa737abcdea0a44fdaffb62a930a18892f186c9b"}, + {file = "fonttools-4.45.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:316cec50581e844c3ab69d7c82455b54c7cf18236b2f09e722faf665fbfcac58"}, + {file = "fonttools-4.45.1-cp310-cp310-win32.whl", hash = "sha256:e2277cba9f0b525e30de2a9ad3cb4219aa4bc697230c1645666b0deee9f914f0"}, + {file = "fonttools-4.45.1-cp310-cp310-win_amd64.whl", hash = "sha256:1b9e9ad2bcded9a1431afaa57c8d3c39143ac1f050862d66bddd863c515464a2"}, + {file = "fonttools-4.45.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ff6a698bdd435d24c379f6e8a54908cd9bb7dda23719084d56bf8c87709bf3bd"}, + {file = "fonttools-4.45.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2c980d60cd6ec1376206fe55013d166e5627ad0b149b5c81e74eaa913ab6134f"}, + {file = "fonttools-4.45.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a12dee6523c02ca78aeedd0a5e12bfa9b7b29896350edd5241542897b072ae23"}, + {file = "fonttools-4.45.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:37cd1ced6efb3dd6fe82e9f9bf92fd74ac58a5aefc284045f59ecd517a5fb9ab"}, + {file = "fonttools-4.45.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e3d24248221bd7151dfff0d88b1b5da02dccd7134bd576ce8888199827bbaa19"}, + {file = "fonttools-4.45.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ba6c23591427844dfb0a13658f1718489de75de6a46b64234584c0d17573162d"}, + {file = "fonttools-4.45.1-cp311-cp311-win32.whl", hash = "sha256:cebcddbe9351b67166292b4f71ffdbfcce01ba4b07d4267824eb46b277aeb19a"}, + {file = "fonttools-4.45.1-cp311-cp311-win_amd64.whl", hash = "sha256:f22eb69996a0bd49f76bdefb30be54ce8dbb89a0d1246874d610f05c2aa2e69e"}, + {file = "fonttools-4.45.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:794de93e83297db7b4943f2431e206d8b1ea69cb3ae14638a49cc50332bf0db8"}, + {file = "fonttools-4.45.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4ba17822a6681d06849078daaf6e03eccc9f467efe7c4c60280e28a78e8e5df9"}, + {file = "fonttools-4.45.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e50f794d09df0675da8d9dbd7c66bfcab2f74a708343aabcad41936d26556891"}, + {file = "fonttools-4.45.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b07b857d4f9de3199a8c3d1b1bf2078c0f37447891ca1a8d9234106b9a27aff"}, + {file = "fonttools-4.45.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:777ba42b94a27bb7fb2b4082522fccfd345667c32a56011e1c3e105979af5b79"}, + {file = "fonttools-4.45.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:21e96b99878348c74aa58059b8578d7586f9519cbcdadacf56486737038aa043"}, + {file = "fonttools-4.45.1-cp312-cp312-win32.whl", hash = "sha256:5cbf02cda8465b69769d07385f5d11e7bba19954e7787792f46fe679ec755ebb"}, + {file = "fonttools-4.45.1-cp312-cp312-win_amd64.whl", hash = "sha256:800e354e0c3afaeb8d9552769773d02f228e98c37b8cb03041157c3d0687cffc"}, + {file = "fonttools-4.45.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6eb2c54f7a07c92108daabcf02caf31df97825738db02a28270633946bcda4d0"}, + {file = "fonttools-4.45.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:43a3d267334109ff849c37cf3629476b5feb392ef1d2e464a167b83de8cd599c"}, + {file = "fonttools-4.45.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e1aefc2bf3c43e0f33f995f828a7bbeff4adc9393a7760b11456dbcf14388f6"}, + {file = "fonttools-4.45.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1f53a19dcdd5737440839b8394eeebb35da9ec8109f7926cb6456639b5b58e47"}, + {file = "fonttools-4.45.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5a17706b9cc24b27721613fe5773d93331ab7f0ecaca9955aead89c6b843d3a7"}, + {file = "fonttools-4.45.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fb36e5f40191274a95938b40c0a1fa7f895e36935aea8709e1d6deff0b2d0d4f"}, + {file = "fonttools-4.45.1-cp38-cp38-win32.whl", hash = "sha256:46eabddec12066829b8a1efe45ae552ba2f1796981ecf538d5f68284c354c589"}, + {file = "fonttools-4.45.1-cp38-cp38-win_amd64.whl", hash = "sha256:b6de2f0fcd3302fb82f94801002cb473959e998c14c24ec28234adb674aed345"}, + {file = "fonttools-4.45.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:392d0e3cc23daee910193625f7cf1b387aff9dd5b6f1a5f4a925680acb6dcbc2"}, + {file = "fonttools-4.45.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4b9544b1346d99848ac0e9b05b5d45ee703d7562fc4c9c48cf4b781de9632e57"}, + {file = "fonttools-4.45.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8717db3e4895e4820ade64ea379187738827ee60748223cb0438ef044ee208c6"}, + {file = "fonttools-4.45.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e29d5f298d616a93a4c5963682dc6cc8cc09f6d89cad2c29019fc5fb3b4d9472"}, + {file = "fonttools-4.45.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:cb472905da3049960e80fc1cf808231880d79727a8410e156bf3e5063a1c574f"}, + {file = "fonttools-4.45.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ba299f1fbaa2a1e33210aaaf6fa816d4059e4d3cfe2ae9871368d4ab548c1c6a"}, + {file = "fonttools-4.45.1-cp39-cp39-win32.whl", hash = "sha256:105099968b58a5b4cef6f3eb409db8ea8578b302a9d05e23fecba1b8b0177b5f"}, + {file = "fonttools-4.45.1-cp39-cp39-win_amd64.whl", hash = "sha256:847f3f49dd3423e5a678c098e2ba92c7f4955d4aab3044f6a507b0bb0ecb07e0"}, + {file = "fonttools-4.45.1-py3-none-any.whl", hash = "sha256:3bdd7dfca8f6c9f4779384064027e8477ad6a037d6a327b09381f43e0247c6f3"}, + {file = "fonttools-4.45.1.tar.gz", hash = "sha256:6e441286d55fe7ec7c4fb36812bf914924813776ff514b744b510680fc2733f2"}, ] [package.extras] @@ -827,13 +908,13 @@ files = [ [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] [[package]] @@ -886,13 +967,13 @@ files = [ [[package]] name = "ipykernel" -version = "6.27.0" +version = "6.26.0" description = "IPython Kernel for Jupyter" optional = false python-versions = ">=3.8" files = [ - {file = "ipykernel-6.27.0-py3-none-any.whl", hash = "sha256:4388caa3c2cba0a381e20d289545e88a8aef1fe57a884d4c018718ec8c23c121"}, - {file = "ipykernel-6.27.0.tar.gz", hash = "sha256:7f4986f606581be73bfb32dc7a1ac9fa0e804c9be50ddf1c7a119413e982693f"}, + {file = "ipykernel-6.26.0-py3-none-any.whl", hash = "sha256:3ba3dc97424b87b31bb46586b5167b3161b32d7820b9201a9e698c71e271602c"}, + {file = "ipykernel-6.26.0.tar.gz", hash = "sha256:553856658eb8430bbe9653ea041a41bff63e9606fc4628873fc92a6cf3abd404"}, ] [package.dependencies] @@ -1194,13 +1275,13 @@ jupyter-server = ">=1.1.2" [[package]] name = "jupyter-server" -version = "2.11.0" +version = "2.10.1" description = "The backend—i.e. core services, APIs, and REST endpoints—to Jupyter web applications." optional = false python-versions = ">=3.8" files = [ - {file = "jupyter_server-2.11.0-py3-none-any.whl", hash = "sha256:c9bd6e6d71dc5a2a25df167dc323422997f14682b008bfecb5d7920a55020ea7"}, - {file = "jupyter_server-2.11.0.tar.gz", hash = "sha256:78c97ec8049f9062f0151725bc8a1364dfed716646a66819095e0e8a24793eba"}, + {file = "jupyter_server-2.10.1-py3-none-any.whl", hash = "sha256:20519e355d951fc5e1b6ac5952854fe7620d0cfb56588fa4efe362a758977ed3"}, + {file = "jupyter_server-2.10.1.tar.gz", hash = "sha256:e6da2657a954a7879eed28cc08e0817b01ffd81d7eab8634660397b55f926472"}, ] [package.dependencies] @@ -1282,13 +1363,13 @@ test = ["coverage", "pytest (>=7.0)", "pytest-check-links (>=0.7)", "pytest-cons [[package]] name = "jupyterlab-pygments" -version = "0.2.2" +version = "0.3.0" description = "Pygments theme using JupyterLab CSS variables" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "jupyterlab_pygments-0.2.2-py2.py3-none-any.whl", hash = "sha256:2405800db07c9f770863bcf8049a529c3dd4d3e28536638bd7c1c01d2748309f"}, - {file = "jupyterlab_pygments-0.2.2.tar.gz", hash = "sha256:7405d7fde60819d905a9fa8ce89e4cd830e318cdad22a0030f7a901da705585d"}, + {file = "jupyterlab_pygments-0.3.0-py3-none-any.whl", hash = "sha256:841a89020971da1d8693f1a99997aefc5dc424bb1b251fd6322462a1b8842780"}, + {file = "jupyterlab_pygments-0.3.0.tar.gz", hash = "sha256:721aca4d9029252b11cfa9d185e5b5af4d54772bb8072f9b7036f4170054d35d"}, ] [[package]] @@ -1612,38 +1693,38 @@ files = [ [[package]] name = "mypy" -version = "1.7.0" +version = "1.7.1" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.7.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5da84d7bf257fd8f66b4f759a904fd2c5a765f70d8b52dde62b521972a0a2357"}, - {file = "mypy-1.7.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a3637c03f4025f6405737570d6cbfa4f1400eb3c649317634d273687a09ffc2f"}, - {file = "mypy-1.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b633f188fc5ae1b6edca39dae566974d7ef4e9aaaae00bc36efe1f855e5173ac"}, - {file = "mypy-1.7.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d6ed9a3997b90c6f891138e3f83fb8f475c74db4ccaa942a1c7bf99e83a989a1"}, - {file = "mypy-1.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:1fe46e96ae319df21359c8db77e1aecac8e5949da4773c0274c0ef3d8d1268a9"}, - {file = "mypy-1.7.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:df67fbeb666ee8828f675fee724cc2cbd2e4828cc3df56703e02fe6a421b7401"}, - {file = "mypy-1.7.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a79cdc12a02eb526d808a32a934c6fe6df07b05f3573d210e41808020aed8b5d"}, - {file = "mypy-1.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f65f385a6f43211effe8c682e8ec3f55d79391f70a201575def73d08db68ead1"}, - {file = "mypy-1.7.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:0e81ffd120ee24959b449b647c4b2fbfcf8acf3465e082b8d58fd6c4c2b27e46"}, - {file = "mypy-1.7.0-cp311-cp311-win_amd64.whl", hash = "sha256:f29386804c3577c83d76520abf18cfcd7d68264c7e431c5907d250ab502658ee"}, - {file = "mypy-1.7.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:87c076c174e2c7ef8ab416c4e252d94c08cd4980a10967754f91571070bf5fbe"}, - {file = "mypy-1.7.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6cb8d5f6d0fcd9e708bb190b224089e45902cacef6f6915481806b0c77f7786d"}, - {file = "mypy-1.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d93e76c2256aa50d9c82a88e2f569232e9862c9982095f6d54e13509f01222fc"}, - {file = "mypy-1.7.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cddee95dea7990e2215576fae95f6b78a8c12f4c089d7e4367564704e99118d3"}, - {file = "mypy-1.7.0-cp312-cp312-win_amd64.whl", hash = "sha256:d01921dbd691c4061a3e2ecdbfbfad029410c5c2b1ee88946bf45c62c6c91210"}, - {file = "mypy-1.7.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:185cff9b9a7fec1f9f7d8352dff8a4c713b2e3eea9c6c4b5ff7f0edf46b91e41"}, - {file = "mypy-1.7.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7a7b1e399c47b18feb6f8ad4a3eef3813e28c1e871ea7d4ea5d444b2ac03c418"}, - {file = "mypy-1.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc9fe455ad58a20ec68599139ed1113b21f977b536a91b42bef3ffed5cce7391"}, - {file = "mypy-1.7.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d0fa29919d2e720c8dbaf07d5578f93d7b313c3e9954c8ec05b6d83da592e5d9"}, - {file = "mypy-1.7.0-cp38-cp38-win_amd64.whl", hash = "sha256:2b53655a295c1ed1af9e96b462a736bf083adba7b314ae775563e3fb4e6795f5"}, - {file = "mypy-1.7.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c1b06b4b109e342f7dccc9efda965fc3970a604db70f8560ddfdee7ef19afb05"}, - {file = "mypy-1.7.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:bf7a2f0a6907f231d5e41adba1a82d7d88cf1f61a70335889412dec99feeb0f8"}, - {file = "mypy-1.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:551d4a0cdcbd1d2cccdcc7cb516bb4ae888794929f5b040bb51aae1846062901"}, - {file = "mypy-1.7.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:55d28d7963bef00c330cb6461db80b0b72afe2f3c4e2963c99517cf06454e665"}, - {file = "mypy-1.7.0-cp39-cp39-win_amd64.whl", hash = "sha256:870bd1ffc8a5862e593185a4c169804f2744112b4a7c55b93eb50f48e7a77010"}, - {file = "mypy-1.7.0-py3-none-any.whl", hash = "sha256:96650d9a4c651bc2a4991cf46f100973f656d69edc7faf91844e87fe627f7e96"}, - {file = "mypy-1.7.0.tar.gz", hash = "sha256:1e280b5697202efa698372d2f39e9a6713a0395a756b1c6bd48995f8d72690dc"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:12cce78e329838d70a204293e7b29af9faa3ab14899aec397798a4b41be7f340"}, + {file = "mypy-1.7.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1484b8fa2c10adf4474f016e09d7a159602f3239075c7bf9f1627f5acf40ad49"}, + {file = "mypy-1.7.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:31902408f4bf54108bbfb2e35369877c01c95adc6192958684473658c322c8a5"}, + {file = "mypy-1.7.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f2c2521a8e4d6d769e3234350ba7b65ff5d527137cdcde13ff4d99114b0c8e7d"}, + {file = "mypy-1.7.1-cp310-cp310-win_amd64.whl", hash = "sha256:fcd2572dd4519e8a6642b733cd3a8cfc1ef94bafd0c1ceed9c94fe736cb65b6a"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4b901927f16224d0d143b925ce9a4e6b3a758010673eeded9b748f250cf4e8f7"}, + {file = "mypy-1.7.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2f7f6985d05a4e3ce8255396df363046c28bea790e40617654e91ed580ca7c51"}, + {file = "mypy-1.7.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:944bdc21ebd620eafefc090cdf83158393ec2b1391578359776c00de00e8907a"}, + {file = "mypy-1.7.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9c7ac372232c928fff0645d85f273a726970c014749b924ce5710d7d89763a28"}, + {file = "mypy-1.7.1-cp311-cp311-win_amd64.whl", hash = "sha256:f6efc9bd72258f89a3816e3a98c09d36f079c223aa345c659622f056b760ab42"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6dbdec441c60699288adf051f51a5d512b0d818526d1dcfff5a41f8cd8b4aaf1"}, + {file = "mypy-1.7.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4fc3d14ee80cd22367caaaf6e014494415bf440980a3045bf5045b525680ac33"}, + {file = "mypy-1.7.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c6e4464ed5f01dc44dc9821caf67b60a4e5c3b04278286a85c067010653a0eb"}, + {file = "mypy-1.7.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:d9b338c19fa2412f76e17525c1b4f2c687a55b156320acb588df79f2e6fa9fea"}, + {file = "mypy-1.7.1-cp312-cp312-win_amd64.whl", hash = "sha256:204e0d6de5fd2317394a4eff62065614c4892d5a4d1a7ee55b765d7a3d9e3f82"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:84860e06ba363d9c0eeabd45ac0fde4b903ad7aa4f93cd8b648385a888e23200"}, + {file = "mypy-1.7.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8c5091ebd294f7628eb25ea554852a52058ac81472c921150e3a61cdd68f75a7"}, + {file = "mypy-1.7.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40716d1f821b89838589e5b3106ebbc23636ffdef5abc31f7cd0266db936067e"}, + {file = "mypy-1.7.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5cf3f0c5ac72139797953bd50bc6c95ac13075e62dbfcc923571180bebb662e9"}, + {file = "mypy-1.7.1-cp38-cp38-win_amd64.whl", hash = "sha256:78e25b2fd6cbb55ddfb8058417df193f0129cad5f4ee75d1502248e588d9e0d7"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:75c4d2a6effd015786c87774e04331b6da863fc3fc4e8adfc3b40aa55ab516fe"}, + {file = "mypy-1.7.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:2643d145af5292ee956aa0a83c2ce1038a3bdb26e033dadeb2f7066fb0c9abce"}, + {file = "mypy-1.7.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:75aa828610b67462ffe3057d4d8a4112105ed211596b750b53cbfe182f44777a"}, + {file = "mypy-1.7.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ee5d62d28b854eb61889cde4e1dbc10fbaa5560cb39780c3995f6737f7e82120"}, + {file = "mypy-1.7.1-cp39-cp39-win_amd64.whl", hash = "sha256:72cf32ce7dd3562373f78bd751f73c96cfb441de147cc2448a92c1a308bd0ca6"}, + {file = "mypy-1.7.1-py3-none-any.whl", hash = "sha256:f7c5d642db47376a0cc130f0de6d055056e010debdaf0707cd2b0fc7e7ef30ea"}, + {file = "mypy-1.7.1.tar.gz", hash = "sha256:fcb6d9afb1b6208b4c712af0dafdc650f518836065df0d4fb1d800f5d6773db2"}, ] [package.dependencies] @@ -1983,13 +2064,13 @@ test = ["pytest", "pytest-cov", "scipy"] [[package]] name = "pexpect" -version = "4.8.0" +version = "4.9.0" description = "Pexpect allows easy control of interactive console applications." optional = false python-versions = "*" files = [ - {file = "pexpect-4.8.0-py2.py3-none-any.whl", hash = "sha256:0b48a55dcb3c05f3329815901ea4fc1537514d6ba867a152b581d69ae3710937"}, - {file = "pexpect-4.8.0.tar.gz", hash = "sha256:fc65a43959d153d0114afe13997d439c22823a27cefceb5ff35c2178c6784c0c"}, + {file = "pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523"}, + {file = "pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f"}, ] [package.dependencies] @@ -2272,6 +2353,24 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "pytest-cov" +version = "4.1.0" +description = "Pytest plugin for measuring coverage." +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-cov-4.1.0.tar.gz", hash = "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6"}, + {file = "pytest_cov-4.1.0-py3-none-any.whl", hash = "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a"}, +] + +[package.dependencies] +coverage = {version = ">=5.2.1", extras = ["toml"]} +pytest = ">=4.6" + +[package.extras] +testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] + [[package]] name = "pytest-mock" version = "3.12.0" @@ -2289,6 +2388,26 @@ pytest = ">=5.0" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] +[[package]] +name = "pytest-xdist" +version = "3.5.0" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-xdist-3.5.0.tar.gz", hash = "sha256:cbb36f3d67e0c478baa57fa4edc8843887e0f6cfc42d677530a36d7472b32d8a"}, + {file = "pytest_xdist-3.5.0-py3-none-any.whl", hash = "sha256:d075629c7e00b611df89f490a5063944bee7a4362a5ff11c7cc7824a03dfce24"}, +] + +[package.dependencies] +execnet = ">=1.1" +pytest = ">=6.2.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + [[package]] name = "python-dateutil" version = "2.8.2" @@ -3226,4 +3345,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.8.0" -content-hash = "fda64763ae158717f04b3245db3f0a521460bf0ef281fbc2d10b037fd67958ac" +content-hash = "b0ed0388546c9f8a1dcbe894f50dbd1e43a39840508e27be49b6d415180cc881" diff --git a/pyproject.toml b/pyproject.toml index fb95a48..882f27b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,8 +45,11 @@ tqdm = "^4.66.1" black = {extras = ["jupyter"], version = "^23.7.0"} mypy = "^1.7.0" pytest = "^7.4.3" +pytest-cov = "^4.1.0" pytest-mock = "^3.12.0" +pytest-xdist = "^3.5.0" ruff = "^0.1.5" +coverage = {extras = ["toml"], version = "^7.3.2"} [build-system] requires = ["poetry-core"] @@ -112,6 +115,16 @@ warn_unused_configs = true ignore_missing_imports = true [tool.pytest.ini_options] +addopts = "-ra -q --strict-markers" +markers = [ + "slow: tests that take a long time to run", +] minversion = "6.0" -addopts = "-ra -q" testpaths = ["tests"] + +[tool.coverage.run] +branch = true +omit = ["tests/*", "src/experiments/*"] + +[tool.coverage.report] +show_missing=true diff --git a/src/rsklpr/rsklpr.py b/src/rsklpr/rsklpr.py index a2d3a1a..de94c29 100644 --- a/src/rsklpr/rsklpr.py +++ b/src/rsklpr/rsklpr.py @@ -9,20 +9,6 @@ from statsmodels.nonparametric.bandwidths import select_bandwidth -def _normalize_array(array: np.ndarray, min_val: float, max_val: float) -> np.ndarray: - """ - Offsets the array by min_val and scales by (max_val - min_val). If min_val and max_val correspond to the range of - the values in the input then the array is normalized to [0,1]. - - Args: - array: The array to normalize. - - Returns: - The normalized array. - """ - return (array - min_val) / (max_val - min_val) - - def _weighted_local_regression( x_0: np.ndarray, x: np.ndarray, @@ -76,22 +62,21 @@ def _dim_data(data: np.ndarray) -> int: def _laplacian_normalized(u: np.ndarray) -> np.ndarray: """ - Implementation of the Laplacian kernel. The implementation assumes all inputs are non-negative and are - first scaled to the range [0,1] before applying the kernel. + Implementation of the Laplacian kernel. The inputs are first scaled to the range [0,1] before applying the kernel. Args: - u: The kernel input, note it is assumed all inputs are non-negative. + u: The kernel input. Returns: The kernel output. """ - return np.exp(-u / np.max(u, axis=1, keepdims=True).astype(float)) # type: ignore [no-any-return] + return np.exp(-u / np.max(np.atleast_2d(u), axis=1, keepdims=True).astype(float)) # type: ignore [no-any-return] def _tricube_normalized(u: np.ndarray) -> np.ndarray: """ - Implementation of the normalized Tricube kernel. The implementation assumes all inputs are non-negative and are - first scaled to the range [0,1] before applying the kernel. + Implementation of the normalized Tricube kernel. The implementation assumes all inputs are non-negative with a 0 + value present. The inputs are scaled to the range [0,1] before applying the kernel. Args: u: The kernel input, note it is assumed all inputs are non-negative. @@ -99,9 +84,11 @@ def _tricube_normalized(u: np.ndarray) -> np.ndarray: Returns: The kernel output. """ + assert u.min() >= 0 # negative values are not expected to happen during normal execution. return np.clip( # type: ignore [no-any-return, call-overload] - a=np.power((1 - np.power(u / np.max(u, axis=1, keepdims=True).astype(float), 3)), 3), + a=np.power((1 - np.power(u / np.max(np.atleast_2d(u), axis=1, keepdims=True).astype(float), 3)), 3), a_min=0.0, + a_max=None, ) @@ -211,9 +198,7 @@ def __init__( self._degree: int = int(degree) self._metric_x: str = metric_x.lower() self._metric_x_params: Optional[Dict[str, Any]] = metric_x_params - self._k1: Callable[[np.ndarray], np.ndarray] = ( - _laplacian_normalized if k1 == "laplacian" else _tricube_normalized - ) + self._k1: str = k1 self._k2: str = k2 self._bw1: Union[str, Sequence[float], Callable[[Any], Sequence[float]]] = bw1 # type: ignore [misc] self._bw2: Union[str, Sequence[float], Callable[[Any], Sequence[float]]] = bw2 # type: ignore [misc] @@ -222,6 +207,12 @@ def __init__( int(bw_global_subsample_size) if bw_global_subsample_size is not None else None ) + self._seed: int = seed + + self._k1_func: Callable[[np.ndarray], np.ndarray] = ( + _laplacian_normalized if k1 == "laplacian" else _tricube_normalized + ) + self._rnd_gen: np.random.Generator = np_defualt_rng(seed=seed) self._x: np.ndarray = np.ndarray(shape=()) self._y: np.ndarray = np.ndarray(shape=()) @@ -368,6 +359,9 @@ def _k2_joint( else bw2_global ) + if bw_y.size != 1: + raise ValueError(f"Too many values ({bw_y.size}) specified for y bandwidth") + local_density: np.ndarray = np.exp(-0.5 * square_dist_n_y_windowed / (bw_y**2)) local_density = (local_density * weights).sum(axis=-1) return local_density @@ -397,7 +391,7 @@ def _estimate( dist_n_x_neighbors: np.ndarray indices: np.ndarray dist_n_x_neighbors, indices = self._nearest_neighbors.kneighbors(X=x_arr[i].reshape(1, -1)) - weights: np.ndarray = self._k1(dist_n_x_neighbors) + weights: np.ndarray = self._k1_func(dist_n_x_neighbors) n_x_neighbors: np.ndarray = self._x[indices].squeeze(axis=0) if self._k2 == "conden": @@ -426,6 +420,41 @@ def _estimate( return y_hat + def _estimate_bootstrap( + self, x: Union[np.ndarray, Sequence[Number], Sequence[Sequence[Number]], float], bootstrap_iterations: int + ) -> np.ndarray: + x_arr: np.ndarray + x_arr, _ = self._check_and_reshape_inputs(x=x) + y_hat: np.ndarray = np.empty((x_arr.shape[0], bootstrap_iterations + 1)) + y_hat[:, 0] = self._estimate(x=x_arr) + i: int + + for i in range(bootstrap_iterations): + resmaple_idx: np.ndarray = self._rnd_gen.choice( + a=np.arange(stop=self._x.shape[0]), size=self._x.shape[0], replace=True # type: ignore[call-overload] + ) + + x_resample: np.ndarray = self._x[resmaple_idx, :] + y_resample: np.ndarray = self._y[resmaple_idx] + + model: Rsklpr = Rsklpr( + size_neighborhood=self._size_neighborhood, + degree=self._degree, + metric_x=self._metric_x, + metric_x_params=self._metric_x_params, + k1=self._k1, + k2=self._k2, + bw1=self._bw1, + bw2=self._bw2, + bw_global_subsample_size=self._bw_global_subsample_size, + seed=self._seed, + ) + + model.fit(x=x_resample, y=y_resample) + y_hat[:, i + 1] = model._estimate(x=x_arr) + + return y_hat + def _get_bandwidth_global(self, k2: str) -> Tuple[Optional[Sequence[float]], Optional[Sequence[float]]]: """ Calculates bandwidth estimates from the global data if configured to do so. @@ -549,7 +578,11 @@ def _check_and_reshape_inputs( ValueError: When y dimension is larger than one. ValueError: when x and y has incompatible shapes """ - x = np.asarray(x, dtype=float) + if isinstance(x, np.ndarray): + x = x.copy().astype(float) + else: + x = np.asarray(x, dtype=float) + if x.ndim == 1: x = x.reshape((-1, 1)) elif x.ndim > 2: @@ -565,7 +598,11 @@ def _check_and_reshape_inputs( ) if y is not None: - y = np.asarray(y, dtype=float) + if isinstance(y, np.ndarray): + y = y.copy().astype(float) + else: + y = np.asarray(y, dtype=float) + y = np.squeeze(a=y) if y.ndim > 1: @@ -576,10 +613,7 @@ def _check_and_reshape_inputs( return x, y - def predict( - self, - x: Union[np.ndarray, Sequence[Number], Sequence[Sequence[Number]], float], - ) -> np.ndarray: + def predict(self, x: Union[np.ndarray, Sequence[Number], Sequence[Sequence[Number]], float]) -> np.ndarray: """ Predicts estimates of m(x) at the specified locations. Must call fit with the training data first. @@ -591,6 +625,37 @@ def predict( """ return self._estimate(x=x) + def predict_bootstrap( + self, + x: Union[np.ndarray, Sequence[Number], Sequence[Sequence[Number]], float], + q_low: float = 0.025, + q_high: float = 0.975, + num_bootstrap_resamples: int = 50, + ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: + """ + Predicts estimates of m(x) at the specified locations multiple times. The first estimate is done using the + data provided when calling fit (the original sample), following additional 'num_bootstrap_resamples' estimates. + The method then uses all estimates to calculate confidence intervals. Note that calling fit with the training + data must be done first. + + Args: + x: The locations to predict for. + q_low: The lower confidence quantile estimated from the posterior of y_hat. + q_high: The upper confidence quantile estimated from the posterior of y_hat. + num_bootstrap_resamples: The number of bootstrap resamples to take. + + Returns: + The estimated responses at the corresponding locations according to the original fit data and the low and + high confidence bands. + """ + if num_bootstrap_resamples <= 0: + raise ValueError("At least one bootstrap iteration need to be specified") + + y_hat: np.ndarray = self._estimate_bootstrap(x=x, bootstrap_iterations=num_bootstrap_resamples) + y_conf_low: np.ndarray = np.quantile(a=y_hat, q=q_low, axis=1) + y_conf_high: np.ndarray = np.quantile(a=y_hat, q=q_high, axis=1) + return y_hat[:, 0], y_conf_low, y_conf_high + def fit_and_predict( self, x: Union[np.ndarray, Sequence[Number], Sequence[Sequence[Number]]], diff --git a/tests/rsklpr_tests/test_rsklpr.py b/tests/rsklpr_tests/test_rsklpr.py index 498cb9d..c778867 100644 --- a/tests/rsklpr_tests/test_rsklpr.py +++ b/tests/rsklpr_tests/test_rsklpr.py @@ -5,244 +5,239 @@ from pytest_mock import MockerFixture import rsklpr -from rsklpr.rsklpr import Rsklpr, _laplacian_normalized, _tricube_normalized - - -def test_rsklpr_basic_regression_1d_with_joint_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 1D input using the joint kernel. - """ - x: np.ndarray = np.linspace(start=-3.0, stop=10, num=50) - y: np.ndarray = np.linspace(start=0.0, stop=0.2, num=50) - target: Rsklpr = Rsklpr(size_neighborhood=20, k2="joint") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_1d_with_conden_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 1D input using the conden kernel. - """ - x: np.ndarray = np.linspace(start=1.0, stop=10, num=50) - y: np.ndarray = np.linspace(start=0, stop=-0.5, num=50) - target: Rsklpr = Rsklpr(size_neighborhood=20, k2="conden") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_2d_with_joint_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 2D input using the joint kernel. - """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-10.0, stop=10, num=50).reshape((-1, 1)), - (np.linspace(start=-5.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=-2.0, stop=0.0, num=50) - target: Rsklpr = Rsklpr(size_neighborhood=20, k2="joint") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_2d_with_conden_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 2D input using the conden kernel. - """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-5.0, stop=-3.0, num=50).reshape((-1, 1)), - (np.linspace(start=0.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=-1.0, stop=5, num=50) - target: Rsklpr = Rsklpr(size_neighborhood=20, k2="conden") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_1d_with_joint_increasing_windows_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 1D input using the joint kernel. - """ - x: np.ndarray = np.linspace(start=-3.0, stop=10, num=50) - y: np.ndarray = np.linspace(start=10.0, stop=-15, num=50) - size_neighborhood: int - for size_neighborhood in np.linspace(start=3, stop=50, num=20, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="joint") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_1d_with_conden_increasing_windows_expected_output() -> None: +from rsklpr.rsklpr import Rsklpr, _laplacian_normalized, _tricube_normalized, _dim_data + +_rng: np.random.Generator = np.random.default_rng(seed=12) + + +@pytest.mark.parametrize( + argnames="x", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + for _ in range(3) + ], +) +@pytest.mark.parametrize( + argnames="y", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + for i in range(3) + ], +) +@pytest.mark.parametrize( + argnames="k1", + argvalues=[ + "tricube", + "laplacian", + ], +) +@pytest.mark.parametrize( + argnames="k2", + argvalues=[ + "joint", + "conden", + ], +) +@pytest.mark.slow +def test_rsklpr_smoke_test_1d_regression_increasing_windows_expected_output( + x: np.ndarray, y: np.ndarray, k1: str, k2: str +) -> None: """ - Smoke test that reasonable values are returned for a linear 1D input using the conden kernel. + Smoke test that reasonable values are returned for linear 1D input with various window sizes. """ - x: np.ndarray = np.linspace(start=-3.0, stop=10, num=50) - y: np.ndarray = np.linspace(start=0.0, stop=-5, num=50) size_neighborhood: int for size_neighborhood in np.linspace(start=3, stop=50, num=20, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="conden") + target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k1=k1, k2=k2) actual: np.ndarray = target( x=x, y=y, ) - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_2d_with_joint_increasing_windows_expected_output() -> None: - """ - Smoke test that reasonable values are returned for a linear 2D input using the joint kernel. - """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-10.0, stop=10, num=50).reshape((-1, 1)), - (np.linspace(start=-5.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=-2.0, stop=0.0, num=50) - size_neighborhood: int - - for size_neighborhood in np.linspace(start=3, stop=50, num=20, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="joint") - - actual: np.ndarray = target( - x=x, - y=y, + np.testing.assert_allclose(actual=actual, desired=y, atol=5e-3) + + +@pytest.mark.parametrize( + argnames="x", + argvalues=[ + np.concatenate( + [ + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + ], + axis=1, ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_2d_with_conden_increasing_windows_expected_output() -> None: + for _ in range(3) + ], +) +@pytest.mark.parametrize( + argnames="y", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + for i in range(3) + ], +) +@pytest.mark.parametrize( + argnames="k1", + argvalues=[ + "tricube", + "laplacian", + ], +) +@pytest.mark.parametrize( + argnames="k2", + argvalues=[ + "joint", + "conden", + ], +) +@pytest.mark.slow +def test_rsklpr_smoke_test_2d_regression_increasing_windows_expected_output( + x: np.ndarray, y: np.ndarray, k1: str, k2: str +) -> None: """ - Smoke test that reasonable values are returned for a linear 2D input using the conden kernel. + Smoke test that reasonable values are returned for linear 1D input with various window sizes. """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-10.0, stop=10, num=50).reshape((-1, 1)), - (np.linspace(start=-5.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=10, stop=100, num=50) size_neighborhood: int for size_neighborhood in np.linspace(start=4, stop=50, num=20, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="conden") + target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k1=k1, k2=k2) actual: np.ndarray = target( x=x, y=y, ) - np.testing.assert_allclose(actual=actual, desired=y, atol=1e-7) - - -def test_rsklpr_basic_regression_5d_with_joint_increasing_windows_expected_output() -> None: + np.testing.assert_allclose(actual=actual, desired=y, atol=6e-3) + + +@pytest.mark.parametrize( + argnames="x", + argvalues=[ + np.concatenate( + [ + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + np.linspace( + start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50 + ).reshape((-1, 1)) + + _rng.uniform(low=-0.001, high=0.001, size=50).reshape((-1, 1)), + ], + axis=1, + ) + ], +) +@pytest.mark.parametrize( + argnames="y", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + ], +) +@pytest.mark.parametrize( + argnames="k1", + argvalues=[ + "tricube", + "laplacian", + ], +) +@pytest.mark.parametrize( + argnames="k2", + argvalues=[ + "joint", + "conden", + ], +) +@pytest.mark.slow +def test_rsklpr_smoke_test_5d_regression_increasing_windows_expected_output( + x: np.ndarray, y: np.ndarray, k1: str, k2: str +) -> None: """ - Smoke test that reasonable values are returned for a linear 5D input using the joint kernel. + Smoke test that reasonable values are returned for linear 1D input with various window sizes. """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-10.0, stop=10, num=50).reshape((-1, 1)), - (np.linspace(start=-5.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=-15.0, stop=3, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=0, stop=8, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=0, stop=-3, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=-2.0, stop=5.0, num=50) size_neighborhood: int - for size_neighborhood in np.linspace(start=6, stop=50, num=15, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="joint") + for size_neighborhood in np.linspace(start=7, stop=50, num=20, endpoint=True).astype(int): + target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k1=k1, k2=k2) actual: np.ndarray = target( x=x, y=y, ) - np.testing.assert_allclose(actual=actual, desired=y, atol=7e-5) - - -def test_rsklpr_basic_regression_5d_with_conden_increasing_windows_expected_output() -> None: + np.testing.assert_allclose(actual=actual, desired=y, atol=4e-2) + + +@pytest.mark.parametrize( + argnames="x", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + for _ in range(3) + ], +) +@pytest.mark.parametrize( + argnames="y", + argvalues=[ + np.linspace(start=_rng.integers(low=-10, high=10), stop=_rng.integers(low=-10, high=10), num=50) + + _rng.uniform(low=-0.001, high=0.001, size=50) + for i in range(3) + ], +) +@pytest.mark.parametrize( + argnames="k1", + argvalues=[ + "tricube", + "laplacian", + ], +) +@pytest.mark.parametrize( + argnames="k2", + argvalues=[ + "joint", + "conden", + ], +) +@pytest.mark.slow +def test_rsklpr_smoke_test_1d_estimate_bootstrap_expected_output( + x: np.ndarray, y: np.ndarray, k1: str, k2: str +) -> None: """ - Smoke test that reasonable values are returned for a linear 5D input using the conden kernel. + Smoke test that reasonable values are returned for a linear 1D input using the joint kernel. """ - rng: np.random.Generator = np.random.default_rng(seed=12) - - x: np.ndarray = np.concatenate( - [ - np.linspace(start=-10.0, stop=10, num=50).reshape((-1, 1)), - (np.linspace(start=-5.0, stop=7, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=-15.0, stop=3, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=0, stop=8, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - (np.linspace(start=0, stop=-3, num=50) + rng.uniform(low=-0.01, high=0.01, size=50)).reshape((-1, 1)), - ], - axis=1, - ) - - y: np.ndarray = np.linspace(start=-2.0, stop=0.0, num=50) - size_neighborhood: int - - for size_neighborhood in np.linspace(start=7, stop=50, num=15, endpoint=True).astype(int): - target: Rsklpr = Rsklpr(size_neighborhood=size_neighborhood, k2="conden") - - actual: np.ndarray = target( - x=x, - y=y, - ) - - np.testing.assert_allclose(actual=actual, desired=y, atol=5e-6) + target: Rsklpr = Rsklpr(size_neighborhood=20, k1=k1, k2=k2) + target.fit(x=x, y=y) + actual: np.ndarray + conf_low_actual: np.ndarray + conf_upper_actual: np.ndarray + actual, conf_low_actual, conf_upper_actual = target.predict_bootstrap(x=x) + np.testing.assert_allclose(actual=actual, desired=y, atol=7e-3) + np.testing.assert_allclose(actual=conf_low_actual, desired=y, atol=7e-3) + np.testing.assert_allclose(actual=conf_upper_actual, desired=y, atol=7e-3) def test_rsklpr_init_expected_values(mocker: MockerFixture) -> None: @@ -255,12 +250,13 @@ def test_rsklpr_init_expected_values(mocker: MockerFixture) -> None: assert target._degree == 1 assert target._metric_x == "mahalanobis" assert target._metric_x_params is None - assert target._k1 == _laplacian_normalized + assert target._k1 == "laplacian" assert target._k2 == "joint" assert target._bw1 == "normal_reference" assert target._bw2 == "normal_reference" assert target._bw_global_subsample_size is None rsklpr.rsklpr.np_defualt_rng.assert_called_once_with(seed=888) # type: ignore [attr-defined] + assert target._k1_func == _laplacian_normalized mocker.patch("rsklpr.rsklpr.np_defualt_rng") target = Rsklpr( @@ -280,12 +276,13 @@ def test_rsklpr_init_expected_values(mocker: MockerFixture) -> None: assert target._degree == 0 assert target._metric_x == "minkowski" assert target._metric_x_params == {"p": 3} - assert target._k1 == _tricube_normalized + assert target._k1 == "tricube" assert target._k2 == "conden" assert target._bw1 == "cv_ls_global" assert target._bw2 == "scott" assert target._bw_global_subsample_size == 50 rsklpr.rsklpr.np_defualt_rng.assert_called_once_with(seed=45) # type: ignore [attr-defined] + assert target._k1_func == _tricube_normalized target = Rsklpr( size_neighborhood=12, @@ -355,3 +352,78 @@ def test_rsklpr_init_raises_for_incorrect_inputs() -> None: "'cv_ml', 'cv_ls', 'scott' or 'cv_ls_global'", ): Rsklpr(size_neighborhood=3, bw2="bla2") + + +def test_dim_data_expected_output() -> None: + """ + Tests the expected outputs are returned. + """ + assert _dim_data(data=np.array([0, 1, 2])) == 1 + assert _dim_data(data=np.array([[0], [1], [2]])) == 1 + assert _dim_data(data=np.array([[0, 4], [1, 5], [2, 6]])) == 2 + assert _dim_data(data=np.ones((100, 5))) == 5 + + +def test_laplacian_normalized_expected_output() -> None: + """ + Tests the expected outputs are returned. + """ + u: np.ndarray = np.linspace(start=0, stop=5) + actual: np.ndarray = _laplacian_normalized(u=u) + u /= 5.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + u = np.linspace(start=3, stop=4) + actual = _laplacian_normalized(u=u) + u /= 4.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + u = np.linspace(start=-2, stop=8) + actual = _laplacian_normalized(u=u) + u /= 8.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + u = np.linspace(start=0, stop=5).reshape(1, 50) + actual = _laplacian_normalized(u=u) + u /= 5.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + u = np.linspace(start=3, stop=4).reshape(1, 50) + actual = _laplacian_normalized(u=u) + u /= 4.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + u = np.linspace(start=-2, stop=8).reshape(1, 50) + actual = _laplacian_normalized(u=u) + u /= 8.0 + np.testing.assert_allclose(actual=actual, desired=np.exp(-u).reshape((1, 50))) + + +def test_tricube_normalized_expected_output() -> None: + """ + Tests the expected outputs are returned. + """ + u: np.ndarray = np.linspace(start=0, stop=5) + actual: np.ndarray = _tricube_normalized(u=u) + assert actual.min() == 0.0 + assert actual.max() == 1.0 + u /= 5.0 + desired: np.ndarray = (1.0 - u**3) ** 3 + np.testing.assert_allclose(actual=actual, desired=np.atleast_2d(desired)) + + u = np.linspace(start=0, stop=3).reshape(1, -1) + actual = _tricube_normalized(u=u) + assert actual.min() == 0.0 + assert actual.max() == 1.0 + u /= 3.0 + desired = (1.0 - u**3) ** 3 + np.testing.assert_allclose(actual=actual, desired=np.atleast_2d(desired)) + + +def test_tricube_normalized_raises_when_inputs_negative() -> None: + """ + Tests an assertion error is raised if the inputs have negative values. + """ + u: np.ndarray = np.linspace(start=-0.1, stop=5) + with pytest.raises(AssertionError): + _tricube_normalized(u=u)