How to get an Entity Tile with Sorbetto?

[1]:
import matplotlib.pyplot as plt
[2]:
from sorbetto.performance.two_class_classification_performance import (
    TwoClassClassificationPerformance,
)
from sorbetto.core.entity import Entity
from sorbetto.tile.entity_tile import EntityTile
from sorbetto.flavor.entity_flavor import EntityFlavor
from sorbetto.parameterization.parameterization_default import ParameterizationDefault

Define entity 1

[3]:
# Define the performance
proba_tn = 0.4
proba_fp = 0.045
proba_fn = 0.055
proba_tp = 0.5

# Create a performance object
performance1 = TwoClassClassificationPerformance(
    ptn=proba_tn, pfp=proba_fp, pfn=proba_fn, ptp=proba_tp
)

# Create an entity object
entity1 = Entity(performance1)

Define entity 2

[4]:
# Define the performance
proba_tn = 0.3
proba_fp = 0.055
proba_fn = 0.045
proba_tp = 0.6

# Create a performance object
performance2 = TwoClassClassificationPerformance(
    ptn=proba_tn, pfp=proba_fp, pfn=proba_fn, ptp=proba_tp
)

# Create an entity object
entity2 = Entity(performance2)

Define entity 3

[5]:
# Define the performance
proba_tn = 0.3
proba_fp = 0.16
proba_fn = 0.14
proba_tp = 0.4

# Create a performance object
performance3 = TwoClassClassificationPerformance(
    ptn=proba_tn, pfp=proba_fp, pfn=proba_fn, ptp=proba_tp
)

# Create an entity object
entity3 = Entity(performance3)

Get Entity Tile for first rank

[6]:
# Create the flavor object
flavor = EntityFlavor(rank=1, entity_list=[entity1, entity2, entity3])

# Create the tile object
tile = EntityTile(
    parameterization=ParameterizationDefault(),
    flavor=flavor,
    name="Entity Tile for 1st rank",
)

# Draw the entity tile
fig, ax = tile.draw()
plt.show()
../../_images/src_examples_entity_tile_10_0.png