lib-ml-REMLA10-2024
provides essential functions for preprocessing and postprocessing data in machine learning projects. It includes utilities for data splitting, preprocessing, and evaluation.
Note: Python 3.11 is required for this library!
Inside your Python 3.11 virtual environment, run:
poetry add lib-ml-REMLA10-2024
Alternatively, you can install the package with pip:
pip install lib-ml-REMLA10-2024
You can import the necessary functions in your Python modules:
from lib_ml_remla import preprocess_data, split_data
from lib_ml_remla import preprocess_data, split_data
# Example data
train_data = ["1\tThis is a sample training sentence.", "0\tAnother training example."]
test_data = ["1\tThis is a sample test sentence."]
val_data = ["0\tThis is a sample validation sentence."]
# Split data
raw_X_train, raw_y_train, raw_X_val, raw_y_val, raw_X_test, raw_y_test = split_data(train_data, test_data, val_data)
# Preprocess data
X_train, y_train, X_val, y_val, X_test, y_test, char_index, tokenizer, encoder = preprocess_data(
raw_X_train, raw_y_train, raw_X_val, raw_y_val, raw_X_test, raw_y_test
)
from lib_ml_remla import predict_classes, evaluate_results
from keras.models import load_model
from sklearn.preprocessing import LabelEncoder
# Load your trained model
model = load_model('path_to_your_model')
# Predict classes
labels, probabilities = predict_classes(model, encoder, X_test)
# Evaluate results
results = evaluate_results(y_test, labels)
print(results)
This project is licensed under the terms of the MIT
license. See LICENSE for more details.