Giter Site home page Giter Site logo

pycpt's Introduction

pyCPT

A Bayesian unsupervised learning method for geotechnical soil stratification identification.

License: LGPL v3 Python 3.6.x

Contents

Introduction

This package presents a novel perspective to understand the spatial and statistical patterns of a cone penetration dataset and an automatic approach to identify soil stratification. Both local consistency in physical space (i.e., along depth) and statistical similarity in feature space (i.e., logQt โ€“ logFr space or the Robertson chart) between data points are considered simultaneously. The proposed approach is, in essence, consist of two parts: 1) a pattern detection approach using Bayesian inferential framework, and 2) a pattern interpretation protocol using Robertson chart. The first part is the mathematical core of the proposed approach, which infers both spatial pattern in physical space and statistical pattern in feature space from the input dataset; the second part converts the abstract patterns into intuitive spatial configurations of multiple soil layers having different soil behavior types. The advantages of this approach include probabilistic soil classification, and identifying soil stratification in an automatic and fully unsupervised manner. This approach has been tested using various datasets including both synthetic and real-world CPT soundings.

The package is based on the algorithm developed by Wang et al., 2017 and combines Markov Random Fields with Gaussian Mixture Models in a Bayesian inference framework. The recent results have been published in Canadian Geotechnical Journal. The titile of the artical is "A Bayesian unsupervised learning approach for identifying soil stratification using cone penetration data".

If you have any questions or comments regarding this project, please contact Hui Wang, Ph.D. hwang12 (AT) udayton (DOT) edu

Examples

NGES CPT log interpretaion

You can try out this example by using an interactive Jupyter Notebook in your own web browser, enabled by Binder, simply please click the link below:

Binder

Installation

As the library is still in early development, the current way to install it is to clone this repository and then import it manually to your projects.

Dependencies

pyCPT depends on the following existing packages:

  • numpy for efficient numerical implementation
  • scikit-learn for finite mixture models
  • scipy for its statistical functionality
  • matplotlib for plotting
  • tqdm provides convenient progress meters

Cloning directly from GitHub

First clone the repository using the command (or by manually downloading the zip file from the GitHub page)

git clone https://github.com/hwang051785/pyCPT.git

then append the path to the repository:

import sys
sys.path.append("path/to/cloned/repository")

to import the module:

import pyCPT
import post_process

Getting Started

Construct data structure and perform model selection for the optimal number of clusters

cpt = pyCPT.CPT('path/to/dataset')

Extract soil segments

cpt.segmentation(num_of_iter=200, start_iter=100)

Soil interpretation

cpt.detect_layers()

Plot the soil layers

pyCPT.plot_layers(cpt)

References

  • Wang, H., Wellmann, J. F., Li, Z., Wang, X., & Liang, R. Y. (2017). A Segmentation Approach for Stochastic Geological Modeling Using Hidden Markov Random Fields. Mathematical Geosciences, 49(2), 145-177.
  • Wang, H., Wang, X., Wellmann, F., & Liang, R. Y. (2018). A Bayesian unsupervised learning approach for identifying soil stratification using cone penetration data. Canadian Geotechnical Journal, (in press).

pycpt's People

Contributors

hwang051785 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar Maria  avatar  avatar  avatar Maria Megia avatar

Watchers

 avatar  avatar  avatar

pycpt's Issues

Error in reading cpt data file

Hi,

I am trying to test the code but I get the following:

Traceback (most recent call last):
  File "/home/ehsan/pyCPT/01.py", line 8, in <module>
    cpt = pyCPT.CPT('../pyCPT/data/cpt.csv')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/pyCPT.py", line 23, in __init__
    self.element = read_cpt_data(data_path)
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/pyCPT.py", line 184, in read_cpt_data
    element = pyHMRF.Element(data, coord, normalize=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/pyHMRF.py", line 85, in __init__
    self.colors = pseudocolor(self.phys_shp, self.stencil)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/pyHMRF.py", line 785, in pseudocolor
    return np.array([i_w, i_b])
           ^^^^^^^^^^^^^^^^^^^^
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

Can you help?

TypeError: Ellipse.__init__() takes 4 positional arguments but 5 were given

Hi

When I try to run the test model, I get

Number of data points:  [296]
Fitting model with number of components =  1
Fitting model with number of components =  2
Fitting model with number of components =  3
Fitting model with number of components =  4
Fitting model with number of components =  5
Fitting model with number of components =  6
Fitting model with number of components =  7
Fitting model with number of components =  8
Fitting model with number of components =  9
Fitting model with number of components =  10
Traceback (most recent call last):
  File "/home/ehsan/pyCPT/test_data/ploy.py", line 16, in <module>
    cpt1 = pyCPT.CPT(datapath)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/test_data/../pyCPT.py", line 28, in __init__
    self.mod_sel = model_selection(feat=self.element.feat, n_labels=max_number_of_clusters, plot=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ehsan/pyCPT/test_data/../pre_process.py", line 87, in model_selection
    ell = patches.Ellipse(mean, v[0], v[1], 180. + angle)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Ellipse.__init__() takes 4 positional arguments but 5 were given

Any idea how to solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.