Skip to main content

A package for machine learning model evaluation and data processing.

Project description

RFDpy

RFDpy is a Python package for machine learning model evaluation and data processing. It includes tools for dynamic training processing (DTP) and robust prediction data filtering (RPDF).

Installation

You can install the package using pip:

pip install RFDpy


Usage

from RFDpy import DTP, RPDF
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=52)
train_data = list(zip(X_train, y_train))
test_data = list(zip(X_test, y_test))

# Example usage of DTP
def model_factory(regularization):
    return XGBRegressor(n_estimators=100, random_state=52,alpha=regularization)

evaluator = DTP(
    model_factory=model_factory,
    initial_train_data=train_data,
    initial_test_data=test_data,
    x_threshold=0.05,
    initial_lr=0.01,
    lr_decay=0.9,
    initial_regularization=0.001,
    regularization_decay=0.9
)
results = evaluator.run_evaluation_cycles(M=10, th_save_path='path\\to\\save\\cycle_data.txt')


for result in results:
    print(result)

evaluator.export_results_to_txt('path\\to\\save\\evaluation_results.txt', results)
evaluator.export_data_to_txt('path\\to\\save\\detailed_data.txt')

# Example usage of RPDF
rpdf = RPDF(target_occurrences=100, target_probability=0.95, error_margin=0.05)
X_train_updated, y_train_updated = rpdf.update_training_data(X_train, y_train)

xgb_regr = XGBRegressor(n_estimators=100, random_state=52)
xgb_regr.fit(X_train_updated, y_train_updated)
y_pred = xgb_regr.predict(X_test)

satisfactory_indices = rpdf.evaluate_predictions(y_test, y_pred)
satisfactory_values = y_test[satisfactory_indices]

output_file_path = 'path\\to\\save\\output_file.txt'
with open(output_file_path, 'w') as file:
    for value in satisfactory_values:
        file.write(f"{value}\n")

print(f"Filtered true values saved to: {output_file_path}")

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

RFDpy-0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

RFDpy-0.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file RFDpy-0.1.tar.gz.

File metadata

  • Download URL: RFDpy-0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for RFDpy-0.1.tar.gz
Algorithm Hash digest
SHA256 d8c8d50cd09385cb9106601e33b01797974e907acf39a3d3b63199e495f4646b
MD5 6a3f0707c8facedcd17ab9c28d45185c
BLAKE2b-256 b9549d0424503be11da712d86a33f5c47b6809c0bf9577fce9cfdcf1da14054f

See more details on using hashes here.

File details

Details for the file RFDpy-0.1-py3-none-any.whl.

File metadata

  • Download URL: RFDpy-0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for RFDpy-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f5eca3d3fc14d7d1986a7a0fc4273efd44dbcf0b9485306cfa1e012e9462f720
MD5 0d380df844b91d6e4c032524bd97a2a2
BLAKE2b-256 ee7d74891a873fae31f6543ff8ce0332dbfb3db47620afd08127b84a13ca2879

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