Module epiclass.utils.augment_predict_file
Augment a label prediction file with new metadata categories.
File header format important. Expects [md5sum, true class, predicted class, labels] lines. or [md5sum, true class, predicted class, split_nb, labels] lines.
Functions
def add_coherence(df: pd.DataFrame, category: str)
-
Add another metric based on multiple lines. Needs a file with EpiRR column.
https://stackoverflow.com/questions/17995024/how-to-assign-a-name-to-the-size-column https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.transform.html
def add_track_type_coherence(df)
-
Add a more complex coherence metric. Tells us how much tracks types agree on predicted class for a unique experiment
def augment_header(header, categories)
-
Augment the file header with new metadata categories
def augment_line(line, metadata: Metadata, categories: List[str], classes, split_nb_col: bool = False)
-
Augment a non-header line with new metadata labels and additional info on 2nd highest prob.
def augment_predict(metadata: Metadata, predict_path: Path, categories: List[str], append_name: str | None = None)
-
Read -> augment -> write, row by row.
Expects [md5sum, true class, predicted class, labels] lines.
Returns path of new file.
def correct_true(path: Path, category: str, metadata: Metadata)
-
Read file and replace 'True class' labels with metadata values for given category.
def main()
-
Augment a label prediction file with new metadata categories.
File header format important. Expects [md5sum, true class, predicted class, labels] lines.
def parse_arguments() ‑> argparse.Namespace
-
Return argument line parser.
def write_coherence(path, category: str)
-
Read file, add coherence for given category, write it updated to same path.