Replies: 1 comment
|
The immediate problem is that Your component should look like this: @dsl.component(base_image=DEFAULT_IMAGE, packages_to_install=["numpy"])
def evaluate(
model_in: dsl.Input[dsl.Model],
slicer: dsl.Output[dsl.SlicedClassificationMetrics],
):
import numpy as np
with open(model_in.path, "rb") as fin:
model = np.load(fin)
for x in range(100):
threshold = 1 / (x + 1)
randf = float(np.random.random())
slicer.log_roc_reading(
"potato", threshold=threshold, tpr=randf, fpr=float(np.cos(randf))
)
slicer.log_roc_reading(
"strawberry", threshold=threshold, tpr=randf, fpr=float(np.sin(randf))
)The output artifact is injected by the component runtime. Do not instantiate The current SDK reference documents |
Uh oh!
There was an error while loading. Please reload this page.
Hope it's the right place to ask the question like that but I couldn't find any reference example anywhere on the net.
I want to use the sliced metrics and for the life of mine I can't figure out how are they supposed to be used.
kfp.version >>>> '2.15.2'
Running in a pipeline
I expected the sliced metrics to use the same syntax as the normal metrics:
the pipeline fails with an attribute error.
I have a feeling I need to define the SlicedClassificationMetrics somewhere else first and make it both an input and an output to pass it from there but I just can't figure out how is it supposed to work exactly.
Trying to just use a dummy locally:
I looked at the test code in the pipelines wiki and it appears this should work:
but it gives me
AttributeError: 'SlicedClassificationMetrics' object has no attribute '_sliced_metrics'indicating the constructor does not build a complete object even though the arguments are all flagged as optional.All reactions