NMFk example: Mapping variables¶

A problem demonstrating how NMFk can be applied to learn mapping between variables.

The test problem is related to predicting pressure transients observed in wells based on various attributes (e.g., well-logs, fracking stages, proppant mass, etc.) associated with the well construction.

The machine-lerning problem described here relates to clasical history matching problems.

If NMFk is not installed, first execute import Pkg; Pkg.add("NMFk"); Pkg.add("Mads").

We start by loading the necessary Julia modules:

In [1]:

Unable to load WebIO. Please make sure WebIO works for your Jupyter client. For troubleshooting, please see the WebIO/IJulia documentation.

┌ Info: Installing pyqt package to avoid buggy tkagg backend.
â”” @ PyPlot /Users/vvv/.julia/packages/PyPlot/XHEG0/src/init.jl:118
In [2]:
In [3]:

Load test matrices A, B, X, Y and Z that will be applied for the ML analyses presented below:

In [5]:

A: pressure transients over time observed in a group of 5 wells

B: pressure transients over time observed in a group of 4 wells

X: 4 attributes representing well properties of the group of 4 wells

Y: 4 attributes representing well properties of the group of 5 wells

Z: 4 attributes representing well properties of a new well which does not have any transient production data observed yet

Pressure matrix A is associated with attribute matrix Y.

Pressure matrix B is associated with attribute matrix X.

Pressure transients over time observed in the group of 5 wells (matrix A) are:

In [6]:

Pressure transients over time observed in the group of 4 wells (matrix B) are:

In [7]:

Well attributes for the group of 5 wells (matrix Y) are:

In [27]:
Out[27]:
W1 W2 W3 W4 W5 1.0 0.5 0.0 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? Attribute 1 Attribute 2 Attribute 3 Attribute 4 Attribute matrix Y (Well Group A)

Well attributes for the group of 4 wells (matrix X) are:

In [28]:
Out[28]:
W1 W2 W3 W4 1.0 0.5 0.0 h,j,k,l,arrows,drag to pan i,o,+,-,scroll,shift-drag to zoom r,dbl-click to reset c for coordinates ? for help ? Attribute 1 Attribute 2 Attribute 3 Attribute 4 Attribute matrix X (Well Group B)

We learn how the well attributes associated with the 2 well groups are related.

We achieve this by discovering how the X and Y matrices are mapped.

After that we can apply the discovered mapping betweent the X and Y matrices (i.e., well attributes) to predict the transients.

The ML analyses is performed as follows:

In [10]:
┌ Info: Mapping matrix size: 4 x 5
â”” @ NMFk /Users/vvv/.julia/dev/NMFk/src/NMFkMapping.jl:51

The extracted mapping betweenn the X and Y matrices is encoded in H.

We use now the mapping H and known transients of wells in group A (matrix A) to predict transients of the well in group B.

In this case, we assume that none of the transinets of well in group are known; this is completely blind prediction.

The prediction error is:

In [11]:
Out[11]:
1.032261490452482

Blind predictions of the transients for the 5 wells (Group B) based on the transinets of the 4 wells (Group A) are:

In [14]:

Blind predictions of the transients for the 5 wells (dashed lines) are compared against the true values (solid lines):

In [18]: