diff --git a/Теория проверки гипотез/Hypothesis-test-demo.ipynb b/Теория проверки гипотез/Hypothesis-test-demo.ipynb new file mode 100644 index 0000000..20cbe03 --- /dev/null +++ b/Теория проверки гипотез/Hypothesis-test-demo.ipynb @@ -0,0 +1,726 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "Rjpi65i51X4wmkUJdDMhaS", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
\n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "@file:Repository(\"https://repo.kotlin.link\")\n", + "@file:DependsOn(\"space.kscience:plotlykt-jupyter:0.5.0\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "QzMxgnnJPTHKNoOI418j2g", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
Plotly notebook integration switch into the legacy mode.
\n" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Plotly.jupyter.notebook()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "PjQ7NkcPIyTyKs8StevhmN", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "import kotlin.random.Random\n", + "\n", + "data class Point(val x: Double, val y: Double){\n", + " fun distanceTo(other: Point) = sqrt((x-other.x).pow(2) + (y-other.y).pow(2))\n", + " \n", + " companion object{\n", + " val ZERO = Point(0.0, 0.0)\n", + " }\n", + "}\n", + "\n", + "\n", + "fun interface PointSampler{\n", + " fun sample(numPoints: Int, generator: Random): List\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "n0doaXXWBLzfmSnHoBaKQC", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "class RectanglePointSampler(\n", + " val xRange: ClosedFloatingPointRange, \n", + " val yRange: ClosedFloatingPointRange\n", + "): PointSampler{\n", + " override fun sample(numPoints: Int, generator: Random): List = List(numPoints){\n", + " Point(\n", + " generator.nextDouble(xRange.start, xRange.endInclusive),\n", + " generator.nextDouble(yRange.start, yRange.endInclusive)\n", + " )\n", + " }\n", + "}\n", + "\n", + "class CirclePointSampler(\n", + " val r: Double,\n", + ") : PointSampler {\n", + " override fun sample(numPoints: Int, generator: Random): List = List(numPoints) {\n", + " var res: Point? = null\n", + " do {\n", + " val newPoint = Point(\n", + " generator.nextDouble(-r, r),\n", + " generator.nextDouble(-r, r)\n", + " )\n", + " if (newPoint.distanceTo(Point(0.0, 0.0)) <= r) {\n", + " res = newPoint\n", + " }\n", + " } while (res == null)\n", + "\n", + " res\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "Lez1mX3LFYLUs7ZktJbEze", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "fun PointSampler.showPoints(numPoints: Int, generator: Random): Plot = Plotly.plot{\n", + " val points = sample(numPoints, generator)\n", + " scatter { \n", + " x.numbers = points.map { it.x }\n", + " y.numbers = points.map { it.y }\n", + " mode = ScatterMode.markers\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "YT3kegGKf8mXuPJ3lt7hdC", + "type": "CODE" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " Plotly.kt\n", + " \n", + " \n", + " \n", + "
\n", + " \n", + "
\n", + " \n", + "\n" + ] + }, + "execution_count": 6, + "metadata": { + "text/html": { + "isolated": true + } + }, + "output_type": "execute_result" + } + ], + "source": [ + "RectanglePointSampler(-1.0..1.0, -1.0..1.0).showPoints(2000, Random)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "pwz4QocHd7dmOGm9L7cEc5", + "type": "CODE" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " Plotly.kt\n", + " \n", + " \n", + " \n", + "
\n", + " \n", + "
\n", + " \n", + "\n" + ] + }, + "execution_count": 7, + "metadata": { + "text/html": { + "isolated": true + } + }, + "output_type": "execute_result" + } + ], + "source": [ + "CirclePointSampler(1.0).showPoints(2000, Random)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "Tcls1BegHuuMvNgKzRh6sg", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "fun interface PointComparisonStatistic{\n", + " fun test(lPoints: List, rPoints: List): Double\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "nqvsllZIiL4APzUOC5gehm", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "data class SamplePair(val lSample: List, val rSample: List)\n", + "\n", + "class HypothesisTester(\n", + " val generator: Random, \n", + " val lSampler: PointSampler, \n", + " val rSampler: PointSampler,\n", + " val statistic: PointComparisonStatistic,\n", + " val numPoints: Int = 200\n", + "){\n", + " fun generate(numSamples: Int): List = List(numSamples){\n", + " val l = lSampler.sample(numPoints, generator)\n", + " var r = rSampler.sample(numPoints, generator)\n", + " SamplePair(l,r)\n", + " }\n", + "\n", + " fun testAll(numSamples: Int): List = generate(numSamples).map{ \n", + " statistic.test(it.lSample, it.rSample) \n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [], + "source": [ + "val nozikStatistic = PointComparisonStatistic{ lPoints: List, rPoints: List ->\n", + " Random.nextDouble() - Random.nextDouble()\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "PWwxzAec2DGNV0Haailwyi", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "val svetlichnyiStatistic = PointComparisonStatistic{ lPoints: List, rPoints: List ->\n", + " lPoints.map { lPoint ->\n", + " rPoints.minOf { rPoint -> \n", + " lPoint.distanceTo(rPoint) \n", + " }\n", + " }.average()\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "pVFRwvJhrD9QKH2dpDk3Zo", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "val tihomirovaStatistic = PointComparisonStatistic{ lPoints: List, rPoints: List ->\n", + " fun List.minDistance(): Double = map { point1 ->\n", + " minOf { point2 -> \n", + " if(point1===point2){\n", + " Double.MAX_VALUE\n", + " } else {\n", + " point2.distanceTo(point1)\n", + " }\n", + " }\n", + " }.average()\n", + "\n", + " lPoints.minDistance() - rPoints.minDistance()\n", + "\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "val zelenkinStatistic = PointComparisonStatistic{ lPoints: List, rPoints: List ->\n", + " fun List.radius() = max( maxOf{it.x}, maxOf{it.y} )\n", + " \n", + " fun List.pointsInCircle(): Int{\n", + " val radius = radius()\n", + " return count{it.distanceTo(Point.ZERO) <= radius}\n", + " }\n", + "\n", + " (lPoints.pointsInCircle() - rPoints.pointsInCircle()).toDouble()\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "HmSMmqRRX1txxfU0KqDhAY", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " Plotly.kt\n", + " \n", + " \n", + " \n", + "
\n", + " \n", + "
\n", + " \n", + "\n" + ] + }, + "execution_count": 26, + "metadata": { + "text/html": { + "isolated": true + } + }, + "output_type": "execute_result" + } + ], + "source": [ + "val squareSampler = RectanglePointSampler(-1.0..1.0, -1.0..1.0)\n", + "val circleSampler = CirclePointSampler(1.0)\n", + "\n", + "val numPoints = 200\n", + "val numSamples = 5000\n", + "val statistic: PointComparisonStatistic = zelenkinStatistic\n", + "\n", + "val h0 = HypothesisTester(Random(1234), squareSampler, squareSampler, statistic, numPoints)\n", + "val h1 = HypothesisTester(Random(1234), squareSampler, circleSampler, statistic, numPoints)\n", + "Plotly.plot {\n", + " histogram {\n", + " name = \"h0\"\n", + " x.numbers = h0.testAll(numSamples)\n", + " }\n", + " histogram {\n", + " name = \"h1\"\n", + " x.numbers = h1.testAll(numSamples)\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "mydQCeC7dp7J9ErZyKsNNl", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "fun interface PointSetStatistic{\n", + " fun compute(points: List): Double\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "Lj5vOpsbMjYDZ4snIvASYl", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "fun PointSetStatistic.sample(\n", + " sampler: PointSampler, \n", + " numSamples: Int, \n", + " numPoints: Int, \n", + " generator: Random = Random\n", + "): List = (0 until numSamples).map {\n", + " sampler.sample(numPoints, generator)\n", + "}.map { compute(it) }" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "mwvWmsV1UXJOZTw6ruoQWT", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "val zero = Point(0.0, 0.0)\n", + "\n", + "fun sosninStstictic(r: Double) = PointSetStatistic{ points ->\n", + " points.count { it.distanceTo(zero) >= r }.toDouble()\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "1Kupd5kTvLCaV6ApQAtcyR", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " \n", + " Plotly.kt\n", + " \n", + " \n", + " \n", + "
\n", + " \n", + "
\n", + " \n", + "\n" + ] + }, + "execution_count": 30, + "metadata": { + "text/html": { + "isolated": true + } + }, + "output_type": "execute_result" + } + ], + "source": [ + "Plotly.plot {\n", + " histogram {\n", + " name = \"circle 1.0\"\n", + " x.numbers = sosninStstictic(1.0).sample(circleSampler, 1000, 200)\n", + " }\n", + " histogram {\n", + " name = \"circle 0.8\"\n", + " x.numbers = sosninStstictic(0.8).sample(circleSampler, 1000, 200)\n", + " }\n", + " histogram {\n", + " name = \"square 1.0\"\n", + " x.numbers = sosninStstictic(1.0).sample(squareSampler, 1000, 200)\n", + " }\n", + " histogram {\n", + " name = \"square 0.8\"\n", + " x.numbers = sosninStstictic(0.8).sample(squareSampler, 1000, 200)\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "zh16VG4Q5PXopn2I83BFg6", + "type": "CODE" + } + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "datalore": { + "base_environment": "default", + "computation_mode": "JUPYTER", + "package_manager": "pip", + "packages": [], + "report_link": "https://datalore.jetbrains.com/report/ptQDfQAcrjNxzIO0AEqovZ/KHxo8B64QfRV9FrNzSvPIA", + "report_row_ids": [], + "version": 3 + }, + "kernelspec": { + "display_name": "Kotlin", + "language": "kotlin", + "name": "kotlin" + }, + "language_info": { + "codemirror_mode": "text/x-kotlin", + "file_extension": ".kt", + "mimetype": "text/x-kotlin", + "name": "kotlin", + "nbconvert_exporter": "", + "pygments_lexer": "kotlin", + "version": "1.9.23" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/Теория проверки гипотез/Naive classifier.ipynb b/Теория проверки гипотез/Naive classifier.ipynb new file mode 100644 index 0000000..f6eb586 --- /dev/null +++ b/Теория проверки гипотез/Naive classifier.ipynb @@ -0,0 +1,617 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "lQbSB87rNAn9lV6poArVWW", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
\n", + " " + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%use kmath\n", + "%use plotly(0.5.0)\n", + "@file:DependsOn(\"org.apache.commons:commons-math3:3.6.1\")" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "0UP158hfccGgjQtHz0wAi6", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "//Plotly.jupyter.notebook()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "Zhgz1Ui91PWz0meJiQpHol", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "class XYValues(val xValues: DoubleArray, val yValues: DoubleArray) {\n", + " init {\n", + " require(xValues.size == yValues.size)\n", + " }\n", + "}\n", + "\n", + "fun interface XYStatistic {\n", + " operator fun invoke(values: XYValues): Double\n", + "}\n", + "\n", + "fun generateParabola(xValues: DoubleArray, a: Double, b: Double, c: Double): XYValues {\n", + " val yValues = xValues.map { x -> a * x * x + b * x + c }.toDoubleArray()\n", + " return XYValues(xValues, yValues)\n", + "}\n", + "\n", + "fun generateHyperbole(xValues: DoubleArray, gamma: Double, x0: Double, y0: Double): XYValues {\n", + " val yValues = xValues.map { x -> y0 + gamma / (x - x0) }.toDoubleArray()\n", + " return XYValues(xValues, yValues)\n", + "}\n", + "\n", + "class ConvolutionalXYStatistic(val weights: DoubleArray) : XYStatistic {\n", + " override fun invoke(values: XYValues): Double {\n", + " require(weights.size == values.yValues.size)\n", + " val norm = values.yValues.sum()\n", + " return values.yValues.zip(weights) { value, weight -> value * weight }.sum()/norm\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "ZE2atNvFzQsCvpAF8KK4ch", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + "
\n", + "
\n" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "val xValues = (1.0..10.0).step(1.0).toDoubleArray()\n", + "\n", + "val xy = generateHyperbole(xValues, 1.0, 0.0, 0.0)\n", + "\n", + "Plotly.plot {\n", + " scatter {\n", + " this.x.doubles = xValues\n", + " this.y.doubles = xy.yValues\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "EA5HaydTddRKYrtAUwd29h", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "0.05690285869123425" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "val statistic = ConvolutionalXYStatistic(DoubleArray(xValues.size){if(it == 5) 1.0 else 0.0})\n", + "statistic(xy)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "t5t6IYmD7Q1ykeo9uijFfQ", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "import kotlin.random.Random\n", + "\n", + "val random = Random(1288)\n", + "\n", + "val parabolae = buildList{\n", + " repeat(500){\n", + " add(\n", + " generateParabola(\n", + " xValues, \n", + " random.nextDouble(), \n", + " random.nextDouble(), \n", + " random.nextDouble()\n", + " )\n", + " )\n", + " }\n", + "}\n", + "\n", + "val hyperbolae: List = buildList{\n", + " repeat(500){\n", + " add(\n", + " generateHyperbole(\n", + " xValues, \n", + " random.nextDouble()*10, \n", + " random.nextDouble(), \n", + " random.nextDouble()\n", + " )\n", + " )\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "oXB8lmju7YVYjMRXITKnhO", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + "
\n", + "
\n" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Plotly.plot { \n", + " scatter { \n", + " x.doubles = xValues\n", + " y.doubles = parabolae[257].yValues\n", + " }\n", + " scatter { \n", + " x.doubles = xValues\n", + " y.doubles = hyperbolae[252].yValues\n", + " }\n", + " }" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "8EIIecUZrt2NNrOkhxG5P0", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + "
\n", + "
\n" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Plotly.plot { \n", + " histogram { \n", + " name = \"parabolae\"\n", + " x.numbers = parabolae.map { statistic(it) }\n", + " }\n", + " histogram { \n", + " name = \"hyperbolae\"\n", + " x.numbers = hyperbolae.map { statistic(it) }\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "h7UmglJW5zXkAfKHK40oIL", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "val lossFunction: (XYStatistic) -> Double = { statistic ->\n", + " - abs(parabolae.sumOf { statistic(it) } - hyperbolae.sumOf { statistic(it) })\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "VpQCNmHqHGWNEWDU21jh1D", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "import org.apache.commons.math3.optimization.*\n", + "import org.apache.commons.math3.analysis.*\n", + "import org.apache.commons.math3.optimization.direct.*\n", + "\n", + "val cmFunction = object: MultivariateFunction{\n", + " override fun value(point: DoubleArray) = lossFunction(ConvolutionalXYStatistic(point))\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "0EG3K4aCUciMlgGQKPvJ57", + "type": "CODE" + } + }, + "outputs": [], + "source": [ + "val optimizer = BOBYQAOptimizer(20)\n", + "\n", + "val result = optimizer.optimize(1000, cmFunction, GoalType.MINIMIZE, xValues)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "LelUlY0ZSlJEO9yC6SLk5B", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[-1.357757502856414E8, -2.0157729926862407E7, -1.003627060413469E7, -3516890.1555952034, 2318972.567610743, 8257264.5552848, 1.4601023119437138E7, 2.149227167045051E7, 2.9007620324898317E7, -1.740750223163073E7]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "result.point" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "AuFOq5t9KpOIkGrOLsVXNf", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + "
\n", + "
\n" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Plotly.plot { \n", + " scatter { \n", + " y.doubles = result.point\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "zvmq42DRdM5mZ3SpzviHwI", + "type": "CODE" + } + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + "
\n", + "
\n" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "val resultStatistic = ConvolutionalXYStatistic(result.point)\n", + "Plotly.plot { \n", + " histogram { \n", + " name = \"parabolae\"\n", + " x.numbers = parabolae.map { resultStatistic(it) }\n", + " }\n", + " histogram { \n", + " name = \"hyperbolae\"\n", + " x.numbers = hyperbolae.map { resultStatistic(it) }\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "datalore": { + "hide_input_from_viewers": true, + "hide_output_from_viewers": true, + "node_id": "1lBar7ejuP92idI3yiquIG", + "type": "CODE" + } + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "datalore": { + "base_environment": "default", + "computation_mode": "JUPYTER", + "package_manager": "pip", + "packages": [], + "report_row_ids": [], + "version": 3 + }, + "kernelspec": { + "display_name": "Kotlin", + "language": "kotlin", + "name": "kotlin" + }, + "language_info": { + "codemirror_mode": "text/x-kotlin", + "file_extension": ".kt", + "mimetype": "text/x-kotlin", + "name": "kotlin", + "nbconvert_exporter": "", + "pygments_lexer": "kotlin", + "version": "1.9.23" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} diff --git a/notebooks/python/hypotesis.ipynb b/Теория проверки гипотез/hypotesis.ipynb similarity index 100% rename from notebooks/python/hypotesis.ipynb rename to Теория проверки гипотез/hypotesis.ipynb