本文引用Brendon Hall在2016年《The Leading Edge》上发表的题为“Facies classfication using machine learning”文章,Hall(2016)在文中介绍了SVM方法在岩相分类中的应用。本文实现了利用神经网络方法实现岩相分类。
模型:(引用吴恩达老师深度学习微专业编程作业2.3.2-利用TensorFlow搭建神经网络模型)
LINEAR -> RELU -> LINEAR -> RELU -> LINEAR -> SOFTMAX
划分数据集:
training_data = pd.read_csv('training_data.csv')
test_data = training_data[training_data['Well Name'] == 'SHANKLE'] #从训练数据集中抽出一口井用于测试
training_data = training_data[training_data['Well Name'] != 'SHANKLE'] #从训练数据剔除这口井
all_vectors = training_data.drop(['Facies','Formation', 'Well Name', 'Depth'], axis=1)
all_labels = training_data['Facies'].values
nan_idx = np.any(np.isnan(all_vectors), axis=1) # 剔除NaNs
training_vectors = all_vectors[np.logical_not(nan_idx)]
training_labels = all_labels [np.logical_not(nan_idx)]
test_vectors = test_data.drop(['Facies','Formation', 'Well Name', 'Depth'], axis=1)
test_labels = np.ones(test_vectors.shape[0], dtype=np.int)
test_labels_true = test_data['Facies'].values
scaler = preprocessing.StandardScaler().fit(training_vectors)
scaled_training_vectors = scaler.transform(training_vectors)
scaled_test_vectors = scaler.transform(test_vectors) #据我了解,测试集应该与训练集采用相同的均值和方差用于标准化
X_train, X_cv, Y_train, Y_cv = train_test_split(scaled_training_vectors, training_la