Skip to main content

Library for generating validation dataset and evaluation metrics

Project description

MetricForge

Library for generating validation dataset and evaluation metrics

Use import metricforge.main as mf

List of functions:

script_valid

Function for creating validation dataset or creating a new column, using your own model. To do this, enter in function your function, which generating answer. Otherwise select model which you need and prompt, then new CSV file would be generated

variables

file_base - your csv file with train data. "your_csv.csv"
df_name - name of your new dataframe
column_name - name of column which will be used for valid generation
file_new - name of new csv file "new_csv.csv"
model_name - name of model which you want to use
prompt - prompt for LLM for generating valid dataset

Example usage of function:

mf.script_valid(file_base = "dataset.csv", df_name = "generated_answer",column_name = "data/dictionary",prompt = "You are a validation generator dataset bot. " "You are creating a validation dataset based on a training dataset. " "Based on the given query, generate a similar query.",file_new = "file_new.csv",model_name="mistral:instruct")

calculate_metrics

Function for calculating Accuracy and F1 Score metrics. We use the Schlern library for calculations. Column one and Column two can be both the name of the column and its number

variables

csv_file - your csv file with data. "your_csv.csv"
column_one - number or name of first column, where it is your original data
column_two - number or name of second column, where it is generated or predicted data

Example usage of function:

csv_file = r"validated_dataset.csv" accuracy, f1 = mf.calculate_metrics(csv_file, 3, 4) print("Accuracy:", accuracy) print("F1 Score:", f1)

script_generate

Function for applying RAG function "model_query" to the provdied dataset, to generate answers for "column_name" in your dataset. By default model_query generate answer in str format.

variables

csv_file - your csv file with provided data. "your_csv.csv"
column_name - name of column which will be used for answer generation
dfnew_name - name of new df
model_query - your function with RAG chain, where result is worg of RAG chain

Example usage of function:

mf.script_generate_json(csv_file=r"datavalid.csv", column_name="data/dictionary", model_query=model_query,dfnew_name="testing.csv")

script_generate_json

Function for applying RAG function "model_query" to the provdied dataset, to generate answers for "column_name" in your dataset. This function assumes your LLM generate answer in JSON view, so you need to select which name from JSON you want extract in desired_data variable

variables

csv_file - your csv file with provided data. "your_csv.csv"
column_name - name of column which will be used for answer generation
dfnew_name - name of new df
model_query - your function with RAG chain, where result is worg of RAG chain
desired_data - name of json data, which will be taken from json and inputted in result CSV column

Example usage of function:

mf.script_generate_json(csv_file=r"datavalid.csv", column_name="data/dictionary", model_query=model_query,dfnew_name="testing.csv", desired_data="data/url")

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

m2metricforge-0.0.4.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

m2metricforge-0.0.4-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file m2metricforge-0.0.4.tar.gz.

File metadata

  • Download URL: m2metricforge-0.0.4.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.11

File hashes

Hashes for m2metricforge-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8ab2ca94d2c72622a2c36fda6788746830ac468485f161776008ce3b0b44cb59
MD5 5e833af359a06c193cd11f6afb836e08
BLAKE2b-256 6519c2c6e4ebeb7b94741acd060b58df7a246b4eea1ddb87203e5960007259c2

See more details on using hashes here.

File details

Details for the file m2metricforge-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: m2metricforge-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.11

File hashes

Hashes for m2metricforge-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6d0a860c35814983f2724093879275b000ae1f105380a3ccba4a500e392735e1
MD5 728b46f67c68d8f398236b6ebe6a7f4e
BLAKE2b-256 9788e97366b9da0235fdabb3de24bb7f832aa118ffa02294de485a22101a04e6

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