Skip to main content

Predicts classes of environmental due diligence

Project description

EnvBert is an easy-to-use Python library built on top of Bert models to identify essential environmental data as a part of due diligence in environmental site assessments.

Feature Output
EDD Prediction Categorizes the Environment data under different classes
Relevancy Classify whether it's relevant or not for the Environment domain
Ranking Relevance probability is returned against the predicted classes
Fine-tuning Train for your custom Environment data and save, use your model

Installation

Use the package manager pip to install EnvBert

pip install EnvBert

Usage

Predict with EnvBert

# load all the functions
from EnvBert.due_diligence import *

# returns the predicted class along with the probability of the actual EnvBert model
doc = """
	weathered shale was encountered below the surface area with fluvial deposits. 
	Sediments in the coastal plain region are found above and below the bedrock 
	with sandstones and shales that form the basement rock"
      """

envbert_predict(doc)

Fine-tune over EnvBert with your custom Environment data and labels

# load all the functions
from EnvBert.due_diligence import *

# define training config
training_config = {
    'learning_rate':5e-5,
    'epochs':10,
    'batch_size':16,
    'sentence column name':'Sentence', #training sentences column name
    'label column name': 'label', #encoded labels column name
    'save_dir': r'XX\XX\XXX' #model save path
    }

"""
please make sure you encode your labels
provide the save_dir path to automatically save the model after training
'sentence column name' and 'label column name' are mandatory fields in training config
you can tweak the other parameters or it will be taken by default
"""

# Train the model with just 1 line
new_model, new_tokenizer = finetune(df, training_config) #df is the dataframe with your sentences and labels

Load your fine-tuned model and predict

load_dir = r'XX\XX\XXX' #model save path

finetuned_model = finetune_predict(load_dir)

# single sentence prediction
doc= "contamination have been reported and remediation havent been carried out"
finetuned_model.sent(doc)

# predict over a dataframe column
df['prediction'] = finetuned_model.df(df, 'Sentence') #df is the dataframe and 'Sentence' is the column name

Change log

  1. Updated the transformers dependency to >=4.30,<4.40 for improved compatibility and stability.

  2. Modified the numerical output formatting to eliminate unintended floating-point artifacts.

About

This Package is part of the Research topic "AI for Environment Due-Diligence" conducted by Afreen Aman, Deepak John Reji. If you use this work (code, model or dataset),

Please cite us and star at: AI for Environment Due-Diligence, (2022), GitHub repository, https://github.com/dreji18/environmental-due-diligence

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envbert-1.0.9.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envbert-1.0.9-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file envbert-1.0.9.tar.gz.

File metadata

  • Download URL: envbert-1.0.9.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for envbert-1.0.9.tar.gz
Algorithm Hash digest
SHA256 5c77fae386e44a1c1f1d95fdb2e44006620c50d38b3660d2c0dcfa9e5941b109
MD5 b204804b8fb43b38c6d86215966f4f9a
BLAKE2b-256 c58056b22c943ac4a773865bc68bbe4ca298019232aea18bf8c56365be322809

See more details on using hashes here.

File details

Details for the file envbert-1.0.9-py3-none-any.whl.

File metadata

  • Download URL: envbert-1.0.9-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for envbert-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 88017734500e7a886b27b65c4483cb243cd7386bbc39f663c37402153e50b97e
MD5 655170ceb010d38ca74333638bfc5533
BLAKE2b-256 6422d07227a3638cd4cb5f0d76b3f4df24c61c1def496b52ac9669f731559648

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page