CycloneDX/Component/ModelCard.pm

filter: Statementstmt 78.2% 36 / 46 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 100% 1 / 1 totaltotal 66.2% 47 / 71 CC 7 SCAR 27.2
CC
7
Cov
62%
TO_JSON
42.0
__ANON__
6.0
BEGIN
1.0
CRAP 15.2
« CycloneDX/Declarations/Map.pm ↑ Summary CycloneDX/Standard/Level.pm »
1 package SBOM::CycloneDX::Component::ModelCard;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Types::Standard qw(Str InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 extends 'SBOM::CycloneDX::Base';
18  
19 has bom_ref => (
20 is => 'rw',
21 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
23 1 );
24  
25 1 has model_parameters => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::ModelParameters']);
26  
27 1 has quantitative_analysis => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::QuantitativeAnalysis']);
28  
29 1 has considerations => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component::Considerations']);
30  
31 1 has properties => (is => 'rw', isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Property']]);
32  
33 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=6 SCAR=37.4
Pod documented
34  
35 0 my $self = shift;
36  
37 0 my $json = {};
38  
39 0 ▶ $json->{bom} = $self->bom if $self->bom;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom 0 0 0
40 0 ▶ $json->{modelParameters} = $self->model_parameters if $self->model_parameters;
Branch: 1 branch
BranchTrueFalseTotal
if $self->model_parameters 0 0 0
41 0 ▶ $json->{quantitativeAnalysis} = $self->quantitativeAnalysis if $self->quantitative_analysis;
Branch: 1 branch
BranchTrueFalseTotal
if $self->quantitative_analysis 0 0 0
42 0 ▶ $json->{considerations} = $self->considerations if $self->considerations;
Branch: 1 branch
BranchTrueFalseTotal
if $self->considerations 0 0 0
43 0 ▶ $json->{properties} = $self->properties if @{$self->properties};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->properties;} 0 0 0
44  
45 0 return $json;
46  
47 }
48  
49 1 1;
50  
51 =encoding utf-8
52  
53 =head1 NAME
54  
55 SBOM::CycloneDX::Component::ModelCard - Model Card
56  
57 =head1 SYNOPSIS
58  
59 SBOM::CycloneDX::Component::ModelCard->new();
60  
61  
62 =head1 DESCRIPTION
63  
64 L<SBOM::CycloneDX::Component::ModelCard> provides a model card describes the
65 intended uses of a machine learning model and potential limitations,
66 including biases and ethical considerations. Model cards typically contain
67 the training parameters, which datasets were used to train the model,
68 performance metrics, and other relevant data useful for ML transparency.
69 This object SHOULD be specified for any component of type
70 `machine-learning-model` and must not be specified for other component
71 types.
72  
73 =head2 METHODS
74  
75 L<SBOM::CycloneDX::Component::ModelCard> inherits all methods from L<SBOM::CycloneDX::Base>
76 and implements the following new ones.
77  
78 =over
79  
80 =item SBOM::CycloneDX::Component::ModelCard->new( %PARAMS )
81  
82 Properties:
83  
84 =over
85  
86 =item * C<bom_ref>, An identifier which can be used to reference the
87 model card elsewhere in the BOM. Every bom-ref must be unique within the
88 BOM.
89 Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
90 conflicts with BOM-Links.
91  
92 =item * C<considerations>, What considerations should be taken into account
93 regarding the model's construction, training, and application?
94  
95 =item * C<model_parameters>, Hyper-parameters for construction of the model.
96  
97 =item * C<properties>, Provides the ability to document properties in a
98 name-value store. This provides flexibility to include data not officially
99 supported in the standard without having to use additional namespaces or
100 create extensions. Unlike key-value stores, properties support duplicate
101 names, each potentially having different values. Property names of interest
102 to the general public are encouraged to be registered in the CycloneDX
103 Property Taxonomy (L<https://github.com/CycloneDX/cyclonedx-property-taxonomy>).
104 Formal registration is optional.
105  
106 =item * C<quantitative_analysis>, A quantitative analysis of the model
107  
108 =back
109  
110 =item $model_card->bom_ref
111  
112 =item $model_card->considerations
113  
114 =item $model_card->model_parameters
115  
116 =item $model_card->properties
117  
118 =item $model_card->quantitative_analysis
119  
120 =back
121  
122  
123 =head1 SUPPORT
124  
125 =head2 Bugs / Feature Requests
126  
127 Please report any bugs or feature requests through the issue tracker
128 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
129 You will be notified automatically of any progress on your issue.
130  
131 =head2 Source Code
132  
133 This is open source software. The code repository is available for
134 public review and contribution under the terms of the license.
135  
136 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
137  
138 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
139  
140  
141 =head1 AUTHOR
142  
143 =over 4
144  
145 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
146  
147 =back
148  
149  
150 =head1 LICENSE AND COPYRIGHT
151  
152 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
153  
154 This is free software; you can redistribute it and/or modify it under
155 the same terms as the Perl 5 programming language system itself.
156  
157 =cut
« CycloneDX/Declarations/Map.pm ↑ Summary CycloneDX/Standard/Level.pm »