Skip to main content

Machine Learning Kit (mlkit)

INSTALL

pip install ml_scripts

EXAMPLES

1. Model Evaluate

1.1 Classifier Evaluate

  • Add Data
from ml_scripts.model_evaluate import ClassifierEvaluate

pred_probs_vectors = [[1, 3, 2, 7, 0],
                      [4, 7, 2, 8, 2],
                      [1, 3, 7, 4, 9]]  # normalization is not required
real_idxes = [2, 1, 3]
ce = ClassifierEvaluate(pred_probs_vectors, real_idxes)

more_pred_probs_vectors = [[7, 5, 3, 6, 1],
                           [1, 4, 6, 7, 9]]
more_real_idxes = [0, 4]
ce.extend_pred_and_real(more_pred_probs_vectors, more_real_idxes)
  • Calculate Topk-Accuracies
ce.get_topk_acc(1)
# 0.4

ce.get_topk_acc(2)  
# 0.6

ce.get_topk_acc(3)  
# 1.0
  • Calculate Topk-Precision/Recall/Accuracies for each class
ce.get_topk_tp_fn_fp_tn_for_idxes(1)
# {0: (1, 0, 0, 4),
#  1: (0, 1, 0, 4),
#  2: (0, 1, 0, 4),
#  3: (0, 1, 2, 2),
#  4: (1, 0, 1, 3)}

ce.get_topk_tp_fn_fp_tn_for_idxes(2)
# {0: (1, 0, 0, 4),
#  1: (1, 0, 1, 3),
#  2: (0, 1, 1, 3),
#  3: (0, 1, 4, 0),
#  4: (1, 0, 1, 3)}
  • Save All Results of Evaluation
ce.save_result(max_k=50, result_dp='[directory_path_to_save_result_of_evaluation]')

Metadata

Release files for ml-scripts 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ml-scripts 0.0.3
File Size Uploaded Provenance Actions
ml_scripts-0.0.3.tar.gz 3.2 kB Without provenance Details for ml_scripts-0.0.3.tar.gz

Release files / ml_scripts-0.0.3.tar.gz

Download URL ml_scripts-0.0.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
027b311976a88e801b90a023139d2ee79ea4010f84dea90d4a1e054fc28a9b2a
BLAKE2b-256 checksum
How to use checksums
be22538f69a1aee58059998336ef296ce992ca45d6b74b33d08c152b9904e6d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.13

Security for ml-scripts 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page