You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2019/07/18 01:37:40 UTC

[lucene-solr] branch SOLR-13105-visual updated: SOLR-13105: Start interpolation viz

This is an automated email from the ASF dual-hosted git repository.

jbernste pushed a commit to branch SOLR-13105-visual
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/SOLR-13105-visual by this push:
     new 34701a1  SOLR-13105: Start interpolation viz
34701a1 is described below

commit 34701a18466fd73d9d4b1f17a562bcb6d9abe5e9
Author: Joel Bernstein <jb...@apache.org>
AuthorDate: Wed Jul 17 21:37:04 2019 -0400

    SOLR-13105: Start interpolation viz
---
 .../src/images/math-expressions/interpolate1.png   | Bin 0 -> 235912 bytes
 solr/solr-ref-guide/src/numerical-analysis.adoc    |  76 ++++-----------------
 2 files changed, 15 insertions(+), 61 deletions(-)

diff --git a/solr/solr-ref-guide/src/images/math-expressions/interpolate1.png b/solr/solr-ref-guide/src/images/math-expressions/interpolate1.png
new file mode 100644
index 0000000..40910f6
Binary files /dev/null and b/solr/solr-ref-guide/src/images/math-expressions/interpolate1.png differ
diff --git a/solr/solr-ref-guide/src/numerical-analysis.adoc b/solr/solr-ref-guide/src/numerical-analysis.adoc
index b4e3584..aa3889a 100644
--- a/solr/solr-ref-guide/src/numerical-analysis.adoc
+++ b/solr/solr-ref-guide/src/numerical-analysis.adoc
@@ -44,73 +44,27 @@ and form a smooth curve between control points.
 * `loess`: Loess interpolation first performs a non-linear local regression to smooth the original
 control points. Then a spline is used to interpolate the smoothed control points.
 
-=== Upsampling
+=== Zoom
 
-Interpolation can be used to increase the sampling rate along a curve. One example
-of this would be to take a time series with samples every minute and create a data set with
-samples every second. In order to do this the data points between the minutes must be created.
+One way to better understand interpolation is to zoom into one section of a larger curve. Using
+interpolation we can zoom in by sampling a curve between a specific *x* axis range.
 
-The `predict` function can be used to predict values anywhere within the bounds of the interpolation
-range.  The example below shows a very simple example of upsampling.
+The visualization below illustrates how this works.
 
-[source,text]
-----
-let(x=array(0, 2,  4,  6,  8,   10, 12,  14, 16, 18, 20),  <1>
-    y=array(5, 10, 60, 190, 100, 130, 100, 20, 30, 10, 5),  <2>
-    l=lerp(x, y),  <3>
-    u=array(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20),  <4>
-    p=predict(l, u))  <5>
-----
+image::images/math-expressions/interpolate1.png[]
 
-<1> In the example linear interpolation is performed on the arrays in variables *`x`* and *`y`*. The *`x`* variable,
-which is the x-axis, is a sequence from 0 to 20 with a stride of 2.
-<2> The *`y`* variable defines the curve along the x-axis.
-<3> The `lerp` function performs the interpolation and returns the interpolation model.
-<4> The `u` value is an array from 0 to 20 with a stride of 1. This fills in the gaps of the original x axis.
-The `predict` function then uses the interpolation function in variable *`l`* to predict values for
-every point in the array assigned to variable *`u`*.
-<5> The variable *`p`* is the array of predictions, which is the upsampled set of *`y`* values.
+The visualization above first creates two arrays with *x* and *y* axis points. Then the `akima`, `spline` and `lerp`
+functions are applied to the vectors to create three interpolation functions.
+
+Then 500 hundred random samples are drawn from a uniform distribution between 0 and 3. These are
+the new *x* axis points. Then the `predict` function is used to predict *y* axis points for
+the new *x* axis, for all three interpolation functions. Finally all three prediction vectors
+are plotted with the same zoomed *x* axis points.
+
+The red line is the `lerp` interpolation, the blue line is the `akima` and the purple line is
+the `spline` interpolation.
 
-When this expression is sent to the `/stream` handler it responds with:
 
-[source,json]
-----
-{
-  "result-set": {
-    "docs": [
-      {
-        "g": [
-          5,
-          7.5,
-          10,
-          35,
-          60,
-          125,
-          190,
-          145,
-          100,
-          115,
-          130,
-          115,
-          100,
-          60,
-          20,
-          25,
-          30,
-          20,
-          10,
-          7.5,
-          5
-        ]
-      },
-      {
-        "EOF": true,
-        "RESPONSE_TIME": 0
-      }
-    ]
-  }
-}
-----
 
 === Smoothing Interpolation