2021-05-27 20:44:57 +02:00
{
"cells": [
{
"cell_type": "markdown",
"id": "50d1198e",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"<h1><center>Regresja jądrowa</center></h1>\n",
"\n",
"#### <center>Karolina Oparczyk, Tomasz Grzybowski, Jan Nowak</center>\n"
]
},
{
"cell_type": "markdown",
"id": "f792be04",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"Regresja jądrowa używana jest jako funkcja wagi do opracowania modelu regresji nieparametrycznej. Nadaje ona niektórym elementom zbioru większą \"wagę\", która ma wpływ na ostateczny wynik. \n",
"\n",
2021-05-31 18:49:23 +02:00
"Można ją porównać do rysowania krzywej na wykresie punktowym tak, aby była jak najlepiej do nich dopasowana."
2021-05-27 20:44:57 +02:00
]
},
{
"cell_type": "markdown",
"id": "ce35888e",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"Właściwości regresji jądrowej:\n",
"* symetryczna - wartość maksymalna leży pośrodku krzywej\n",
"<img src=\"files/symmetric.PNG\">\n",
"* powierzchnia pod krzywą funkcji wynosi 1\n",
"* wartość funkcji jądrowej nie jest ujemna"
]
},
{
"cell_type": "markdown",
"id": "dbe6165c",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
2021-05-31 18:49:23 +02:00
"Do implementacji regresji jądrowej można użyć wielu różnych jąder. Przykłady użyte w projekcie:\n",
2021-05-27 20:44:57 +02:00
"* jądro Gaussa\n",
"\\begin{equation}\n",
2021-05-31 18:49:23 +02:00
"K(x) = \\frac1{h\\sqrt{2\\pi}}e^{-\\frac12(\\frac{x - x_i}h)^2}\n",
2021-06-01 00:47:01 +02:00
"\\end{equation}"
2021-05-27 20:44:57 +02:00
]
},
{
2021-06-01 00:47:01 +02:00
"cell_type": "code",
"execution_count": 1,
"id": "italic-credits",
2021-05-27 20:44:57 +02:00
"metadata": {},
2021-06-01 00:47:01 +02:00
"outputs": [
{
"data": {
"text/html": [
" <script type=\"text/javascript\">\n",
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
" if (typeof require !== 'undefined') {\n",
" require.undef(\"plotly\");\n",
" define('plotly', function(require, exports, module) {\n",
" /**\n",
"* plotly.js v1.58.4\n",
"* Copyright 2012-2020, Plotly, Inc.\n",
"* All rights reserved.\n",
"* Licensed under the MIT license\n",
"*/\n",
"!function(t){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=t();else if(\"function\"==typeof define&&define.amd)define([],t);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l=\"function\"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error(\"Cannot find module '\"+o+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a=\"function\"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){\"use strict\";var n=t(\"../src/lib\"),i={\"X,X div\":\"direction:ltr;font-family:'Open Sans', verdana, arial, sans-serif;margin:0;padding:0;\",\"X input,X button\":\"font-family:'Open Sans', verdana, arial, sans-serif;\",\"X input:focus,X button:focus\":\"outline:none;\",\"X a\":\"text-decoration:none;\",\"X a:hover\":\"text-decoration:none;\",\"X .crisp\":\"shape-rendering:crispEdges;\",\"X .user-select-none\":\"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;\",\"X svg\":\"overflow:hidden;\",\"X svg a\":\"fill:#447adb;\",\"X svg a:hover\":\"fill:#3c6dc5;\",\"X .main-svg\":\"position:absolute;top:0;left:0;pointer-events:none;\",\"X .main-svg .draglayer\":\"pointer-events:all;\",\"X .cursor-default\":\"cursor:default;\",\"X .cursor-pointer\":\"cursor:pointer;\",\"X .cursor-crosshair\":\"cursor:crosshair;\",\"X .cursor-move\":\"cursor:move;\",\"X .cursor-col-resize\":\"cursor:col-resize;\",\"X .cursor-row-resize\":\"cursor:row-resize;\",\"X .cursor-ns-resize\":\"cursor:ns-resize;\",\"X .cursor-ew-resize\":\"cursor:ew-resize;\",\"X .cursor-sw-resize\":\"cursor:sw-resize;\",\"X .cursor-s-resize\":\"cursor:s-resize;\",\"X .cursor-se-resize\":\"cursor:se-resize;\",\"X .cursor-w-resize\":\"cursor:w-resize;\",\"X .cursor-e-resize\":\"cursor:e-resize;\",\"X .cursor-nw-resize\":\"cursor:nw-resize;\",\"X .cursor-n-resize\":\"cursor:n-resize;\",\"X .cursor-ne-resize\":\"cursor:ne-resize;\",\"X .cursor-grab\":\"cursor:-webkit-grab;cursor:grab;\",\"X .modebar\":\"position:absolute;top:2px;right:2px;\",\"X .ease-bg\":\"-webkit-transition:background-color 0.3s ease 0s;-moz-transition:background-color 0.3s ease 0s;-ms-transition:background-color 0.3s ease 0s;-o-transition:background-color 0.3s ease 0s;transition:background-color 0.3s ease 0s;\",\"X .modebar--hover>:not(.watermark)\":\"opacity:0;-webkit-transition:opacity 0.3s ease 0s;-moz-transition:opacity 0.3s ease 0s;-ms-transition:opacity 0.3s ease 0s;-o-transition:opacity 0.3s ease 0s;transition:opacity 0.3s ease 0s;\",\"X:hover .modebar--hover .modebar-group\":\"opacity:1;\",\"X .modebar-group\":\"float:left;display:inline-block;box-sizing:border-box;padding-left:8px;position:relative;vertical-align:middle;white-space:nowrap;\",\"X .modebar-btn\":\"position:relative;font-size:16px;padding:3px 4px;height:22px;cursor:pointer;line-height:normal;box-sizing:border-box;\",\"X .modebar-btn svg\":\"position:relative;top:2px;\",\"X .modebar.vertical\":\"display:flex;flex-direction:column;flex-wrap:wrap;align-content:flex-end;max-height:100%;\",\"X .modebar.vertical svg\":\"top:-1px;\",\"X .modebar.vertical .modebar-group\":\"display:block;float:none;padding-left:0px;padding-bottom:8px;\",\"X .modebar.vertical .modebar-group .modebar-btn\":\"display:block;text-align:center;\",\"X [data-title]:before,X [data-title]:after\":\"position:absolute;-webkit-transform:translate3d(0, 0, 0);-moz-transform:translate3d(0, 0, 0);-ms-transform:translate3d(0, 0, 0);-o-transform:translate3d(0, 0, 0);transform:translate3d(0, 0, 0);display:none;opacity:0;z-index:1001;pointer-events:none;top:110%;right:50%;\",\"X [data-title]:hover:before,X [data-title]:hover:after\":\"display:block;opacity:1;\",\"X [data-title]:before\":\"content:'';position:absolute;background:transparent;border:6px solid transpa
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>\n",
" * @license MIT\n",
" */function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function a(t){return r.Buffer&&\"function\"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t(\"util/\"),s=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c=\"foo\"===function(){}.name;function u(t){return Object.prototype.toString.call(t)}function f(t){return!a(t)&&(\"function\"==typeof r.ArrayBuffer&&(\"function\"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var h=e.exports=y,p=/\\s*function\\s+([^\\(\\s]*)\\s*/;function d(t){if(o.isFunction(t)){if(c)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return\"string\"==typeof t?t.length<e?t:t.slice(0,e):t}function m(t){if(c||!o.isFunction(t))return o.inspect(t);var e=d(t);return\"[Function\"+(e?\": \"+e:\"\")+\"]\"}function v(t,e,r,n,i){throw new h.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function y(t,e){t||v(t,!0,e,\"==\",h.ok)}function x(t,e,r,n){if(t===e)return!0;if(a(t)&&a(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&\"object\"==typeof t||null!==e&&\"object\"==typeof e){if(f(t)&&f(e)&&u(t)===u(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(a(t)!==a(e))return!1;var s=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==s&&s===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=b(t),a=b(e);if(i&&!a||!i&&a)return!1;if(i)return t=l.call(t),e=l.call(e),x(t,e,r);var s,c,u=T(t),f=T(e);if(u.length!==f.length)return!1;for(u.sort(),f.sort(),c=u.length-1;c>=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(s=u[c],!x(t[s],e[s],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function b(t){return\"[object Arguments]\"==Object.prototype.toString.call(t)}function _(t,e){if(!t||!e)return!1;if(\"[object RegExp]\"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function w(t,e,r,n){var i;if(\"function\"!=typeof e)throw new TypeError('\"block\" argument must be a function');\"string\"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?\" (\"+r.name+\").\":\".\")+(n?\" \"+n:\".\"),t&&!i&&v(i,r,\"Missing expected exception\"+n);var a=\"string\"==typeof n,s=!t&&i&&!r;if((!t&&o.isError(i)&&a&&_(i,r)||s)&&v(i,r,\"Got unwanted exception\"+n),t&&i&&r&&!_(i,r)||!t&&i)throw i}h.AssertionError=function(t){this.name=\"AssertionError\",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(m(t.actual),128)+\" \"+t.operator+\" \"+g(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||v;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),a=n.indexOf(\"\\n\"+i);if(a>=0){var o=n.indexOf(\"\\n\",a+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(h.AssertionError,Error),h.fail=v,h.ok=y,h.equal=function(t,e,r){t!=e&&v(t,e,r,\"==\",h.equal)},h.notEqual=function(t,e,r){t==e&&v(t,e,r,\"!=\",h.notEqual)},h.deepEqual=function(t,e,r){x(t,e,!1)||v(t,e,r,\"deepEqual\",h.deepEqual)},h.deepStrictEqual=function(t,e,r){x(t,e,!0)||v(t,e,r,\"deepStrictEqual\",h.deepStrictEqual)},h.notDeepEqual=function(t,e,r){x(t,e,!1)&&v(t,e,r,\"notDeepEqual\",h.notDeepEqual)},h.notDeepStrictEqual=function t(e,r,n){x(e,r,!0)&&v(e,r,n,\"notDeepStrictEqual\",t)},h.strictEqual=function(t,e
"/*!\n",
" * The buffer module from node.js, for the browser.\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"\"use strict\";var e=t(\"base64-js\"),n=t(\"ieee754\");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;function i(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if(\"number\"==typeof t){if(\"string\"==typeof e)throw new TypeError('The \"string\" argument must be of type string. Received type number');return l(t)}return o(t,e,r)}function o(t,e,r){if(\"string\"==typeof t)return function(t,e){\"string\"==typeof e&&\"\"!==e||(e=\"utf8\");if(!a.isEncoding(e))throw new TypeError(\"Unknown encoding: \"+e);var r=0|f(t,e),n=i(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(B(t,ArrayBuffer)||t&&B(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('\"offset\" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('\"length\" is outside of buffer bounds');var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=a.prototype,n}(t,e,r);if(\"number\"==typeof t)throw new TypeError('The \"value\" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return a.from(n,e,r);var o=function(t){if(a.isBuffer(t)){var e=0|u(t.length),r=i(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return\"number\"!=typeof t.length||N(t.length)?i(0):c(t);if(\"Buffer\"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(o)return o;if(\"undefined\"!=typeof Symbol&&null!=Symbol.toPrimitive&&\"function\"==typeof t[Symbol.toPrimitive])return a.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function s(t){if(\"number\"!=typeof t)throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function l(t){return s(t),i(t<0?0:0|u(t))}function c(t){for(var e=t.length<0?0:0|u(t.length),r=i(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function u(t){if(t>=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647..toString(16)+\" bytes\");return 0|t}function f(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||B(t,ArrayBuffer))return t.byteLength;if(\"string\"!=typeof t)throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return D(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return R(t).length;default:if(i)return n?-1:D(t).length;e=(\"\"+e).toLowerCase(),i=!0}}function h(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return A(this,e,r);case\"utf8\":case\"utf-8\":return T(this,e,r);case\"ascii\":return k(this,e,r);case\"latin1\":case\"binary\":return M(this,e,r);case\"base64\":return w(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return S(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),N(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}i
"/*!\n",
" * @overview es6-promise - a tiny implementation of Promises/A+.\n",
" * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n",
" * @license Licensed under MIT license\n",
" * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n",
" * @version v4.2.8+1e68dce6\n",
" */\n",
"!function(t,n){\"object\"==typeof r&&\"undefined\"!=typeof e?e.exports=n():t.ES6Promise=n()}(this,(function(){\"use strict\";function e(t){return\"function\"==typeof t}var r=Array.isArray?Array.isArray:function(t){return\"[object Array]\"===Object.prototype.toString.call(t)},a=0,o=void 0,s=void 0,l=function(t,e){g[a]=t,g[a+1]=e,2===(a+=2)&&(s?s(m):_())};var c=\"undefined\"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,h=\"undefined\"==typeof self&&\"undefined\"!=typeof n&&\"[object process]\"==={}.toString.call(n),p=\"undefined\"!=typeof Uint8ClampedArray&&\"undefined\"!=typeof importScripts&&\"undefined\"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var g=new Array(1e3);function m(){for(var t=0;t<a;t+=2){(0,g[t])(g[t+1]),g[t]=void 0,g[t+1]=void 0}a=0}var v,y,x,b,_=void 0;function w(t,e){var r=this,n=new this.constructor(M);void 0===n[k]&&D(n);var i=r._state;if(i){var a=arguments[i-1];l((function(){return z(i,n,a,r._result)}))}else I(r,n,t,e);return n}function T(t){if(t&&\"object\"==typeof t&&t.constructor===this)return t;var e=new this(M);return S(e,t),e}h?_=function(){return n.nextTick(m)}:f?(y=0,x=new f(m),b=document.createTextNode(\"\"),x.observe(b,{characterData:!0}),_=function(){b.data=y=++y%2}):p?((v=new MessageChannel).port1.onmessage=m,_=function(){return v.port2.postMessage(0)}):_=void 0===c&&\"function\"==typeof t?function(){try{var t=Function(\"return this\")().require(\"vertx\");return\"undefined\"!=typeof(o=t.runOnLoop||t.runOnContext)?function(){o(m)}:d()}catch(t){return d()}}():d();var k=Math.random().toString(36).substring(2);function M(){}function A(t,r,n){r.constructor===t.constructor&&n===w&&r.constructor.resolve===T?function(t,e){1===e._state?C(t,e._result):2===e._state?L(t,e._result):I(e,void 0,(function(e){return S(t,e)}),(function(e){return L(t,e)}))}(t,r):void 0===n?C(t,r):e(n)?function(t,e,r){l((function(t){var n=!1,i=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,(function(r){n||(n=!0,e!==r?S(t,r):C(t,r))}),(function(e){n||(n=!0,L(t,e))}),t._label);!n&&i&&(n=!0,L(t,i))}),t)}(t,r,n):C(t,r)}function S(t,e){if(t===e)L(t,new TypeError(\"You cannot resolve a promise with itself\"));else if(i=typeof(n=e),null===n||\"object\"!==i&&\"function\"!==i)C(t,e);else{var r=void 0;try{r=e.then}catch(e){return void L(t,e)}A(t,e,r)}var n,i}function E(t){t._onerror&&t._onerror(t._result),P(t)}function C(t,e){void 0===t._state&&(t._result=e,t._state=1,0!==t._subscribers.length&&l(P,t))}function L(t,e){void 0===t._state&&(t._state=2,t._result=e,l(E,t))}function I(t,e,r,n){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+1]=r,i[a+2]=n,0===a&&t._state&&l(P,t)}function P(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,i=void 0,a=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+r],n?z(r,n,i,a):i(a);t._subscribers.length=0}}function z(t,r,n,i){var a=e(n),o=void 0,s=void 0,l=!0;if(a){try{o=n(i)}catch(t){l=!1,s=t}if(r===o)return void L(r,new TypeError(\"A promises callback cannot return that same promise.\"))}else o=i;void 0!==r._state||(a&&l?S(r,o):!1===l?L(r,s):1===t?C(r,o):2===t&&L(r,o))}var O=0;function D(t){t[k]=O++,t._state=void 0,t._result=void 0,t._subscribers=[]}var R=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(M),this.promise[k]||D(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?C(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&C(this.promise,this._result))):L(this.promise,new Error(\"Array Methods must be provided an Array\"))}return t.prototype._enumerate=function(t){for(var e=0;void 0===this._state&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===T){var i=void 0,a=void 0,o=!1;try{i=t.then}catch(t){o=!0,a=t}if(i===w&&void 0!==t._state)this._settledAt(t._state,e,t._result);else if(\"function\"!=typeof i)this._remaining--,this._result[e]=t;else if(r===F){var s=new r
"/*!\n",
" * Determine if an object is a Buffer\n",
" *\n",
" * @author Feross Aboukhadijeh <https://feross.org>\n",
" * @license MIT\n",
" */\n",
"e.exports=function(t){return null!=t&&(n(t)||function(t){return\"function\"==typeof t.readFloatLE&&\"function\"==typeof t.slice&&n(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],466:[function(t,e,r){\"use strict\";e.exports=\"undefined\"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\\//.test(navigator.appVersion))},{}],467:[function(t,e,r){\"use strict\";e.exports=a,e.exports.isMobile=a,e.exports.default=a;var n=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,i=/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series[46]0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino|android|ipad|playbook|silk/i;function a(t){t||(t={});var e=t.ua;if(e||\"undefined\"==typeof navigator||(e=navigator.userAgent),e&&e.headers&&\"string\"==typeof e.headers[\"user-agent\"]&&(e=e.headers[\"user-agent\"]),\"string\"!=typeof e)return!1;var r=t.tablet?i.test(e):n.test(e);return!r&&t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&-1!==e.indexOf(\"Macintosh\")&&-1!==e.indexOf(\"Safari\")&&(r=!0),r}},{}],468:[function(t,e,r){\"use strict\";e.exports=function(t){var e=typeof t;return null!==t&&(\"object\"===e||\"function\"===e)}},{}],469:[function(t,e,r){\"use strict\";var n=Object.prototype.toString;e.exports=function(t){var e;return\"[object Object]\"===n.call(t)&&(null===(e=Object.getPrototypeOf(t))||e===Object.getPrototypeOf({}))}},{}],470:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}},{}],471:[function(t,e,r){\"use strict\";e.exports=function(t){return\"string\"==typeof t&&(t=t.trim(),!!(/^[mzlhvcsqta]\\s*[-+.0-9][^mlhvzcsqta]+/i.test(t)&&/[\\dz]$/i.test(t)&&t.length>4))}},{}],472:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],473:[function(t,e,r){!function(t,n){\"object\"==typeof r&&\"undefined\"!=typeof e?e.exports=n():(t=t||self).mapboxgl=n()}(this,(function(){\"use strict\";var t,e,r;function n(n,i){if(t)if(e){var a=\"var sharedChunk = {}; (\"+t+\")(sharedChunk); (\"+e+\")(sharedChunk);\",o={};t(o),(r=i(o)).workerUrl=window.URL.createObjectURL(new Blob([a],{type:\"text/javascript\"}))}else e=i;else t=i}return n(0,(function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var r=n;function n(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}n.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},n.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},n.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},n.prototype.solveCurveX=function(t,e){var r,n,i,a,o;for(void 0===e&&(e=1e-6),i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=a/s}if((i=t)<(r=0))return r;if(i>(n=1))return n;for(;r<n;){if(a=this.sampleCurveX(i),Math.abs(a-t)<e)return i;t>a?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=a;function a(t,e){this.x=t,this.y=e}function o(t,e,n,i){var a=new r(t,e,n,i);return function(t){return a.solve(t)}}a.prototype={clone:function(){return new a(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoi
"/*\n",
"object-assign\n",
"(c) Sindre Sorhus\n",
"@license MIT\n",
"*/\n",
"\"use strict\";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(t){if(null==t)throw new TypeError(\"Object.assign cannot be called with null or undefined\");return Object(t)}e.exports=function(){try{if(!Object.assign)return!1;var t=new String(\"abc\");if(t[5]=\"de\",\"5\"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e[\"_\"+String.fromCharCode(r)]=r;if(\"0123456789\"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(\"\"))return!1;var n={};return\"abcdefghijklmnopqrst\".split(\"\").forEach((function(t){n[t]=t})),\"abcdefghijklmnopqrst\"===Object.keys(Object.assign({},n)).join(\"\")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=o(t),c=1;c<arguments.length;c++){for(var u in r=Object(arguments[c]))i.call(r,u)&&(l[u]=r[u]);if(n){s=n(r);for(var f=0;f<s.length;f++)a.call(r,s[f])&&(l[s[f]]=r[s[f]])}}return l}},{}],500:[function(t,e,r){\"use strict\";e.exports=function(t,e,r,n,i,a,o,s,l,c){var u=e+a+c;if(f>0){var f=Math.sqrt(u+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,c);f=Math.sqrt(2*h-u+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],501:[function(t,e,r){\"use strict\";e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),u(r=[].slice.call(r,0,4),r);var i=new f(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),(\"eye\"in t||\"up\"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};var n=t(\"filtered-vector\"),i=t(\"gl-mat4/lookAt\"),a=t(\"gl-mat4/fromQuat\"),o=t(\"gl-mat4/invert\"),s=t(\"./lib/quatFromFrame\");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function c(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function u(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=c(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function f(t,e,r){this.radius=n([r]),this.center=n(e),this.rotation=n(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;u(e,e);var r=this.computedMatrix;a(r,e);var n=this.computedCenter,i=this.computedEye,o=this.computedUp,s=Math.exp(this.computedRadius[0]);i[0]=n[0]+s*r[2],i[1]=n[1]+s*r[6],i[2]=n[2]+s*r[10],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var c=0,f=0;f<3;++f)c+=r[l+4*f]*i[f];r[12+l]=-c}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],c=l(a,o,s);a/=c,o/=c,s/=c;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=l(u-=a*p,f-=o*p,h-=s*p);u/=d,f/=d,h/=d;var g=i[2],m=i[6],v=i[10],y=g*a+m*o+v*s,x=g*u+m*f+v*h,b=l(g-=y*a+x*u,m-=y*o+x*f,v-=y*s+x*h);g/=b,m/=b,v/=b;var _=u*e+a*r,w=f*e+o*r,T=h*e+s*r;this.center.move(t,_,w,T);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+n),this.radius.set(t,Math.log(k))},h.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],u=i[1],f=i[5],h=i[9],p=i[2],d=i[6],g=i[10],m=e*a+r*u,v=e*o+r*f,y=e*s+r*h,x=-(d*y-g*v),b=-(g*m-p*y),_=-(p*v-d*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),T=c(x,b,_,w);T>1e-6?(x/=T,b/=
"/*!\n",
" * pad-left <https://github.com/jonschlinkert/pad-left>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT license.\n",
" */\n",
"\"use strict\";var n=t(\"repeat-string\");e.exports=function(t,e,r){return n(r=\"undefined\"!=typeof r?r+\"\":\" \",e)+t}},{\"repeat-string\":541}],503:[function(t,e,r){\"use strict\";function n(t,e){if(\"string\"!=typeof t)return[t];var r=[t];\"string\"==typeof e||Array.isArray(e)?e={brackets:e}:e||(e={});var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:[\"{}\",\"[]\",\"()\"],i=e.escape||\"___\",a=!!e.flat;n.forEach((function(t){var e=new RegExp([\"\\\\\",t[0],\"[^\\\\\",t[0],\"\\\\\",t[1],\"]*\\\\\",t[1]].join(\"\")),n=[];function a(e,a,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;return n.push(s),i+s+i}r.forEach((function(t,n){for(var i,o=0;t!=i;)if(i=t,t=t.replace(e,a),o++>1e4)throw Error(\"References have circular dependency. Please, check them.\");r[n]=t})),n=n.reverse(),r=r.map((function(e){return n.forEach((function(r){e=e.replace(new RegExp(\"(\\\\\"+i+r+\"\\\\\"+i+\")\",\"g\"),t[0]+\"$1\"+t[1])})),e}))}));var o=new RegExp(\"\\\\\"+i+\"([0-9]+)\\\\\"+i);return a?r:function t(e,r,n){for(var i,a=[],s=0;i=o.exec(e);){if(s++>1e4)throw Error(\"Circular references in parenthesis\");a.push(e.slice(0,i.index)),a.push(t(r[i[1]],r)),e=e.slice(i.index+i[0].length)}return a.push(e),a}(r[0],r)}function i(t,e){if(e&&e.flat){var r,n=e&&e.escape||\"___\",i=t[0];if(!i)return\"\";for(var a=new RegExp(\"\\\\\"+n+\"([0-9]+)\\\\\"+n),o=0;i!=r;){if(o++>1e4)throw Error(\"Circular references in \"+t);r=i,i=i.replace(a,s)}return i}return t.reduce((function t(e,r){return Array.isArray(r)&&(r=r.reduce(t,\"\")),e+r}),\"\");function s(e,r){if(null==t[r])throw Error(\"Reference \"+r+\"is undefined\");return t[r]}}function a(t,e){return Array.isArray(t)?i(t,e):n(t,e)}a.parse=n,a.stringify=i,e.exports=a},{}],504:[function(t,e,r){\"use strict\";var n=t(\"pick-by-alias\");e.exports=function(t){var e;arguments.length>1&&(t=arguments);\"string\"==typeof t?t=t.split(/\\s/).map(parseFloat):\"number\"==typeof t&&(t=[t]);t.length&&\"number\"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:\"x l left Left\",top:\"y t top Top\",width:\"w width W Width\",height:\"h height W Width\",bottom:\"b bottom Bottom\",right:\"r right Right\"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{\"pick-by-alias\":511}],505:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,(function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),\"m\"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o=\"l\",r=\"m\"==r?\"l\":\"L\");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length<n[o])throw new Error(\"malformed path data\");e.push([r].concat(i.splice(0,n[o])))}})),e};var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var a=/-?[0-9]*\\.?[0-9]+(?:e[-+]?\\d+)?/gi},{}],506:[function(t,e,r){e.exports=function(t,e){e||(e=[0,\"\"]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\\d.\\-\\+]*\\s*(.*)/)[1]||\"\",e}},{}],507:[function(t,e,r){(function(t){(function(){\"use strict\";function r(t){if(\"string\"!=typeof t)throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(t))}function n(t,e){for(var r,n=\"\",i=0,a=-1,o=0,s=0;s<=t.length;++s){if(s<t.length)r=t.charCodeAt(s);else{if(47===r)break;r=47}if(47===r){if(a===s-1||1===o);else if(a!==s-1&&2===o){if(n.length<2||2!==i||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var l=n.lastIndexOf(\"/\");if(l!==n.length-1){-1===l?(n=\"\",i=0):i=(n=n.slice(0,l)).length-1-n.lastIndexOf(\"/\"),a=s,o=0;continue}}else if(2===n.length||1===n.length){n=\"\",i=0,a=s,o=0;continue}e&&(n.length>0?n+=\"/..\":n=\"..\",i=2)}else n.length>0?n+=\"/\"+t.slice(a+1,s):n=t.slice(a+1,s),i=s-a-1;a=s,o=0}else 46===r&&-1!==o?++o:o=-1}return n}var i={resolve:function(){for(var e,i=\"\",a=!1,o=arguments.length-1;o
"/*\n",
" * @copyright 2016 Sean Connelly (@voidqk), http://syntheti.cc\n",
" * @license MIT\n",
" * @preserve Project Home: https://github.com/voidqk/polybooljs\n",
" */\n",
"var n,i=t(\"./lib/build-log\"),a=t(\"./lib/epsilon\"),o=t(\"./lib/intersecter\"),s=t(\"./lib/segment-chainer\"),l=t(\"./lib/segment-selector\"),c=t(\"./lib/geojson\"),u=!1,f=a();function h(t,e,r){var i=n.segments(t),a=n.segments(e),o=r(n.combine(i,a));return n.polygon(o)}n={buildLog:function(t){return!0===t?u=i():!1===t&&(u=!1),!1!==u&&u.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=o(!0,f,u);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:o(!1,f,u).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:l.union(t.combined,u),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:l.intersect(t.combined,u),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:l.difference(t.combined,u),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:l.differenceRev(t.combined,u),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:l.xor(t.combined,u),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:s(t.segments,f,u),inverted:t.inverted}},polygonFromGeoJSON:function(t){return c.toPolygon(n,t)},polygonToGeoJSON:function(t){return c.fromPolygon(n,f,t)},union:function(t,e){return h(t,e,n.selectUnion)},intersect:function(t,e){return h(t,e,n.selectIntersect)},difference:function(t,e){return h(t,e,n.selectDifference)},differenceRev:function(t,e){return h(t,e,n.selectDifferenceRev)},xor:function(t,e){return h(t,e,n.selectXor)}},\"object\"==typeof window&&(window.PolyBool=n),e.exports=n},{\"./lib/build-log\":518,\"./lib/epsilon\":519,\"./lib/geojson\":520,\"./lib/intersecter\":521,\"./lib/segment-chainer\":523,\"./lib/segment-selector\":524}],518:[function(t,e,r){e.exports=function(){var t,e=0,r=!1;function n(e,r){return t.list.push({type:e,data:r?JSON.parse(JSON.stringify(r)):void 0}),t}return t={list:[],segmentId:function(){return e++},checkIntersection:function(t,e){return n(\"check\",{seg1:t,seg2:e})},segmentChop:function(t,e){return n(\"div_seg\",{seg:t,pt:e}),n(\"chop\",{seg:t,pt:e})},statusRemove:function(t){return n(\"pop_seg\",{seg:t})},segmentUpdate:function(t){return n(\"seg_update\",{seg:t})},segmentNew:function(t,e){return n(\"new_seg\",{seg:t,primary:e})},segmentRemove:function(t){return n(\"rem_seg\",{seg:t})},tempStatus:function(t,e,r){return n(\"temp_status\",{seg:t,above:e,below:r})},rewind:function(t){return n(\"rewind\",{seg:t})},status:function(t,e,r){return n(\"status\",{seg:t,above:e,below:r})},vert:function(e){return e===r?t:(r=e,n(\"vert\",{x:e}))},log:function(t){return\"string\"!=typeof t&&(t=JSON.stringify(t,!1,\" \")),n(\"log\",{txt:t})},reset:function(){return n(\"reset\")},selected:function(t){return n(\"selected\",{segs:t})},chainStart:function(t){return n(\"chain_start\",{seg:t})},chainRemoveHead:function(t,e){return n(\"chain_rem_head\",{index:t,pt:e})},chainRemoveTail:function(t,e){return n(\"chain_rem_tail\",{index:t,pt:e})},chainNew:function(t,e){return n(\"chain_new\",{pt1:t,pt2:e})},chainMatch:function(t){return n(\"chain_match\",{index:t})},chainClose:function(t){return n(\"chain_close\",{index:t})},chainAddHead:function(t,e){return n(\"chain_add_head\",{index:t,pt:e})},chainAddTail:function(t,e){return n(\"chain_add_tail\",{index:t,pt:e})},chainConnect:function(t,e){return n(\"chain_con\",{index1:t,index2:e})},chainReverse:function(t){return n(\"chain_rev\",{index:t})},chainJoin:function(t,e){return n(\"chain_join\",{index1:t,index2:e})},done:function(){return n(\"done\")}}}},{}],519:[function(t,e,r){e.exports=function(t){\"number\"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return\"number\"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var i=r[0],a=r[1],o=n[0],s=n[1],l=e[0];return(o-i)*(e[1]-a)-(s-a)*(l-i)>=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l<t)&&!(l-(a*a+s*s)>-t)},pointsSameX:function(e,r){r
"/*!\n",
" * repeat-string <https://github.com/jonschlinkert/repeat-string>\n",
" *\n",
" * Copyright (c) 2014-2015, Jon Schlinkert.\n",
" * Licensed under the MIT License.\n",
" */\n",
"\"use strict\";var n,i=\"\";e.exports=function(t,e){if(\"string\"!=typeof t)throw new TypeError(\"expected a string\");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||\"undefined\"==typeof n)n=t,i=\"\";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],542:[function(t,e,r){(function(t){(function(){e.exports=t.performance&&t.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this)}).call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{})},{}],543:[function(t,e,r){\"use strict\";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i];(l=o-((r=a+o)-a))&&(t[--n]=r,r=l)}var s=0;for(i=n;i<e;++i){var l;a=t[i];(l=(o=r)-((r=a+o)-a))&&(t[s++]=l)}return t[s++]=r,t.length=s,t}},{}],544:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-scale\"),o=t(\"robust-compress\");function s(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function l(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=[\"m[\",r,\"][\",n,\"]\"].join(\"\")}return e}function c(t){if(2===t.length)return[\"sum(prod(\",t[0][0],\",\",t[1][1],\"),prod(-\",t[0][1],\",\",t[1][0],\"))\"].join(\"\");for(var e=[],r=0;r<t.length;++r)e.push([\"scale(\",c(s(t,r)),\",\",(n=r,1&n?\"-\":\"\"),t[0][r],\")\"].join(\"\"));return function t(e){if(1===e.length)return e[0];if(2===e.length)return[\"sum(\",e[0],\",\",e[1],\")\"].join(\"\");var r=e.length>>1;return[\"sum(\",t(e.slice(0,r)),\",\",t(e.slice(r)),\")\"].join(\"\")}(e);var n}function u(t){return new Function(\"sum\",\"scale\",\"prod\",\"compress\",[\"function robustDeterminant\",t,\"(m){return compress(\",c(l(t)),\")};return robustDeterminant\",t].join(\"\"))(i,a,n,o)}var f=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;f.length<6;)f.push(u(f.length));for(var t=[],r=[\"function robustDeterminant(m){switch(m.length){\"],n=0;n<6;++n)t.push(\"det\"+n),r.push(\"case \",n,\":return det\",n,\"(m);\");r.push(\"}var det=CACHE[m.length];if(!det)det=CACHE[m.length]=gen(m.length);return det(m);}return robustDeterminant\"),t.push(\"CACHE\",\"gen\",r.join(\"\"));var i=Function.apply(void 0,t);for(e.exports=i.apply(void 0,f.concat([f,u])),n=0;n<f.length;++n)e.exports[n]=f[n]}()},{\"robust-compress\":543,\"robust-scale\":550,\"robust-sum\":553,\"two-product\":582}],545:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\");e.exports=function(t,e){for(var r=n(t[0],e[0]),a=1;a<t.length;++a)r=i(r,n(t[a],e[a]));return r}},{\"robust-sum\":553,\"two-product\":582}],546:[function(t,e,r){\"use strict\";var n=t(\"two-product\"),i=t(\"robust-sum\"),a=t(\"robust-subtract\"),o=t(\"robust-scale\");function s(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function l(t){if(1===t.length)return t[0];if(2===t.length)return[\"sum(\",t[0],\",\",t[1],\")\"].join(\"\");var e=t.length>>1;return[\"sum(\",l(t.slice(0,e)),\",\",l(t.slice(e)),\")\"].join(\"\")}function c(t,e){if(\"m\"===t.charAt(0)){if(\"w\"===e.charAt(0)){var r=t.split(\"[\");return[\"w\",e.substr(1),\"m\",r[0].substr(1)].join(\"\")}return[\"prod(\",t,\",\",e,\")\"].join(\"\")}return c(e,t)}function u(t){if(2===t.length)return[[\"diff(\",c(t[0][0],t[1][1]),\",\",c(t[1][0],t[0][1]),\")\"].join(\"\")];for(var e=[],r=0;r<t.length;++r)e.push([\"scale(\",l(u(s(t,r))),\",\",(n=r,!0&n?\"-\":\"\"),t[0][r],\")\"].join(\"\"));return e;var n}function f(t,e){for(var r=[],n=0;n<e-2;++n)r.push([\"prod(m\",t,\"[\",n,\"],m\",t,\"[\",n,\"])\"].join(\"\"));return l(r)}function h(t){for(var e=[],r=[],c=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=[\"m\",n,\"[\",t-r-2,\"]\"].join(\"\")}return e}(t),h=0;h<t;++h)c[0][h]=\
" });\n",
" require(['plotly'], function(Plotly) {\n",
" window._Plotly = Plotly;\n",
" });\n",
" }\n",
" </script>\n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "x=%{x}<br>y=%{y}<extra></extra>",
"legendgroup": "",
"line": {
"color": "#636efa",
"dash": "solid"
},
"mode": "lines",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
-4,
-3.9,
-3.8,
-3.6999999999999997,
-3.5999999999999996,
-3.4999999999999996,
-3.3999999999999995,
-3.2999999999999994,
-3.1999999999999993,
-3.099999999999999,
-2.999999999999999,
-2.899999999999999,
-2.799999999999999,
-2.699999999999999,
-2.5999999999999988,
-2.4999999999999987,
-2.3999999999999986,
-2.2999999999999985,
-2.1999999999999984,
-2.0999999999999983,
-1.9999999999999982,
-1.8999999999999981,
-1.799999999999998,
-1.699999999999998,
-1.5999999999999979,
-1.4999999999999978,
-1.3999999999999977,
-1.2999999999999976,
-1.1999999999999975,
-1.0999999999999974,
-0.9999999999999973,
-0.8999999999999972,
-0.7999999999999972,
-0.6999999999999971,
-0.599999999999997,
-0.4999999999999969,
-0.3999999999999968,
-0.2999999999999967,
-0.19999999999999662,
-0.09999999999999654,
3.552713678800501e-15,
0.1000000000000032,
0.20000000000000373,
0.30000000000000426,
0.4000000000000039,
0.5000000000000036,
0.6000000000000041,
0.7000000000000046,
0.8000000000000043,
0.9000000000000039,
1.0000000000000044,
1.100000000000005,
1.2000000000000046,
1.3000000000000043,
1.4000000000000048,
1.5000000000000053,
1.600000000000005,
1.7000000000000046,
1.8000000000000052,
1.9000000000000057,
2.0000000000000053,
2.100000000000005,
2.2000000000000055,
2.300000000000006,
2.4000000000000057,
2.5000000000000053,
2.600000000000006,
2.7000000000000064,
2.800000000000006,
2.9000000000000057,
3.000000000000006,
3.1000000000000068,
3.2000000000000064,
3.300000000000006,
3.4000000000000066,
3.500000000000007,
3.6000000000000068,
3.7000000000000064,
3.800000000000007,
3.9000000000000075
],
"xaxis": "x",
"y": [
0.00013383022576488537,
0.00019865547139277272,
0.00029194692579146027,
0.0004247802705507522,
0.000611901930113773,
0.0008726826950457617,
0.001232219168473021,
0.0017225689390536843,
0.0023840882014648486,
0.0032668190561999273,
0.004431848411938019,
0.005952532419775869,
0.00791545158297999,
0.010420934814422628,
0.013582969233685661,
0.017528300493568592,
0.02239453029484297,
0.028327037741601276,
0.03547459284623157,
0.04398359598042735,
0.05399096651318825,
0.06561581477467683,
0.07895015830089443,
0.09404907737688725,
0.11092083467945592,
0.12951759566589216,
0.14972746563574535,
0.1713685920478079,
0.19418605498321354,
0.21785217703255116,
0.24197072451914403,
0.2660852498987555,
0.28969155276148345,
0.31225393336676194,
0.3332246028918003,
0.3520653267643001,
0.36827014030332383,
0.38138781546052447,
0.39104269397545616,
0.3969525474770119,
0.3989422804014327,
0.39695254747701164,
0.3910426939754556,
0.3813878154605236,
0.3682701403033227,
0.35206532676429886,
0.33322460289179884,
0.3122539333667603,
0.2896915527614818,
0.2660852498987539,
0.2419707245191423,
0.21785217703254933,
0.19418605498321187,
0.1713685920478064,
0.14972746563574385,
0.1295175956658907,
0.11092083467945468,
0.0940490773768862,
0.07895015830089343,
0.06561581477467589,
0.05399096651318749,
0.04398359598042675,
0.035474592846231015,
0.028327037741600784,
0.022394530294842594,
0.017528300493568304,
0.013582969233685408,
0.010420934814422415,
0.007915451582979832,
0.005952532419775758,
0.004431848411937925,
0.003266819056199852,
0.0023840882014647936,
0.001722568939053646,
0.0012322191684729913,
0.0008726826950457385,
0.0006119019301137573,
0.0004247802705507417,
0.0002919469257914525,
0.00019865547139276686
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"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": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"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,
"#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,
"#f0f921"
]
],
"sequentialminus": [
[
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,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Funkcja jądrowa Gaussa"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "x"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "y"
}
}
}
},
"text/html": [
2021-06-01 16:30:04 +02:00
"<div> <div id=\"d29817db-a40d-492d-862b-eec0c312867c\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"d29817db-a40d-492d-862b-eec0c312867c\")) { Plotly.newPlot( \"d29817db-a40d-492d-862b-eec0c312867c\", [{\"hovertemplate\": \"x=%{x}<br>y=%{y}<extra></extra>\", \"legendgroup\": \"\", \"line\": {\"color\": \"#636efa\", \"dash\": \"solid\"}, \"mode\": \"lines\", \"name\": \"\", \"orientation\": \"v\", \"showlegend\": false, \"type\": \"scatter\", \"x\": [-4.0, -3.9, -3.8, -3.6999999999999997, -3.5999999999999996, -3.4999999999999996, -3.3999999999999995, -3.2999999999999994, -3.1999999999999993, -3.099999999999999, -2.999999999999999, -2.899999999999999, -2.799999999999999, -2.699999999999999, -2.5999999999999988, -2.4999999999999987, -2.3999999999999986, -2.2999999999999985, -2.1999999999999984, -2.0999999999999983, -1.9999999999999982, -1.8999999999999981, -1.799999999999998, -1.699999999999998, -1.5999999999999979, -1.4999999999999978, -1.3999999999999977, -1.2999999999999976, -1.1999999999999975, -1.0999999999999974, -0.9999999999999973, -0.8999999999999972, -0.7999999999999972, -0.6999999999999971, -0.599999999999997, -0.4999999999999969, -0.3999999999999968, -0.2999999999999967, -0.19999999999999662, -0.09999999999999654, 3.552713678800501e-15, 0.1000000000000032, 0.20000000000000373, 0.30000000000000426, 0.4000000000000039, 0.5000000000000036, 0.6000000000000041, 0.7000000000000046, 0.8000000000000043, 0.9000000000000039, 1.0000000000000044, 1.100000000000005, 1.2000000000000046, 1.3000000000000043, 1.4000000000000048, 1.5000000000000053, 1.600000000000005, 1.7000000000000046, 1.8000000000000052, 1.9000000000000057, 2.0000000000000053, 2.100000000000005, 2.2000000000000055, 2.300000000000006, 2.4000000000000057, 2.5000000000000053, 2.600000000000006, 2.7000000000000064, 2.800000000000006, 2.9000000000000057, 3.000000000000006, 3.1000000000000068, 3.2000000000000064, 3.300000000000006, 3.4000000000000066, 3.500000000000007, 3.6000000000000068, 3.7000000000000064, 3.800000000000007, 3.9000000000000075], \"xaxis\": \"x\", \"y\": [0.00013383022576488537, 0.00019865547139277272, 0.00029194692579146027, 0.0004247802705507522, 0.000611901930113773, 0.0008726826950457617, 0.001232219168473021, 0.0017225689390536843, 0.0023840882014648486, 0.0032668190561999273, 0.004431848411938019, 0.005952532419775869, 0.00791545158297999, 0.010420934814422628, 0.013582969233685661, 0.017528300493568592, 0.02239453029484297, 0.028327037741601276, 0.03547459284623157, 0.04398359598042735, 0.05399096651318825, 0.06561581477467683, 0.07895015830089443, 0.09404907737688725, 0.11092083467945592, 0.12951759566589216, 0.14972746563574535, 0.1713685920478079, 0.19418605498321354, 0.21785217703255116, 0.24197072451914403, 0.2660852498987555, 0.28969155276148345, 0.31225393336676194, 0.3332246028918003, 0.3520653267643001, 0.36827014030332383, 0.38138781546052447, 0.39104269397545616, 0.3969525474770119, 0.3989422804014327, 0.39695254747701164, 0.3910426939754556, 0.3813878154605236, 0.3682701403033227, 0.35206532676429886, 0.33322460289179884, 0.3122539333667603, 0.2896915527614818, 0.2660852498987539, 0.2419707245191423, 0.21785217703254933, 0.19418605498321187, 0.1713685920478064, 0.14972746563574385, 0.1295175956658907, 0.11092083467945468, 0.0940490773768862, 0.07895015830089343, 0.06561581477467589, 0.05399096651318749, 0.04398359598042675, 0.035474592846231015, 0.028327037741600784, 0.022394530294842594, 0.017528300493568304, 0.013582969233685408, 0.010420934814422415, 0.007915451582979832, 0.005952532419775758, 0.004431848411937925, 0.003266819056199852, 0.0023840882014647936, 0.001722568939053646, 0.0012322191684729913, 0.0008726826950457385, 0.0006119019301137573, 0.0004247802705507417, 0.0002919
2021-06-01 00:47:01 +02:00
" \n",
2021-06-01 16:30:04 +02:00
"var gd = document.getElementById('d29817db-a40d-492d-862b-eec0c312867c');\n",
2021-06-01 00:47:01 +02:00
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import KernelRegression\n",
"import plotly.express as px\n",
"import numpy as np\n",
"kernel_x = np.arange(-4,4,0.1)\n",
"col = KernelRegression.kernel_function(1, kernel_x, 0)\n",
"px.line(x=kernel_x, y=col, title='Funkcja jądrowa Gaussa')"
]
},
{
"cell_type": "markdown",
"id": "f46e92e5",
"metadata": {},
"source": [
"* jądro Epanechnikova\n",
"\\begin{equation}\n",
"K(x) = (\\frac34)(1-(\\frac{x - x_i}h)^2) \\text{ dla } {|x|\\leq1}\n",
"\\end{equation}"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "victorian-equality",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "x=%{x}<br>y=%{y}<extra></extra>",
"legendgroup": "",
"line": {
"color": "#636efa",
"dash": "solid"
},
"mode": "lines",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
-2,
-1.9,
-1.7999999999999998,
-1.6999999999999997,
-1.5999999999999996,
-1.4999999999999996,
-1.3999999999999995,
-1.2999999999999994,
-1.1999999999999993,
-1.0999999999999992,
-0.9999999999999991,
-0.899999999999999,
-0.7999999999999989,
-0.6999999999999988,
-0.5999999999999988,
-0.49999999999999867,
-0.3999999999999986,
-0.2999999999999985,
-0.1999999999999984,
-0.09999999999999831,
1.7763568394002505e-15,
0.10000000000000187,
0.20000000000000195,
0.30000000000000204,
0.40000000000000213,
0.5000000000000022,
0.6000000000000023,
0.7000000000000024,
0.8000000000000025,
0.9000000000000026,
1.0000000000000027,
1.1000000000000028,
1.2000000000000028,
1.300000000000003,
1.400000000000003,
1.500000000000003,
1.6000000000000032,
1.7000000000000033,
1.8000000000000034,
1.9000000000000035
],
"xaxis": "x",
"y": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1.3322676295501878e-15,
0.1425000000000013,
0.27000000000000124,
0.3825000000000012,
0.4800000000000011,
0.562500000000001,
0.6300000000000009,
0.6825000000000007,
0.7200000000000004,
0.7425000000000003,
0.75,
0.7424999999999997,
0.7199999999999994,
0.6824999999999991,
0.6299999999999988,
0.5624999999999983,
0.47999999999999793,
0.3824999999999975,
0.269999999999997,
0.14249999999999655,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"yaxis": "y"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"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": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"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,
"#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,
"#f0f921"
]
],
"sequentialminus": [
[
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,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"title": {
"text": "Funkcja jądrowa Epanechnikova"
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "x"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "y"
}
}
}
},
"text/html": [
2021-06-01 16:30:04 +02:00
"<div> <div id=\"2e269f5e-ba63-477a-ad02-871a52d0679e\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"2e269f5e-ba63-477a-ad02-871a52d0679e\")) { Plotly.newPlot( \"2e269f5e-ba63-477a-ad02-871a52d0679e\", [{\"hovertemplate\": \"x=%{x}<br>y=%{y}<extra></extra>\", \"legendgroup\": \"\", \"line\": {\"color\": \"#636efa\", \"dash\": \"solid\"}, \"mode\": \"lines\", \"name\": \"\", \"orientation\": \"v\", \"showlegend\": false, \"type\": \"scatter\", \"x\": [-2.0, -1.9, -1.7999999999999998, -1.6999999999999997, -1.5999999999999996, -1.4999999999999996, -1.3999999999999995, -1.2999999999999994, -1.1999999999999993, -1.0999999999999992, -0.9999999999999991, -0.899999999999999, -0.7999999999999989, -0.6999999999999988, -0.5999999999999988, -0.49999999999999867, -0.3999999999999986, -0.2999999999999985, -0.1999999999999984, -0.09999999999999831, 1.7763568394002505e-15, 0.10000000000000187, 0.20000000000000195, 0.30000000000000204, 0.40000000000000213, 0.5000000000000022, 0.6000000000000023, 0.7000000000000024, 0.8000000000000025, 0.9000000000000026, 1.0000000000000027, 1.1000000000000028, 1.2000000000000028, 1.300000000000003, 1.400000000000003, 1.500000000000003, 1.6000000000000032, 1.7000000000000033, 1.8000000000000034, 1.9000000000000035], \"xaxis\": \"x\", \"y\": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.3322676295501878e-15, 0.1425000000000013, 0.27000000000000124, 0.3825000000000012, 0.4800000000000011, 0.562500000000001, 0.6300000000000009, 0.6825000000000007, 0.7200000000000004, 0.7425000000000003, 0.75, 0.7424999999999997, 0.7199999999999994, 0.6824999999999991, 0.6299999999999988, 0.5624999999999983, 0.47999999999999793, 0.3824999999999975, 0.269999999999997, 0.14249999999999655, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], \"yaxis\": \"y\"}], {\"legend\": {\"tracegroupgap\": 0}, \"template\": {\"data\": {\"bar\": [{\"error_x\": {\"color\": \"#2a3f5f\"}, \"error_y\": {\"color\": \"#2a3f5f\"}, \"marker\": {\"line\": {\"color\": \"#E5ECF6\", \"width\": 0.5}}, \"type\": \"bar\"}], \"barpolar\": [{\"marker\": {\"line\": {\"color\": \"#E5ECF6\", \"width\": 0.5}}, \"type\": \"barpolar\"}], \"carpet\": [{\"aaxis\": {\"endlinecolor\": \"#2a3f5f\", \"gridcolor\": \"white\", \"linecolor\": \"white\", \"minorgridcolor\": \"white\", \"startlinecolor\": \"#2a3f5f\"}, \"baxis\": {\"endlinecolor\": \"#2a3f5f\", \"gridcolor\": \"white\", \"linecolor\": \"white\", \"minorgridcolor\": \"white\", \"startlinecolor\": \"#2a3f5f\"}, \"type\": \"carpet\"}], \"choropleth\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"type\": \"choropleth\"}], \"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\"}], \"contourcarpet\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"type\": \"contourcarpet\"}], \"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\"}], \"heatmapgl\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.22222222222
2021-06-01 00:47:01 +02:00
" \n",
2021-06-01 16:30:04 +02:00
"var gd = document.getElementById('2e269f5e-ba63-477a-ad02-871a52d0679e');\n",
2021-06-01 00:47:01 +02:00
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
2021-05-27 20:44:57 +02:00
"source": [
2021-06-01 00:47:01 +02:00
"kernel_x = np.arange(-2,2,0.1)\n",
"col = KernelRegression.epanechnikov_list(1, kernel_x, 0)\n",
"px.line(x=kernel_x, y=col, title='Funkcja jądrowa Epanechnikova')"
2021-05-27 20:44:57 +02:00
]
2021-05-31 18:49:23 +02:00
},
{
"cell_type": "markdown",
2021-05-31 21:44:34 +02:00
"id": "6d60bbc1",
2021-05-31 18:49:23 +02:00
"metadata": {},
"source": [
"Istotne znaczenie ma nie tylko dobór jądra, ale również parametru wygładzania, czyli szerokości okna. W zależności od niego, punkty są grupowane i dla każdej grupy wyliczana jest wartość funkcji. Jeśli okno będzie zbyt szerokie, funkcja będzie bardziej przypominała prostą (under-fitting). Natomiast jeśli będzie zbyt wąskie, funkcja będzie za bardzo \"skakać\" (over-fitting).\n",
"\n",
"Wyliczenie wartości funkcji polega na wzięciu średniej ważonej z $y_{i}$\n",
2021-06-01 00:47:01 +02:00
" dla takich $x_{i}$, które znajdują się blisko x, dla którego wyznaczamy wartość. Wagi przy $y_{i}$ dla x sumują się do 1 i są wyższe, kiedy $x_{i}$ jest bliżej x oraz niższe w przeciwnym przypadku.\n",
"<br/><br/>\n",
"<div style=\"font-size: 26px\">\\begin{equation}w_i= \\frac{K_i}{\\sum\\limits_{i=1}^n K_i} \\end{equation}\n",
"<br/><br/>\n",
"\\begin{equation} Y=w_1*x_1+w_2*x_2+ \\text{...} +w_n*x_n \\end{equation}</div>\n",
"<img src=\"files/est_weights.png\">"
2021-05-31 18:49:23 +02:00
]
},
{
"cell_type": "code",
2021-06-01 00:47:01 +02:00
"execution_count": 3,
2021-05-31 21:44:34 +02:00
"id": "4ae1bce9",
2021-05-31 18:49:23 +02:00
"metadata": {},
2021-05-31 22:25:34 +02:00
"outputs": [],
2021-05-31 18:49:23 +02:00
"source": [
2021-05-31 22:16:04 +02:00
"import ipywidgets as widgets\n",
2021-05-31 18:49:23 +02:00
"import plotly.graph_objs as go\n",
"import pandas as pd \n",
"\n",
"fires_thefts = pd.read_csv('fires_thefts.csv', names=['x','y'])\n",
2021-06-01 01:16:14 +02:00
"fires_thefts=fires_thefts.sort_values('x')\n",
2021-06-01 01:28:45 +02:00
"X = np.array(fires_thefts.x)\n",
"Y = np.array(fires_thefts.y)"
2021-05-31 18:49:23 +02:00
]
},
2021-05-31 22:16:04 +02:00
{
"cell_type": "code",
2021-06-01 00:47:01 +02:00
"execution_count": 4,
2021-05-31 22:16:04 +02:00
"id": "loved-clinton",
"metadata": {},
"outputs": [],
"source": [
"\n",
"dropdown_bw = widgets.Dropdown(options=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], value=1, description='Szerokość okna')\n",
"\n",
2021-06-01 00:47:01 +02:00
"def interactive_kernel(bw_manual): \n",
2021-06-01 01:28:45 +02:00
" Y_pred_gauss = KernelRegression.ker_reg(X, Y, bw_manual, 'gauss')\n",
" Y_pred_epanechnikov = KernelRegression.ker_reg(X, Y, bw_manual, 'epanechnikov')\n",
2021-05-31 22:16:04 +02:00
"\n",
2021-06-01 01:28:45 +02:00
" fig = px.scatter(x=X,y=Y)\n",
" fig.add_trace(go.Scatter(x=X, y=np.array(Y_pred_gauss), name='Gauss', mode='lines'))\n",
" fig.add_trace(go.Scatter(x=X, y=np.array(Y_pred_epanechnikov), name='Epanechnikov', mode='lines'))\n",
2021-06-01 00:47:01 +02:00
" fig.show()\n",
" \n",
" # kernel regression\n",
2021-06-01 01:28:45 +02:00
" kernel_x = np.arange(min(X)-5,max(X)+5, 0.1)\n",
2021-06-01 00:47:01 +02:00
"\n",
" ## Plotting gaussian for all input x points \n",
" kernel_fns = {'kernel_x': kernel_x}\n",
2021-06-01 01:28:45 +02:00
" for input_x in X: \n",
2021-06-01 00:47:01 +02:00
" input_string= 'x_value_{}'.format(np.round(input_x,2)) \n",
" kernel_fns[input_string] = KernelRegression.kernel_function(bw_manual, kernel_x, input_x)\n",
"\n",
" kernels_df = pd.DataFrame(data=kernel_fns)\n",
" y_all = kernels_df.drop(columns='kernel_x')\n",
2021-06-01 01:28:45 +02:00
" fig = px.line(kernels_df, x='kernel_x', y=y_all.columns, title='Gaussian for all input points', range_x=[min(X)-5,max(X)+5]) \n",
2021-05-31 22:16:04 +02:00
" fig.show()"
]
},
{
"cell_type": "code",
2021-06-01 00:47:01 +02:00
"execution_count": 5,
2021-05-31 22:16:04 +02:00
"id": "injured-english",
2021-06-01 00:47:01 +02:00
"metadata": {
"scrolled": false
},
2021-05-31 22:16:04 +02:00
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
2021-06-01 16:30:04 +02:00
"model_id": "722bc244f3d24c5ba1875e43ed5be82c",
2021-05-31 22:16:04 +02:00
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Dropdown(description='Szerokość okna', options=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), value=1)…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<function __main__.interactive_kernel(bw_manual)>"
]
},
2021-06-01 00:47:01 +02:00
"execution_count": 5,
2021-05-31 22:16:04 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"widgets.interact(interactive_kernel, bw_manual=dropdown_bw)"
]
},
2021-05-31 18:49:23 +02:00
{
"cell_type": "code",
2021-06-01 01:16:14 +02:00
"execution_count": 6,
2021-06-01 01:28:45 +02:00
"id": "demographic-clearing",
2021-06-01 00:47:01 +02:00
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Input_x</th>\n",
" <th>kernel_x</th>\n",
" <th>weigth</th>\n",
" <th>Y</th>\n",
" <th>Y=w0*x0+w1*x1+...+w41*x41</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(2.0)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000001506</td>\n",
2021-06-01 01:16:14 +02:00
" <td>11</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(2.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000001862</td>\n",
2021-06-01 01:16:14 +02:00
" <td>9</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(2.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000001862</td>\n",
2021-06-01 01:16:14 +02:00
" <td>14</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(2.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000002551</td>\n",
2021-06-01 01:16:14 +02:00
" <td>22</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(3.4)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000006423</td>\n",
2021-06-01 01:16:14 +02:00
" <td>17</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(3.6)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000007851</td>\n",
2021-06-01 01:16:14 +02:00
" <td>15</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(4.0)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000011675</td>\n",
2021-06-01 01:16:14 +02:00
" <td>16</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(4.8)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000025327</td>\n",
2021-06-01 01:16:14 +02:00
" <td>19</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(5.0)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000030615</td>\n",
2021-06-01 01:16:14 +02:00
" <td>32</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(5.4)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000044518</td>\n",
2021-06-01 01:16:14 +02:00
" <td>27</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(5.6)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000053554</td>\n",
2021-06-01 01:16:14 +02:00
" <td>23</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(5.7)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000058703</td>\n",
2021-06-01 01:16:14 +02:00
" <td>11</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(6.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000092341</td>\n",
2021-06-01 01:16:14 +02:00
" <td>29</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(6.9)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000171209</td>\n",
2021-06-01 01:16:14 +02:00
" <td>18</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(7.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000221736</td>\n",
2021-06-01 01:16:14 +02:00
" <td>29</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(7.3)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000241504</td>\n",
2021-06-01 01:16:14 +02:00
" <td>31</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(7.7)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000338487</td>\n",
2021-06-01 01:16:14 +02:00
" <td>37</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(8.6)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000706756</td>\n",
2021-06-01 01:16:14 +02:00
" <td>53</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(9.0)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0000970184</td>\n",
2021-06-01 01:16:14 +02:00
" <td>39</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(9.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0001428651</td>\n",
2021-06-01 01:16:14 +02:00
" <td>44</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(10.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0003006361</td>\n",
2021-06-01 01:16:14 +02:00
" <td>42</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(10.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0003006361</td>\n",
2021-06-01 01:16:14 +02:00
" <td>36</td>\n",
" <td>32.501314</td>\n",
2021-06-01 00:47:01 +02:00
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(10.7)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0003471999</td>\n",
2021-06-01 01:16:14 +02:00
" <td>43</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(10.8)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0003728964</td>\n",
2021-06-01 01:16:14 +02:00
" <td>34</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(11.0)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0004296198</td>\n",
2021-06-01 01:16:14 +02:00
" <td>75</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(11.3)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0005296946</td>\n",
2021-06-01 01:16:14 +02:00
" <td>34</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(11.9)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0007965586</td>\n",
2021-06-01 00:47:01 +02:00
" <td>46</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(12.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0009715577</td>\n",
2021-06-01 01:16:14 +02:00
" <td>46</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(15.1)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0055032862</td>\n",
2021-06-01 01:16:14 +02:00
" <td>25</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(15.1)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0055032862</td>\n",
2021-06-01 01:16:14 +02:00
" <td>30</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(16.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0112700122</td>\n",
2021-06-01 01:16:14 +02:00
" <td>40</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(17.4)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0171422369</td>\n",
2021-06-01 01:16:14 +02:00
" <td>32</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(18.4)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0262993813</td>\n",
2021-06-01 00:47:01 +02:00
" <td>32</td>\n",
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(18.5)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0273891079</td>\n",
2021-06-01 01:16:14 +02:00
" <td>22</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(21.6)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0790709391</td>\n",
2021-06-01 01:16:14 +02:00
" <td>31</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(21.8)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0835583686</td>\n",
2021-06-01 01:16:14 +02:00
" <td>4</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(23.3)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.1201265071</td>\n",
2021-06-01 01:16:14 +02:00
" <td>29</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(28.6)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.2106810573</td>\n",
2021-06-01 01:16:14 +02:00
" <td>27</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(29.1)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.2096302812</td>\n",
2021-06-01 01:16:14 +02:00
" <td>34</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(34.1)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.1150475376</td>\n",
2021-06-01 01:16:14 +02:00
" <td>68</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(36.2)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0663633810</td>\n",
2021-06-01 01:16:14 +02:00
" <td>41</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
2021-06-01 01:16:14 +02:00
" <td>28.6</td>\n",
2021-06-01 00:47:01 +02:00
" <td>K(39.7)</td>\n",
2021-06-01 01:28:45 +02:00
" <td>0.0179240863</td>\n",
2021-06-01 01:16:14 +02:00
" <td>147</td>\n",
2021-06-01 00:47:01 +02:00
" <td></td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Input_x kernel_x weigth Y Y=w0*x0+w1*x1+...+w41*x41\n",
2021-06-01 01:28:45 +02:00
"0 28.6 K(2.0) 0.0000001506 11 \n",
"1 28.6 K(2.2) 0.0000001862 9 \n",
"2 28.6 K(2.2) 0.0000001862 14 \n",
"3 28.6 K(2.5) 0.0000002551 22 \n",
"4 28.6 K(3.4) 0.0000006423 17 \n",
"5 28.6 K(3.6) 0.0000007851 15 \n",
"6 28.6 K(4.0) 0.0000011675 16 \n",
"7 28.6 K(4.8) 0.0000025327 19 \n",
"8 28.6 K(5.0) 0.0000030615 32 \n",
"9 28.6 K(5.4) 0.0000044518 27 \n",
"10 28.6 K(5.6) 0.0000053554 23 \n",
"11 28.6 K(5.7) 0.0000058703 11 \n",
"12 28.6 K(6.2) 0.0000092341 29 \n",
"13 28.6 K(6.9) 0.0000171209 18 \n",
"14 28.6 K(7.2) 0.0000221736 29 \n",
"15 28.6 K(7.3) 0.0000241504 31 \n",
"16 28.6 K(7.7) 0.0000338487 37 \n",
"17 28.6 K(8.6) 0.0000706756 53 \n",
"18 28.6 K(9.0) 0.0000970184 39 \n",
"19 28.6 K(9.5) 0.0001428651 44 \n",
"20 28.6 K(10.5) 0.0003006361 42 \n",
"21 28.6 K(10.5) 0.0003006361 36 32.501314\n",
"22 28.6 K(10.7) 0.0003471999 43 \n",
"23 28.6 K(10.8) 0.0003728964 34 \n",
"24 28.6 K(11.0) 0.0004296198 75 \n",
"25 28.6 K(11.3) 0.0005296946 34 \n",
"26 28.6 K(11.9) 0.0007965586 46 \n",
"27 28.6 K(12.2) 0.0009715577 46 \n",
"28 28.6 K(15.1) 0.0055032862 25 \n",
"29 28.6 K(15.1) 0.0055032862 30 \n",
"30 28.6 K(16.5) 0.0112700122 40 \n",
"31 28.6 K(17.4) 0.0171422369 32 \n",
"32 28.6 K(18.4) 0.0262993813 32 \n",
"33 28.6 K(18.5) 0.0273891079 22 \n",
"34 28.6 K(21.6) 0.0790709391 31 \n",
"35 28.6 K(21.8) 0.0835583686 4 \n",
"36 28.6 K(23.3) 0.1201265071 29 \n",
"37 28.6 K(28.6) 0.2106810573 27 \n",
"38 28.6 K(29.1) 0.2096302812 34 \n",
"39 28.6 K(34.1) 0.1150475376 68 \n",
"40 28.6 K(36.2) 0.0663633810 41 \n",
"41 28.6 K(39.7) 0.0179240863 147 "
2021-06-01 00:47:01 +02:00
]
},
2021-06-01 01:16:14 +02:00
"execution_count": 6,
2021-06-01 00:47:01 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2021-06-01 01:28:45 +02:00
"bw_manual = 5\n",
"input_x = X[37]\n",
"kernel_x = X\n",
"weigths = KernelRegression.weights(bw_manual, input_x, X)\n",
2021-06-01 00:47:01 +02:00
"# Dataframe for a single observation point x_i. In the code x_i comes from new_x\n",
2021-06-01 01:16:14 +02:00
"data = {'Input_x': [input_x for x in kernel_x],\n",
2021-06-01 00:47:01 +02:00
" 'kernel_x': kernel_x,\n",
2021-06-01 01:16:14 +02:00
" 'weigth': weigths,\n",
2021-06-01 01:28:45 +02:00
" 'Y': Y,\n",
2021-06-01 00:47:01 +02:00
" 'Y=w0*x0+w1*x1+...+w41*x41': ''\n",
" }\n",
"single_pt_KE = pd.DataFrame(data=data)\n",
2021-06-01 01:28:45 +02:00
"single_pt_KE.at[len(Y)//2, 'Y=w0*x0+w1*x1+...+w41*x41'] = KernelRegression.single_y_pred_gauss(3, X[37], X, Y)\n",
2021-06-01 00:47:01 +02:00
"single_pt_KE['weigth'] = single_pt_KE['weigth'].map('{:,.10f}'.format)\n",
"single_pt_KE['kernel_x'] = single_pt_KE['kernel_x'].map('K({})'.format)\n",
"single_pt_KE"
]
},
{
"cell_type": "code",
"execution_count": 7,
2021-05-31 21:44:34 +02:00
"id": "0406c2c4",
2021-05-31 18:49:23 +02:00
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "x=%{x}<br>y=%{y}<extra></extra>",
"legendgroup": "",
"marker": {
"color": "#636efa",
"symbol": "circle"
},
"mode": "markers",
"name": "",
"orientation": "v",
"showlegend": false,
"type": "scatter",
"x": [
2,
2.2,
2.2,
2.5,
3.4,
3.6,
4,
4.8,
5,
5.4,
5.6,
5.7,
6.2,
6.9,
7.2,
7.3,
7.7,
8.6,
9,
9.5,
10.5,
10.5,
10.7,
10.8,
11,
11.3,
11.9,
12.2,
15.1,
15.1,
16.5,
17.4,
18.4,
18.5,
21.6,
21.8,
23.3,
28.6,
29.1,
34.1,
36.2,
39.7
],
"xaxis": "x",
"y": [
11,
2021-06-01 01:16:14 +02:00
9,
14,
2021-05-31 18:49:23 +02:00
22,
2021-06-01 01:16:14 +02:00
17,
15,
2021-05-31 18:49:23 +02:00
16,
2021-06-01 01:16:14 +02:00
19,
32,
2021-05-31 18:49:23 +02:00
27,
2021-06-01 01:16:14 +02:00
23,
11,
2021-05-31 18:49:23 +02:00
29,
2021-06-01 01:16:14 +02:00
18,
29,
31,
37,
53,
39,
44,
42,
36,
43,
34,
75,
34,
46,
46,
25,
2021-05-31 18:49:23 +02:00
30,
40,
32,
2021-06-01 01:16:14 +02:00
32,
2021-05-31 18:49:23 +02:00
22,
31,
2021-06-01 01:16:14 +02:00
4,
29,
2021-05-31 18:49:23 +02:00
27,
34,
2021-06-01 01:16:14 +02:00
68,
41,
147
2021-05-31 18:49:23 +02:00
],
"yaxis": "y"
},
{
"mode": "lines",
2021-05-31 21:44:34 +02:00
"name": "Gauss",
"type": "scatter",
"x": [
2,
2.2,
2.2,
2.5,
3.4,
3.6,
4,
4.8,
5,
5.4,
5.6,
5.7,
6.2,
6.9,
7.2,
7.3,
7.7,
8.6,
9,
9.5,
10.5,
10.5,
10.7,
10.8,
11,
11.3,
11.9,
12.2,
15.1,
15.1,
16.5,
17.4,
18.4,
18.5,
21.6,
21.8,
23.3,
28.6,
29.1,
34.1,
36.2,
39.7
],
"y": [
2021-06-01 01:28:45 +02:00
17.555205563509922,
17.734843463682793,
17.734843463682793,
18.176366652242898,
19.580841388863796,
19.84035782372782,
20.661171088236117,
22.532186287192758,
23.01010695460826,
23.92441595297218,
24.445451332794832,
24.73853395760963,
26.68692680288166,
29.84251316046013,
31.222859934057883,
31.605842609245123,
33.05127958899505,
36.1359944873751,
37.28208616780045,
38.58499145748456,
41.10240606850776,
41.10240606850776,
41.45712040143889,
41.525714807709875,
41.67692927789663,
41.903083135696434,
42.300849506181365,
42.30323115161558,
36.02633653997792,
36.02633653997792,
31.510438483886222,
29.409303882195445,
2021-06-01 16:30:04 +02:00
28.074219516984098,
2021-06-01 01:28:45 +02:00
27.955394461859985,
2021-06-01 16:30:04 +02:00
23.38428545354991,
2021-06-01 01:28:45 +02:00
23.17743153918791,
2021-06-01 16:30:04 +02:00
21.648262601291027,
30.482412060301506,
2021-06-01 01:28:45 +02:00
30.517587939698494,
55.80587848212328,
73.69506342132328,
111.19867549668874
2021-05-31 21:44:34 +02:00
]
},
{
"mode": "lines",
"name": "Epanechnikov",
2021-05-31 18:49:23 +02:00
"type": "scatter",
"x": [
2,
2.2,
2.2,
2.5,
3.4,
3.6,
4,
4.8,
5,
5.4,
5.6,
5.7,
6.2,
6.9,
7.2,
7.3,
7.7,
8.6,
9,
9.5,
10.5,
10.5,
10.7,
10.8,
11,
11.3,
11.9,
12.2,
15.1,
15.1,
16.5,
17.4,
18.4,
18.5,
21.6,
21.8,
23.3,
28.6,
29.1,
34.1,
36.2,
39.7
],
"y": [
2021-06-01 01:28:45 +02:00
24.053734059882288,
24.276509858788508,
24.276509858788508,
24.61702998330566,
25.681680046599226,
25.926362984048545,
2021-06-01 16:30:04 +02:00
26.4235668871939,
2021-06-01 01:28:45 +02:00
27.44464655254659,
27.704350480246756,
28.227529069515292,
28.490508958799865,
2021-06-01 16:30:04 +02:00
28.62223196129558,
2021-06-01 01:28:45 +02:00
29.281772246191295,
30.20079719855705,
2021-06-01 16:30:04 +02:00
30.590043277413265,
2021-06-01 01:28:45 +02:00
30.71885452244941,
31.228179944929696,
32.32627562117898,
32.78557805593901,
2021-06-01 16:30:04 +02:00
33.32775548623167,
2021-06-01 01:28:45 +02:00
34.28029136722303,
34.28029136722303,
34.44612286429198,
34.52562056417806,
34.67753283086536,
34.886973548993915,
35.235024626327515,
35.37138690162655,
35.24918242577492,
35.24918242577492,
34.27913887569741,
33.41792501130564,
32.327340899676955,
32.21403007187681,
29.025906386148797,
2021-06-01 16:30:04 +02:00
28.879485913370026,
2021-06-01 01:28:45 +02:00
28.20705059999523,
35.21022942157131,
2021-06-01 16:30:04 +02:00
36.78097788065531,
2021-06-01 01:28:45 +02:00
58.843114179798405,
69.8487439590774,
88.04892296264353
2021-05-31 18:49:23 +02:00
]
},
{
"mode": "lines",
"name": "Linear",
"type": "scatter",
"x": [
2,
2.2,
2.2,
2.5,
3.4,
3.6,
4,
4.8,
5,
5.4,
5.6,
5.7,
6.2,
6.9,
7.2,
7.3,
7.7,
8.6,
9,
9.5,
10.5,
10.5,
10.7,
10.8,
11,
11.3,
11.9,
12.2,
15.1,
15.1,
16.5,
17.4,
18.4,
18.5,
21.6,
21.8,
23.3,
28.6,
29.1,
34.1,
36.2,
39.7
],
"y": [
2021-06-01 16:30:04 +02:00
19.622069242587386,
19.88476044357217,
19.88476044357217,
20.278797245049343,
21.460907649480866,
21.72359885046565,
22.248981252435215,
23.299746056374342,
23.56243725735913,
24.087819659328694,
24.350510860313474,
24.481856460805865,
2021-06-01 01:16:14 +02:00
25.138584463267826,
2021-06-01 16:30:04 +02:00
26.058003666714562,
26.452040468191736,
26.583386068684128,
27.108768470653693,
28.290878875085216,
28.81626127705478,
2021-06-01 01:16:14 +02:00
29.47298927951674,
30.786445284440653,
30.786445284440653,
31.049136485425436,
2021-06-01 16:30:04 +02:00
31.180482085917827,
31.443173286902606,
2021-06-01 01:16:14 +02:00
31.837210088379784,
32.62528369133413,
33.0193204928113,
36.82834290709066,
36.82834290709066,
38.66718131398413,
39.84929171841566,
41.162747723339564,
41.29409332383196,
2021-06-01 16:30:04 +02:00
45.365806939096096,
2021-06-01 01:16:14 +02:00
45.62849814008088,
47.59868214746675,
54.55999897356349,
2021-06-01 16:30:04 +02:00
55.21672697602545,
61.78400700064502,
2021-06-01 01:16:14 +02:00
64.54226461098523,
2021-06-01 16:30:04 +02:00
69.13936062821894
2021-05-31 18:49:23 +02:00
]
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"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": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
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,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"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,
"#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,
"#f0f921"
]
],
"sequentialminus": [
[
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,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
},
"xaxis": {
"anchor": "y",
"domain": [
0,
1
],
"title": {
"text": "x"
}
},
"yaxis": {
"anchor": "x",
"domain": [
0,
1
],
"title": {
"text": "y"
}
}
}
},
"text/html": [
2021-06-01 16:30:04 +02:00
"<div> <div id=\"fc25753d-9b3a-47a0-9416-e9afdac806c8\" class=\"plotly-graph-div\" style=\"height:525px; width:100%;\"></div> <script type=\"text/javascript\"> require([\"plotly\"], function(Plotly) { window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById(\"fc25753d-9b3a-47a0-9416-e9afdac806c8\")) { Plotly.newPlot( \"fc25753d-9b3a-47a0-9416-e9afdac806c8\", [{\"hovertemplate\": \"x=%{x}<br>y=%{y}<extra></extra>\", \"legendgroup\": \"\", \"marker\": {\"color\": \"#636efa\", \"symbol\": \"circle\"}, \"mode\": \"markers\", \"name\": \"\", \"orientation\": \"v\", \"showlegend\": false, \"type\": \"scatter\", \"x\": [2.0, 2.2, 2.2, 2.5, 3.4, 3.6, 4.0, 4.8, 5.0, 5.4, 5.6, 5.7, 6.2, 6.9, 7.2, 7.3, 7.7, 8.6, 9.0, 9.5, 10.5, 10.5, 10.7, 10.8, 11.0, 11.3, 11.9, 12.2, 15.1, 15.1, 16.5, 17.4, 18.4, 18.5, 21.6, 21.8, 23.3, 28.6, 29.1, 34.1, 36.2, 39.7], \"xaxis\": \"x\", \"y\": [11, 9, 14, 22, 17, 15, 16, 19, 32, 27, 23, 11, 29, 18, 29, 31, 37, 53, 39, 44, 42, 36, 43, 34, 75, 34, 46, 46, 25, 30, 40, 32, 32, 22, 31, 4, 29, 27, 34, 68, 41, 147], \"yaxis\": \"y\"}, {\"mode\": \"lines\", \"name\": \"Gauss\", \"type\": \"scatter\", \"x\": [2.0, 2.2, 2.2, 2.5, 3.4, 3.6, 4.0, 4.8, 5.0, 5.4, 5.6, 5.7, 6.2, 6.9, 7.2, 7.3, 7.7, 8.6, 9.0, 9.5, 10.5, 10.5, 10.7, 10.8, 11.0, 11.3, 11.9, 12.2, 15.1, 15.1, 16.5, 17.4, 18.4, 18.5, 21.6, 21.8, 23.3, 28.6, 29.1, 34.1, 36.2, 39.7], \"y\": [17.555205563509922, 17.734843463682793, 17.734843463682793, 18.176366652242898, 19.580841388863796, 19.84035782372782, 20.661171088236117, 22.532186287192758, 23.01010695460826, 23.92441595297218, 24.445451332794832, 24.73853395760963, 26.68692680288166, 29.84251316046013, 31.222859934057883, 31.605842609245123, 33.05127958899505, 36.1359944873751, 37.28208616780045, 38.58499145748456, 41.10240606850776, 41.10240606850776, 41.45712040143889, 41.525714807709875, 41.67692927789663, 41.903083135696434, 42.300849506181365, 42.30323115161558, 36.02633653997792, 36.02633653997792, 31.510438483886222, 29.409303882195445, 28.074219516984098, 27.955394461859985, 23.38428545354991, 23.17743153918791, 21.648262601291027, 30.482412060301506, 30.517587939698494, 55.80587848212328, 73.69506342132328, 111.19867549668874]}, {\"mode\": \"lines\", \"name\": \"Epanechnikov\", \"type\": \"scatter\", \"x\": [2.0, 2.2, 2.2, 2.5, 3.4, 3.6, 4.0, 4.8, 5.0, 5.4, 5.6, 5.7, 6.2, 6.9, 7.2, 7.3, 7.7, 8.6, 9.0, 9.5, 10.5, 10.5, 10.7, 10.8, 11.0, 11.3, 11.9, 12.2, 15.1, 15.1, 16.5, 17.4, 18.4, 18.5, 21.6, 21.8, 23.3, 28.6, 29.1, 34.1, 36.2, 39.7], \"y\": [24.053734059882288, 24.276509858788508, 24.276509858788508, 24.61702998330566, 25.681680046599226, 25.926362984048545, 26.4235668871939, 27.44464655254659, 27.704350480246756, 28.227529069515292, 28.490508958799865, 28.62223196129558, 29.281772246191295, 30.20079719855705, 30.590043277413265, 30.71885452244941, 31.228179944929696, 32.32627562117898, 32.78557805593901, 33.32775548623167, 34.28029136722303, 34.28029136722303, 34.44612286429198, 34.52562056417806, 34.67753283086536, 34.886973548993915, 35.235024626327515, 35.37138690162655, 35.24918242577492, 35.24918242577492, 34.27913887569741, 33.41792501130564, 32.327340899676955, 32.21403007187681, 29.025906386148797, 28.879485913370026, 28.20705059999523, 35.21022942157131, 36.78097788065531, 58.843114179798405, 69.8487439590774, 88.04892296264353]}, {\"mode\": \"lines\", \"name\": \"Linear\", \"type\": \"scatter\", \"x\": [2.0, 2.2, 2.2, 2.5, 3.4, 3.6, 4.0, 4.8, 5.0, 5.4, 5.6, 5.7, 6.2, 6.9, 7.2, 7.3, 7.7, 8.6, 9.0, 9.5, 10.5, 10.5, 10.7, 10.8, 11.0, 11.3, 11.9, 12.2, 15.1, 15.1, 16.5, 17.4, 18.4, 18.5, 21.6, 21.8, 23.3, 28.6, 29.1, 34.1, 36.2, 39.7], \"y\": [19.622069242587386, 19.88476044357217, 19.88476044357217, 20.278797245049343, 21.460907649480866, 21.72359885046565, 22.248981252435215, 23.299746056374342, 23.56243725735913, 24.087819659328694, 24.350510860313474, 24.481856460805865, 25.1385844632
2021-05-31 18:49:23 +02:00
" \n",
2021-06-01 16:30:04 +02:00
"var gd = document.getElementById('fc25753d-9b3a-47a0-9416-e9afdac806c8');\n",
2021-05-31 18:49:23 +02:00
"var x = new MutationObserver(function (mutations, observer) {{\n",
" var display = window.getComputedStyle(gd).display;\n",
" if (!display || display === 'none') {{\n",
" console.log([gd, 'removed!']);\n",
" Plotly.purge(gd);\n",
" observer.disconnect();\n",
" }}\n",
"}});\n",
"\n",
"// Listen for the removal of the full notebook cells\n",
"var notebookContainer = gd.closest('#notebook-container');\n",
"if (notebookContainer) {{\n",
" x.observe(notebookContainer, {childList: true});\n",
"}}\n",
"\n",
"// Listen for the clearing of the current output cell\n",
"var outputEl = gd.closest('.output');\n",
"if (outputEl) {{\n",
" x.observe(outputEl, {childList: true});\n",
"}}\n",
"\n",
" }) }; }); </script> </div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.linear_model import LinearRegression\n",
"# linear regression\n",
2021-06-01 01:28:45 +02:00
"reg = LinearRegression().fit(X.reshape(-1, 1), Y.reshape(-1, 1))\n",
"Y_pred_linear = reg.predict(X.reshape(-1, 1))\n",
2021-05-31 18:49:23 +02:00
"\n",
"# kernel regression\n",
2021-06-01 01:28:45 +02:00
"Y_pred_gauss = KernelRegression.ker_reg(X, Y, bw_manual, 'gauss')\n",
"Y_pred_epanechnikov = KernelRegression.ker_reg(X, Y, bw_manual, 'epanechnikov')\n",
2021-05-31 18:49:23 +02:00
"\n",
2021-06-01 01:28:45 +02:00
"fig = px.scatter(x=X,y=Y)\n",
"fig.add_trace(go.Scatter(x=X, y=np.array(Y_pred_gauss), name='Gauss', mode='lines'))\n",
"fig.add_trace(go.Scatter(x=X, y=np.array(Y_pred_epanechnikov), name='Epanechnikov', mode='lines'))\n",
"fig.add_trace(go.Scatter(x=X, y=np.array(Y_pred_linear.flatten().tolist()), name='Linear', mode='lines'))"
2021-05-31 18:49:23 +02:00
]
2021-05-27 20:44:57 +02:00
}
],
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
2021-06-01 16:30:04 +02:00
"version": "3.8.8"
2021-05-27 20:44:57 +02:00
}
},
"nbformat": 4,
"nbformat_minor": 5
}