Package to prepare well log data for ML projects.
Project description
akerbp.mlpet
Preprocessing tools for Petrophysics ML projects at Eureka
Installation
-
Install the package by running the following (requires python 3.8 or later)
pip install akerbp.mlpet
Quick start
-
For a short example of how to use the mlpet Dataset class for pre-processing data see below. Please refer to the tests folder of this repository for more examples:
from akerbp.mlpet import Dataset from akerbp.mlpet import utilities # Instantiate an empty dataset object using the example settings and mappings provided ds = Dataset( settings="settings.yaml", # Absolute file paths are preferred mappings="mappings.yaml", # Absolute file paths are preferred folder_path=r"./", # Absolute file paths are preferred ) # Populate the dataset with data from a file (support for multiple file formats and direct cdf data collection exists) ds.load_from_pickle(r"data.pkl") # Absolute file paths are preferred # The original data will be kept in ds.df_original and will remain unchanged print(ds.df_original.head()) # Split the data into train-validation sets df_train, df_test = utilities.train_test_split( df=ds.df_original, target_column=ds.label_column, id_column=ds.id_column, test_size=0.3, ) # Preprocess the data for training according to default workflow # print(ds.default_preprocessing_workflow) <- Uncomment to see what the workflow does df_preprocessed = ds.preprocess(df_train)
The procedure will be exactly the same for any other dataset class. The only difference will be in the "settings". For a full list of possible settings keys see either the built documentation or the akerbp.mlpet.Dataset class docstring. Make sure that the curve names are consistent with those in the dataset.
The loaded data is NOT mapped at load time but rather at preprocessing time (i.e. when preprocess is called).
API Documentation
Full API documentaion of the package can be found under the docs folder once you have run the make html command.
For developers
-
to make the API documentation, from the root directory of the project run (assuming you have installed all development dependencies)
cd docs/ make html
-
to install mlpet in editable mode for use in another project, there are two possible solutions dependent on the tools being used:
- If the other package uses poetry, please refer to this guide
- If you are not using poetry (using conda, pyenv or something else), you will first need to:
-
Convert the pyproject.toml script to a setup.py file by running the following line:
curl -Ls https://raw.githubusercontent.com/sdss/flicamera/main/create_setup.py | python3
-
You can now pip install -e the package in the relevant virtual environment after you have activated it
-
License
akerbp.mlpet Copyright 2021 AkerBP ASA
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for akerbp.mlpet-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63731ec6156bfbdbbfbef1c499e64a81e5c77ea6580d6ec39d7c0f2a722a880d |
|
MD5 | e0693a35f9b93dd09a0d69f3a28a1068 |
|
BLAKE2b-256 | 6d4db324e2cff79a16be6b8e62a8f49a58702b7e6b58676c94fe565f850b6102 |