• mardania

Interactive Web Application: Well Log Prediction Using Various Machine Learning Algorithms

Maybe this is a common thought that after working with code scripts, you want to convert it to a shareable application with a graphical interface. I did not imagine how easy it can be for an unprofessional developer like me. Python is my preferred programming language.

Dashboard link:

Desktop Applications

In the initial steps, I learned that python scripts can be converted to GUI (Graphical User Interface) applications using some libraries like Tkinter or PyQt. Tkinter is an integral part of Python and you do not need to install it in your working environment. PyQt, on the other hand, is a python binding for Qt, which is a collection of C++ libraries and development tools that include platform-independent abstraction for GUI. To use the PyQt library, we need to install it first. To be comfortable with GUI application production, we need to understand object-oriented programming (OOP) and class elaboration. OOP is a type of structuring program that bundles required and related properties/behaviors into an object. Think of a class as a blueprint for creating objects (a particular data structure) to provide initial value for the state (attributes) and implementations of behavior (methods).

Do we still need to learn desktop GUI development?

This is a tough question to answer. There is still demand for GUI desktop applications, however, the software development market has been changed noticeably by emerging web and mobile applications. It depends on your situation and interest but as a geoscientist who has a passion for new IT developments, I would vote for web applications because I want to share them easily with users. On the other hand, by using cloud-based platforms, such as Azure (Microsoft) or AWS (Amazon), you will receive plenty of services that make your production and app deployment pleasurable such as database management or app scalability (though it requires subscription).

Web application development

By definition, a web app is an interactive computer program built with web technologies like HTML, which stores database and manipulate data by user(s) to perform tasks through the internet. One of the greatest examples of a web application is Google Docs that users can create, read, update and delete documents. To build a web app from scratch, we need to deal with the database, frontend, and backend steps and then have a host to deploy the web application.

To create a web app by python scripts, Django, a full-stack framework, or Flask, a micro lightweight web framework can be used. The former helps developers to build large and complex applications while the latter, Flask, is suitable for simple web applications.

For a Machine Learning interactive dashboard, do I have to learn Django or Flask?

Not actually, thanks to OOP, there are several service providers that eliminated these steps for us. One great example is stremlit, which is totally free. You can turn data scripts into a shareable web application in python. No front-end experience is required. It is completely compatible with major libraries such as scikit-learn, Tensorflow, Numpy, matplotlib …

I used streamlit and its library to build my app but deployed it on heroku.

Web App: Well log prediction using various machine learning algorithms

Motivation: well logs are a critical measurement of the physical properties of rock medium. Commonly, some logs are missing. In this example, we used Force 2020 well log dataset and tried to predict the Neutron Porosity log (NPHI). The predictors (features) are GR, RHOB, DTC, and SP logs and the target log is NPHI. We have chosen a smaller dataset to see the modeling results faster. We selected 3 wells (two for train and test, one blind (not involved in the training process)).

Remember, as well logs are a continuous variable, this is a regression problem and we should choose regression models. Normally, model performance for test datasets is better than those datasets that have not been seen by the model (blind).

Seven important algorithms have been selected including, AdaBoost, Multi-Layer Perceptron (Neural Network), K Nearest Neighbour, Support Vector Machine, Bayesian Ridge Regression, Decision tree, and Stochastic Gradient Descent regressor. If you want to study the logic behind these algorithms, you may look at scikit-learn documentation. The most important Hyper-parameters of these algorithms have been selected to be adjusted by the user. You can play around with parameters to see the prediction results.

We provided 4 evaluation metrics for model performances, 1 quantitative and 3 qualitative.

R2 Score is a square of the correlation. It ranges between 0 and 1. We also plotted the true NPHI log from the blind well which is over-laid by predicted NPHI resulted from the model. The distribution of NPHI porosity for true and predicted data is plotted on the up-right. A scatter plot of True and predicted NPHI is also plotted with a correlation fit line on it. If you want to study detail explanation of Machine Learning with a geoscience example, facies classification, you find this series in the blog practical.

In this post, I did not want to elaborate on this app scripting or the result of model evaluation in detail. I intended to show that object-oriented programming and cloud hosting provided a facility that everyone (with some basic knowledge of programming), can develop a web application and share it with others. Leave us a comment with any questions or concerns.

1,668 views0 comments