sklearn_hierarchical_classification/tests/fixtures.py
def make_newsgroups_hierarchy():
    """Create a class hierarchy based on newsgroups dataset."""
    hierarchy = {}
    hierarchy[ROOT] = ["alt", "comp", "rec", "misc", "sci", "soc", "talk"]
    hierarchy["alt"] = [
        "alt.atheism",
    ]
    hierarchy["comp"] = [
        "comp.graphics",
        "comp.os.ms-windows.misc",
        "comp.sys.ibm.pc.hardware",
        "comp.sys.mac.hardware",
        "comp.windows.x",
    ]
    hierarchy["misc"] = ["misc.forsale"]
    hierarchy["rec"] = [
        "rec.autos",
        "rec.motorcycles",
        "rec.sport.baseball",
        "rec.sport.hockey",
    ]
    hierarchy["sci"] = [
        "sci.crypt",
        "sci.electronics",
        "sci.med",
        "sci.space",
    ]
    hierarchy["soc"] = [
        "soc.religion.christian",
    ]
    hierarchy["talk"] = [
        "talk.politics.guns",
        "talk.politics.mideast",
        "talk.politics.misc",
        "talk.religion.misc",
    ]

    return hierarchy
Create a class hierarchy based on newsgroups dataset.
Create a class hierarchy based on newsgroups dataset.
Create a class hierarchy based on newsgroups dataset .
def make_newsgroups_hierarchy():
    hierarchy = {}
    hierarchy[ROOT] = ["alt", "comp", "rec", "misc", "sci", "soc", "talk"]
    hierarchy["alt"] = [
        "alt.atheism",
    ]
    hierarchy["comp"] = [
        "comp.graphics",
        "comp.os.ms-windows.misc",
        "comp.sys.ibm.pc.hardware",
        "comp.sys.mac.hardware",
        "comp.windows.x",
    ]
    hierarchy["misc"] = ["misc.forsale"]
    hierarchy["rec"] = [
        "rec.autos",
        "rec.motorcycles",
        "rec.sport.baseball",
        "rec.sport.hockey",
    ]
    hierarchy["sci"] = [
        "sci.crypt",
        "sci.electronics",
        "sci.med",
        "sci.space",
    ]
    hierarchy["soc"] = [
        "soc.religion.christian",
    ]
    hierarchy["talk"] = [
        "talk.politics.guns",
        "talk.politics.mideast",
        "talk.politics.misc",
        "talk.religion.misc",
    ]
    return hierarchy
def make_newsgroups_hierarchy ( ) : hierarchy = { } hierarchy [ ROOT ] = [ "alt" , "comp" , "rec" , "misc" , "sci" , "soc" , "talk" ] hierarchy [ "alt" ] = [ "alt.atheism" , ] hierarchy [ "comp" ] = [ "comp.graphics" , "comp.os.ms-windows.misc" , "comp.sys.ibm.pc.hardware" , "comp.sys.mac.hardware" , "comp.windows.x" , ] hierarchy [ "misc" ] = [ "misc.forsale" ] hierarchy [ "rec" ] = [ "rec.autos" , "rec.motorcycles" , "rec.sport.baseball" , "rec.sport.hockey" , ] hierarchy [ "sci" ] = [ "sci.crypt" , "sci.electronics" , "sci.med" , "sci.space" , ] hierarchy [ "soc" ] = [ "soc.religion.christian" , ] hierarchy [ "talk" ] = [ "talk.politics.guns" , "talk.politics.mideast" , "talk.politics.misc" , "talk.religion.misc" , ] return hierarchy
Create a class hierarchy based on newsgroups dataset.
Create a class hierarchy based on newsgroups dataset .
"""Create a class hierarchy based on newsgroups dataset."""