Ejemplo n.º 1
0
def test_transcripts_evaluate(get_transcripts_interface_params):
    """
    Test evaluate for transcripts.

    Args:
        get_transcripts_interface_params (tuple): Tuple to configure local interface

    Return:
        None
    """
    from sail_on_client.protocol.localinterface import LocalInterface

    config_directory, config_name = get_transcripts_interface_params
    local_interface = LocalInterface(config_name, config_directory)
    session_id = _initialize_session(local_interface, "OND", "transcripts")
    result_folder = os.path.join(
        os.path.dirname(__file__), "mock_results", "transcripts"
    )
    detection_file_id = os.path.join(
        result_folder, "OND.0.90001.8714062_PreComputedDetector_detection.csv"
    )
    classification_file_id = os.path.join(
        result_folder, "OND.0.90001.8714062_PreComputedDetector_classification.csv"
    )
    characterization_file_id = os.path.join(
        result_folder, "OND.0.90001.8714062_PreComputedDetector_characterization.csv"
    )
    results = {
        "detection": detection_file_id,
        "classification": classification_file_id,
        "characterization": characterization_file_id,
    }

    baseline_session_id = _initialize_session(local_interface, "OND", "transcripts")
    local_interface.post_results(results, "OND.0.90001.8714062", 0, session_id)
    local_interface.evaluate("OND.0.90001.8714062", 0, session_id)

    baseline_classification_file_id = os.path.join(
        result_folder,
        "OND.0.90001.8714062_BaselinePreComputedDetector_classification.csv",
    )
    baseline_result = {
        "classification": baseline_classification_file_id,
    }
    local_interface.post_results(
        baseline_result, "OND.0.90001.8714062", 0, baseline_session_id
    )
    local_interface.evaluate("OND.0.90001.8714062", 0, session_id, baseline_session_id)
Ejemplo n.º 2
0
def test_image_classification_evaluate(get_ic_interface_params):
    """
    Test evaluate with rounds.

    Args:
        get_interface_params (tuple): Tuple to configure local interface

    Return:
        None
    """
    from sail_on_client.protocol.localinterface import LocalInterface

    config_directory, config_name = get_ic_interface_params
    local_interface = LocalInterface(config_name, config_directory)
    session_id = _initialize_session(local_interface, "OND", "image_classification")
    baseline_session_id = _initialize_session(
        local_interface, "OND", "image_classification"
    )
    result_folder = os.path.join(
        os.path.dirname(__file__), "mock_results", "image_classification"
    )
    detection_file_id = os.path.join(
        result_folder, "OND.54011215.0000.1236_PreComputedDetector_detection.csv"
    )
    classification_file_id = os.path.join(
        result_folder, "OND.54011215.0000.1236_PreComputedDetector_classification.csv"
    )
    baseline_classification_file_id = os.path.join(
        result_folder,
        "OND.54011215.0000.1236_BaselinePreComputedDetector_classification.csv",
    )
    results = {
        "detection": detection_file_id,
        "classification": classification_file_id,
    }
    baseline_result = {
        "classification": baseline_classification_file_id,
    }
    local_interface.post_results(results, "OND.54011215.0000.1236", 0, session_id)
    local_interface.post_results(
        baseline_result, "OND.54011215.0000.1236", 0, baseline_session_id
    )
    local_interface.evaluate("OND.54011215.0000.1236", 0, session_id)
    local_interface.evaluate(
        "OND.54011215.0000.1236", 0, session_id, baseline_session_id
    )
Ejemplo n.º 3
0
def test_evaluate(get_interface_params):
    """
    Test evaluate with rounds.

    Args:
        get_interface_params (tuple): Tuple to configure local interface

    Return:
        None
    """
    from sail_on_client.protocol.localinterface import LocalInterface

    config_directory, config_name = get_interface_params
    data_dir = f"{os.path.dirname(__file__)}/data"
    local_interface = LocalInterface(config_name, config_directory)
    session_id = _initialize_session(local_interface, "OND")
    response = local_interface.evaluate("OND.1.1.1234", 0, session_id)
    expected = os.path.join(data_dir, "evaluation.csv")
    assert expected == response