Esempio n. 1
0
def test_union_select_spearman(key, value):
    config = workflow_config.MisfitConfig(
        workflow={"clustering": {
            "fcluster": {
                key: value
            }
        }})
    assert config.workflow.type == "custom_scale"
Esempio n. 2
0
def test_union_select_auto_scale():
    config = workflow_config.MisfitConfig(
        workflow={"clustering": {
            "fcluster": {
                "depth": 1
            }
        }})
    assert config.workflow.type == "auto_scale"
Esempio n. 3
0
def test_workflow_custom(key, value):
    config_data = {
        "type": "custom_scale",
        "clustering": {
            "fcluster": {
                key: value
            }
        },
    }
    workflow_config.MisfitConfig(workflow=config_data)
Esempio n. 4
0
def test_config_workflow():
    config_data = {
        "observations": ["WWPR"],
        "workflow": {
            "type": "custom_scale",
            "clustering": {
                "linkage": {"method": "complete", "metric": "jensenshannon"}
            },
            "pca": {"threshold": 0.98},
        },
    }
    config = workflow_config.MisfitConfig(**config_data)
    assert config.workflow.type == "custom_scale"
Esempio n. 5
0
def test_default_clustering_method():
    config = workflow_config.MisfitConfig()
    assert config.workflow.type == "auto_scale"
Esempio n. 6
0
def test_default_scaling_threshold():
    config = workflow_config.MisfitConfig()
    assert config.workflow.pca.threshold == 0.95
Esempio n. 7
0
def test_invalid_scaling_threshold(threshold, workflow, expected_error):
    config_data = {"workflow": {"type": workflow, "pca": {"threshold": threshold}}}
    with pytest.raises(pydantic.ValidationError, match=expected_error):
        workflow_config.MisfitConfig(**config_data)
Esempio n. 8
0
def test_config_workflow_valid(workflow):
    config_data = {"workflow": {"type": workflow}}
    config = workflow_config.MisfitConfig(**config_data)
    assert config.workflow.type == workflow
Esempio n. 9
0
def test_auto_scale_invalid_fcluster(key, expected_error):
    config_data = {"type": "auto_scale", "clustering": {"fcluster": {key: 0.1}}}
    with pytest.raises(pydantic.ValidationError, match=expected_error):
        workflow_config.MisfitConfig(workflow=config_data)
Esempio n. 10
0
def test_valid_scaling_threshold(threshold, workflow):
    config_data = {"workflow": {"type": workflow, "pca": {"threshold": threshold}}}

    config = workflow_config.MisfitConfig(**config_data)
    assert config.workflow.pca.threshold == threshold