Exxo
Exxo

Reputation: 21

Predicting Lagging Parameters

Hello Dear Stackoverflow users, I just started using Python, would love to learn from you!

There are 2 sets of data for the same variables in oil and gas industry. First set of data is measured instantly on surface and a little bit off the actual values. Second set is lagging (up to 20 minutes lag), but accurate since it's measured deep in the subsurface.

How can I predict ahead the second set of data by using the first set? For example, I want to train the model on first 200 data points, and then use the next 200 data points to predict lagging data. However, the following code gives me pretty wrong values. What could be the reason?

import pandas as pd
from sklearn.ensemble import RandomForestRegressor

sf=pd.read_csv("/Users/straminal/Desktop/DR/SF.csv", names=.['a','b','c','d','e','f','g','h'])
dh=pd.read_csv("/Users/straminal/Desktop/DR/DH.csv", names=['a','b','c','d','e'])

Surface1=sf.iloc[0:200,1]
Downhole1=dh.iloc[0:200,1]
Surface2=sf.iloc[200:400,1]

X1=[Surface1]
Y1=[Downhole1]
X2=[Surface2]
clf = RandomForestRegressor(n_estimators=100)
clf.fit(X1, Y1)

Downhole2 = clf.predict(X2)
print (Downhole2)

Thank you.

Upvotes: 2

Views: 135

Answers (1)

Yiğit Pamuk
Yiğit Pamuk

Reputation: 71

I think you can't always predict with 100% accuracy. There will be always residuals but if you use a good model the long term sum of the residuals should be zero.

I am not sure RandomForest is the best way to do the job.

Check out kalman filters.

https://scipy-cookbook.readthedocs.io/items/KalmanFiltering.html

The chart: Kalman filtering

The noisy measurement in the chart is surface and the actual measurement is down hole.

Also, this link provides a really good explanation.

https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

from wiki:

Kalman filters have been vital in the implementation of the navigation systems of U.S. Navy nuclear ballistic missile submarines, and in the guidance and navigation systems of cruise missiles such as the U.S. Navy's Tomahawk missile and the U.S. Air Force's Air Launched Cruise Missile. They are also used in the guidance and navigation systems of reusable launch vehicles and the attitude control and navigation systems of spacecraft which dock at the International Space Station.[7]

Upvotes: 1

Related Questions