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.1.tar.gz (2.8 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.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: RFDpy-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 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.1.tar.gz
Algorithm Hash digest
SHA256 61c216ca5624485291814bd508ecd0205d27193413aa35c15b6b27c53f87cd03
MD5 c68164c5d7d9223dd88c245a32df27b4
BLAKE2b-256 5503066b30d03a3af4630aa673ba9faa64c7c761884fb51d8226820f34be29b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: RFDpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89b733bc268d133b4a1fba7a965f77d7d1b527c1ffc77bc28e17c530c73f97ae
MD5 c297224cb49cb3d5650ac75cd0e056e5
BLAKE2b-256 f7aa4234ee693f02e874ca0e979eee323e7bc796e9a1f2c7ec69b018d7928e55

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