You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NLDF/Readme.md
+64-62Lines changed: 64 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,11 @@
9
9
10
10
### NAG Library Install
11
11
12
-
To run this example, you will need to install the NAG Library (Mark 28.5 or newer) and a license key. You will also need the NAG Library for Java wrappers. You can find the software, wrappers, and request a license key from our website here: [Getting Started with NAG Library](https://www.nag.com/content/getting-started-nag-library)
12
+
To run this example, you will need to install the NAG Library (Mark 28.5 or newer) and a license key. You will also need the NAG Library for Java wrappers. You can find the software, wrappers, and request a license key from our website here: [Getting Started with NAG Library](https://www.nag.com/content/getting-started-nag-library?lang=jv)
13
13
14
14
### Using These Example Files
15
15
16
-
This directory contains a Java source code and a couple images files to help illustrate this example. With NAG Library and wrappers properly installed, the Java file can be compiled and run as it is to produce a data set and execute all the example scenarios described below.
16
+
This directory contains the [Java source code](./GenDFEx.java) and a couple images files to help illustrate this example. With NAG Library and wrappers properly installed, the Java file can be compiled and run as it is to produce a data set and execute all the example scenarios described below.
@@ -190,7 +190,7 @@ to see what this outlier does to the minimum.
190
190
For this Java example, we set up a function to reset $$x$$ variable to the starting point, since it gets passed to the solver and returns the solution.
191
191
192
192
```java
193
-
privatestaticdouble[] init_x() {
193
+
publicstaticdouble[] init_x() {
194
194
double [] x =newdouble [] {2.1,1.4};
195
195
return x;
196
196
}
@@ -269,7 +269,7 @@ To illustrate this, here’s a new dataset which we will try to fit with the sam
We will fit this data set using 3 different loss functions with the same model $$\varphi(t;x)$$ each time and discuss the results under the plots all at once below.
289
+
We will fit this data set using 3 different loss functions with the same model $$\varphi(t;x)$$ each time and discuss the results under the plots all at once below. And we'll lastly clear the handle completely.
290
290
291
291
```java
292
292
ifail =0;
@@ -306,6 +306,8 @@ x = init_x();
306
306
e04zm.eval(handle, "NLDF Loss Function Type = ATAN", ifail);
The fitted model and corresponding contour plot for the $$\arctan$$ case are in the middle. Here, there are eight local minima in the contour plot for $$\arctan$$ loss, with seven of them being substantially worse solutions than the global minimum, and it is one of these we’ve converged to. Therefore, in this case the selection of initial estimation of the parameters is much more important.
328
330
329
331
The model fitted with $$l_1$$-norm loss and the corresponding contour plot are in the right column. Looking at the contour plot, there are still a few local minima that do not correspond to the optimal solution, but the starting point of $$x = (2.1,1.4)$$ still converges to the global minimum, which lies at
330
-
$$x = (5,1)$$, meaning the part of the dataset generated from $$\sin(t)$$ is effectively being ignoring. From the plots of the loss functions, we can see that $$l_1$$-norm loss is more robust than $$l_2$$-norm loss but less so than $$\arctan$$ loss.
332
+
$$x = (5,1)$$, meaning the part of the dataset generated from $$\sin(t)$$ is effectively being ignored. From the plots of the loss functions, we can see that $$l_1$$-norm loss is more robust than $$l_2$$-norm loss but less so than $$\arctan$$ loss.
331
333
332
334
So, what has happened in each case is: using $$l_2$$-norm loss, we move to the global minimum which is affected by the whole dataset. Using $$l_1$$-norm loss, we move to the global minimum which fits most of the data very well and ignores a small portion, treating them as outliers. Using $$\arctan$$ loss we move to a local minimum which ignores a large portion of the data (treating them as outliers) and fits a small amount of data very well.
0 commit comments