Label
struct
defined in module
FastAI
Label(classes) <: Block
setup(LabelMulti, data)
Block
for a categorical label in a single-class context.
data
is valid for
Label(classes)
if
data ∈ classes
.
See
LabelMulti
for the multi-class setting where an observation can belong to multiple classes.
block
=
Label
(
[
"
cat
"
,
"
dog
"
]
)
# an observation can be either "cat" or "dog"
@
test
FastAI
.
checkblock
(
block
,
"
cat
"
)
@
test
!
(
FastAI
.
checkblock
(
block
,
"
horsey
"
)
)
You can use
setup
to create a
Label
instance from a data container containing possible classes:
targets
=
[
"
cat
"
,
"
dog
"
,
"
dog
"
,
"
dog
"
,
"
cat
"
,
"
dog
"
]
block
=
setup
(
Label
,
targets
)
@
test
block
≈
Label
(
[
"
cat
"
,
"
dog
"
]
)
There is
1
method for FastAI.Label
:
The following pages link back here:
Blocks and encodings, Feature registries in FastAI.jl, How to train a model, Introduction, New visualization tools for FastAI.jl, Saving and loading models for inference, Siamese image similarity, Tabular Classification
FastAI.jl , Registries/Registries.jl , blocks/label.jl , blocks/many.jl , datablock/wrappers.jl , encodings/onehot.jl , encodings/only.jl , interpretation/text.jl , learner.jl , FastTabular.jl , recipes.jl , tasks/classification.jl , FastVision.jl , recipes.jl , tasks/classification.jl , tests.jl