Stop, meta time


In [11]:
import pandas as pd
from keras.utils import np_utils
import numpy as np

In [8]:
houmath = pd.read_csv("../HouMath/Prediction6.csv", delimiter=",")
houmath_f1 = 0.63
houmath_facies = np_utils.to_categorical(houmath["Facies"]-1, nb_classes=9)


ar4 = pd.read_csv("../ar4/ar4_predicted_facies_submission002.csv", delimiter=",")
ar4_f1 = 0.606
ar4_facies = np_utils.to_categorical(ar4["Facies"]-1, nb_classes=9)

bestagini = pd.read_csv("../ispl/well_data_with_facies_try02.csv", delimiter=",")
bestagini_f1 = 0.604
bestagini_facies = np_utils.to_categorical(bestagini["Facies"]-1, nb_classes=9)

birdteam =  pd.read_csv("../Bird_Team/XmasPreds_4.csv", delimiter=",")
birdteam_f1 = 0.598
birdteam_facies = np_utils.to_categorical(birdteam["Facies"]-1, nb_classes=9)

sum_f1 = ar4_f1+bestagini_f1+houmath_f1+birdteam_f1


E:\Anaconda3\lib\site-packages\keras\utils\np_utils.py:23: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  Y[i, y[i]] = 1.

In [9]:
print( houmath.head())
print( ar4.head())
print( bestagini.head())
print( birdteam.head())


   Unnamed: 0 Formation Well Name   Depth      GR  ILD_log10  DeltaPHI  PHIND  \
0           0     A1 SH    STUART  2808.0  66.276      0.630       3.3  10.65   
1           1     A1 SH    STUART  2808.5  77.252      0.585       6.5  11.95   
2           2     A1 SH    STUART  2809.0  82.899      0.566       9.4  13.60   
3           3     A1 SH    STUART  2809.5  80.671      0.593       9.5  13.25   
4           4     A1 SH    STUART  2810.0  75.971      0.638       8.7  12.35   

      PE  NM_M  RELPOS  Facies  
0  3.591     1   1.000       3  
1  3.341     1   0.978       3  
2  3.064     1   0.956       3  
3  2.977     1   0.933       3  
4  3.020     1   0.911       3  
   Unnamed: 0 Formation Well Name   Depth      GR  ILD_log10  DeltaPHI  PHIND  \
0           0     A1 SH    STUART  2808.0  66.276      0.630       3.3  10.65   
1           1     A1 SH    STUART  2808.5  77.252      0.585       6.5  11.95   
2           2     A1 SH    STUART  2809.0  82.899      0.566       9.4  13.60   
3           3     A1 SH    STUART  2809.5  80.671      0.593       9.5  13.25   
4           4     A1 SH    STUART  2810.0  75.971      0.638       8.7  12.35   

      PE  NM_M  RELPOS  Facies  
0  3.591     1   1.000       3  
1  3.341     1   0.978       3  
2  3.064     1   0.956       3  
3  2.977     1   0.933       3  
4  3.020     1   0.911       3  
   Unnamed: 0 Formation Well Name   Depth      GR  ILD_log10  DeltaPHI  PHIND  \
0           0     A1 SH    STUART  2808.0  66.276      0.630       3.3  10.65   
1           1     A1 SH    STUART  2808.5  77.252      0.585       6.5  11.95   
2           2     A1 SH    STUART  2809.0  82.899      0.566       9.4  13.60   
3           3     A1 SH    STUART  2809.5  80.671      0.593       9.5  13.25   
4           4     A1 SH    STUART  2810.0  75.971      0.638       8.7  12.35   

      PE  NM_M  RELPOS  Facies  
0  3.591     1   1.000       3  
1  3.341     1   0.978       3  
2  3.064     1   0.956       3  
3  2.977     1   0.933       3  
4  3.020     1   0.911       3  
   Unnamed: 0   Depth      GR  ILD_log10  DeltaPHI  PHIND     PE  NM_M  \
0           0  2808.0  66.276      0.630       3.3  10.65  3.591     1   
1           1  2808.5  77.252      0.585       6.5  11.95  3.341     1   
2           2  2809.0  82.899      0.566       9.4  13.60  3.064     1   
3           3  2809.5  80.671      0.593       9.5  13.25  2.977     1   
4           4  2810.0  75.971      0.638       8.7  12.35  3.020     1   

   RELPOS  formation_size   ...    sh_Formation_lag_2  a1_Formation_lead_2  \
0   1.000              43   ...                     1                    1   
1   0.978              43   ...                     1                    1   
2   0.956              43   ...                     1                    1   
3   0.933              43   ...                     1                    1   
4   0.911              43   ...                     1                    1   

   b1_Formation_lead_2  b2_Formation_lead_2  b3_Formation_lead_2  \
0                    0                    0                    0   
1                    0                    0                    0   
2                    0                    0                    0   
3                    0                    0                    0   
4                    0                    0                    0   

   b4_Formation_lead_2  b5_Formation_lead_2  lm_Formation_lead_2  \
0                    0                    0                    0   
1                    0                    0                    0   
2                    0                    0                    0   
3                    0                    0                    0   
4                    0                    0                    0   

   sh_Formation_lead_2  Facies  
0                    1     2.0  
1                    1     3.0  
2                    1     3.0  
3                    1     3.0  
4                    1     3.0  

[5 rows x 439 columns]

In [10]:
meta_facies = (bestagini_f1*bestagini_facies + ar4_f1*ar4_facies 
               + birdteam_f1*bestagini_facies + houmath_f1*houmath_facies)/(sum_f1)
print(meta_facies)


[[ 0.          0.          1.         ...,  0.          0.          0.        ]
 [ 0.          0.          1.         ...,  0.          0.          0.        ]
 [ 0.          0.          1.         ...,  0.          0.          0.        ]
 ..., 
 [ 0.          0.25840853  0.74159147 ...,  0.          0.          0.        ]
 [ 0.          0.25840853  0.74159147 ...,  0.          0.          0.        ]
 [ 0.49302707  0.50697293  0.         ...,  0.          0.          0.        ]]

In [13]:
metasubmission = np.argmax(meta_facies, axis=1) + 1
print (metasubmission)


[3 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 2 2 2 2 2 2 2
 2 3 3 3 3 3 8 8 8 8 8 8 6 6 6 6 6 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 8 8 8 8
 8 8 8 8 8 8 8 8 8 8 8 8 8 6 6 6 6 6 6 6 6 6 6 6 4 4 4 4 4 4 4 4 6 6 6 6 8
 8 8 8 8 8 8 8 8 8 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3
 3 3 8 8 8 8 8 8 8 8 8 8 8 8 8 8 7 7 7 7 6 6 6 6 6 6 6 6 6 6 8 8 8 8 3 3 3
 3 3 3 3 3 3 2 2 2 3 3 3 3 3 3 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 8 8 8 8 6 6
 6 6 6 6 6 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 8 8 8 8 8 8 8 8 6 6
 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 8 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7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 6 6 6 6 8 8 8 3 3
 3 3 3 2 2 2 2 2 2 2 2 2 3 3 3 2]

In [17]:
test_data = pd.read_csv("../validation_data_nofacies.csv", delimiter=",")
print(test_data.head())
test_data["Facies"] = metasubmission

test_data.to_csv("the_meta_submission.csv")

print(test_data.head())


  Formation Well Name   Depth      GR  ILD_log10  DeltaPHI  PHIND     PE  \
0     A1 SH    STUART  2808.0  66.276      0.630       3.3  10.65  3.591   
1     A1 SH    STUART  2808.5  77.252      0.585       6.5  11.95  3.341   
2     A1 SH    STUART  2809.0  82.899      0.566       9.4  13.60  3.064   
3     A1 SH    STUART  2809.5  80.671      0.593       9.5  13.25  2.977   
4     A1 SH    STUART  2810.0  75.971      0.638       8.7  12.35  3.020   

   NM_M  RELPOS  
0     1   1.000  
1     1   0.978  
2     1   0.956  
3     1   0.933  
4     1   0.911  
  Formation Well Name   Depth      GR  ILD_log10  DeltaPHI  PHIND     PE  \
0     A1 SH    STUART  2808.0  66.276      0.630       3.3  10.65  3.591   
1     A1 SH    STUART  2808.5  77.252      0.585       6.5  11.95  3.341   
2     A1 SH    STUART  2809.0  82.899      0.566       9.4  13.60  3.064   
3     A1 SH    STUART  2809.5  80.671      0.593       9.5  13.25  2.977   
4     A1 SH    STUART  2810.0  75.971      0.638       8.7  12.35  3.020   

   NM_M  RELPOS  Facies  
0     1   1.000       3  
1     1   0.978       3  
2     1   0.956       3  
3     1   0.933       3  
4     1   0.911       3  

In [ ]: