forked from gopredict/pmml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
elements.go
6035 lines (5580 loc) · 189 KB
/
elements.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//nolint
package models
import (
"encoding/xml"
"strconv"
defaults "github.com/mcuadros/go-defaults"
"github.com/pkg/errors"
)
/*
ARDSquaredExponentialKernel is the Automatic Relevance Determination (ARD) squared exponential basis
function. This covariance function is the squared exponential kernel function with a separate
lengthscale hyper-parameter, λi, for each predictor, i.e. input dimension xi:
k(x,z)=γ exp(-1/2 (Sum[(i=1)to p]( |xi-zi| /λi)2))
<xs:element name="ARDSquaredExponentialKernel">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="optional"/>
<xs:attribute default="1" name="gamma" type="REAL-NUMBER" use="optional"/>
<xs:attribute default="1" name="noiseVariance" type="REAL-NUMBER" use="optional"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Lambda"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/GaussianProcess.html#xsdElement_ARDSquaredExponentialKernel
*/
type ARDSquaredExponentialKernel struct {
Description *string `xml:"description,attr"`
Gamma *RealNumber `xml:"gamma,attr" default:"1"`
NoiseVariance *RealNumber `xml:"noiseVariance,attr" default:"1"`
Extensions []Extension `xml:"Extension"`
Lambda *Lambda `xml:"Lambda"`
}
/*
ARIMA may contain one or more ARIMA(p,d,q,P,D,Q) models of the time series.
<xs:element name="ARIMA"/>
http://dmg.org/pmml/v4-3/TimeSeriesModel.html#xsdElement_ARIMA
*/
type ARIMA struct {
}
/*
AbsoluteExponentialKernel is the absolute exponential basis function:
k(x,z)=γ exp(-1/2 (Sum[(i=1)to p]( |xi-zi| /λi))
<xs:element name="AbsoluteExponentialKernel">
<xs:complexType>
<xs:attribute name="description" type="xs:string" use="optional"/>
<xs:attribute default="1" name="gamma" type="REAL-NUMBER" use="optional"/>
<xs:attribute default="1" name="noiseVariance" type="REAL-NUMBER" use="optional"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Lambda"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/GaussianProcess.html#xsdElement_AbsoluteExponentialKernel
*/
type AbsoluteExponentialKernel struct {
Description *string `xml:"description,attr"`
Gamma *RealNumber `xml:"gamma,attr"`
NoiseVariance *RealNumber `xml:"noiseVariance,attr"`
Extensions []Extension `xml:"Extension"`
Lambda *Lambda `xml:"Lambda"`
}
type AggregateFunctionType string
const (
AggregateFunctionTypeAverage = AggregateFunctionType("average")
AggregateFunctionTypeCount = AggregateFunctionType("count")
AggregateFunctionTypeMax = AggregateFunctionType("max")
AggregateFunctionTypeMin = AggregateFunctionType("min")
AggregateFunctionTypeMultiset = AggregateFunctionType("multiset")
AggregateFunctionTypeSum = AggregateFunctionType("sum")
)
/*
Aggregate: Association rules and sequences refer to sets of items. These sets can be defined by an
aggregation over sets of input records. The records are grouped together by one of the fields and
the values in this grouping field partition the sets of records for an aggregation. This corresponds
to the conventional aggregation in SQL with a GROUP BY clause. Input records with missing value in
the groupField are simply ignored. This behavior is similar to the aggregate functions in the
presence of NULL values in SQL.
<xs:element name="Aggregate">
<xs:complexType>
<xs:attribute name="field" type="FIELD-NAME" use="required"/>
<xs:attribute name="function" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="average"/>
<xs:enumeration value="count"/>
<xs:enumeration value="max"/>
<xs:enumeration value="min"/>
<xs:enumeration value="multiset"/>
<xs:enumeration value="sum"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="groupField" type="FIELD-NAME"/>
<xs:attribute name="sqlWhere" type="xs:string"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/Transformations.html#xsdElement_Aggregate
*/
type Aggregate struct {
Field FieldName `xml:"field,attr"`
Function AggregateFunctionType `xml:"function,attr"`
GroupField FieldName `xml:"groupField,attr"`
SQLWhere string `xml:"sqlWhere,attr"`
Extensions []Extension `xml:"Extension"`
}
func (Aggregate) expression() {}
/*
Alternate indicates an alternate model in a BaselineModel TestDistribution.
<xs:element name="Alternate">
<xs:complexType>
<xs:choice>
<xs:group minOccurs="1" ref="CONTINUOUS-DISTRIBUTION-TYPES"/>
</xs:choice>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/BaselineModel.html#xsdElement_Alternate
*/
type Alternate struct {
Distribution ContinuousDistributionType
}
func (x *Alternate) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error {
var err error
defaults.SetDefaults(x)
for {
var token xml.Token
token, err = decoder.Token()
if err != nil {
return err
}
switch tok := token.(type) {
case xml.StartElement:
switch tok.Name.Local {
default:
if item, ok := GetContinuousDistributionType(tok.Name.Local); ok {
err = decoder.DecodeElement(item, &tok)
if err != nil {
return err
}
x.Distribution = item
}
}
case xml.EndElement:
return nil
}
}
}
/*
Annotation is where document modification history is embedded. Each annotation is free text and,
like the description attribute in the head element, makes sense to the human eye only. Users can
store their own remarks.
<xs:element name="Annotation">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/Header.html#xsdElement_Annotation
*/
type Annotation struct {
Data string `xml:",chardata"`
Extensions []Extension `xml:"Extension"`
}
/*
Anova represents Analysis of Variance information that, while descriptive in nature, can help
understand the relationship between certain independent variables and the target (dependent)
variable. Specifically, the analysis is performed using one independent categorical variable, X,
and a continuous target (dependent) variable, Y (usually found in types of regression and time
series models).
<xs:element name="Anova">
<xs:complexType>
<xs:attribute name="target" type="FIELD-NAME"/>
<xs:sequence>
<xs:element maxOccurs="3" minOccurs="3" ref="AnovaRow"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/Statistics.html#xsdElement_Anova
*/
type Anova struct {
Target FieldName `xml:"target,attr"`
Rows []AnovaRow `xml:"AnovaRow"`
Extensions []Extension `xml:"Extension"`
}
type AnovaRowType string
const (
AnovaRowTypeError = AnovaRowType("Error")
AnovaRowTypeModel = AnovaRowType("Model")
AnovaRowTypeTotal = AnovaRowType("Total")
)
/*
<xs:element name="AnovaRow">
<xs:complexType>
<xs:attribute name="degreesOfFreedom" type="NUMBER" use="required"/>
<xs:attribute name="fValue" type="NUMBER"/>
<xs:attribute name="meanOfSquares" type="NUMBER"/>
<xs:attribute name="pValue" type="PROB-NUMBER"/>
<xs:attribute name="sumOfSquares" type="NUMBER" use="required"/>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Error"/>
<xs:enumeration value="Model"/>
<xs:enumeration value="Total"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/Statistics.html#xsdElement_AnovaRow
*/
type AnovaRow struct {
DegreesOfFreedom Number `xml:"degreesOfFreedom,attr"`
FValue *Number `xml:"fValue,attr"`
MeanOfSquares *Number `xml:"meanOfSquares,attr"`
PValue *ProbNumber `xml:"pValue,attr"`
SumOfSquares Number `xml:"sumOfSquares,attr"`
Type AnovaRowType `xml:"type,attr"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="AntecedentSequence">
<xs:complexType>
<xs:sequence>
<xs:group ref="SEQUENCE"/>
</xs:sequence>
</xs:complexType>
</xs:element>
http://dmg.org/pmml/v4-3/Sequence.html#xsdElement_AntecedentSequence
*/
type AntecedentSequence SequenceGroup
/*
<xs:element name="AnyDistribution">
<xs:complexType>
<xs:attribute name="mean" type="REAL-NUMBER" use="required"/>
<xs:attribute name="variance" type="REAL-NUMBER" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type AnyDistribution struct {
Mean RealNumber `xml:"mean,attr"`
Variance RealNumber `xml:"variance,attr"`
Extensions []Extension `xml:"Extension"`
}
func (*AnyDistribution) continuousDistributionType() {}
/*
<xs:element name="Application">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="version" type="xs:string"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Application struct {
Name string `xml:"name,attr"`
Version string `xml:"version,attr"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Apply">
<xs:complexType>
<xs:attribute name="defaultValue" type="xs:string"/>
<xs:attribute name="function" type="xs:string" use="required"/>
<xs:attribute default="returnInvalid" name="invalidValueTreatment" type="INVALID-VALUE-TREATMENT-METHOD"/>
<xs:attribute name="mapMissingTo" type="xs:string"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:group maxOccurs="unbounded" minOccurs="0" ref="EXPRESSION"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Apply struct {
DefaultValue *string `xml:"defaultValue,attr"`
Function string `xml:"function,attr"`
InvalidValueTreatment InvalidValueTreatmentMethod `xml:"returnInvalid,attr" default:"returnInvalid"`
MapMissingTo *string `xml:"mapMissingTo,attr"`
Extensions []Extension `xml:"Extension"`
Expressions []Expression
}
func (*Apply) expression() {}
func (x *Apply) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error {
var err error
defaults.SetDefaults(x)
for _, attr := range start.Attr {
switch attr.Name.Local {
case "defaultValue":
val := attr.Value
x.DefaultValue = &val
case "function":
x.Function = attr.Value
case "returnInvalid":
if attr.Value != "" {
x.InvalidValueTreatment = InvalidValueTreatmentMethod(attr.Value)
}
case "mapMissingTo":
val := attr.Value
x.MapMissingTo = &val
}
}
for {
var token xml.Token
token, err = decoder.Token()
if err != nil {
return err
}
switch tok := token.(type) {
case xml.StartElement:
var item Expression
switch tok.Name.Local {
case "Extension":
var e Extension
err = decoder.DecodeElement(&e, &tok)
if err != nil {
return err
}
x.Extensions = append(x.Extensions, e)
case "Aggregate":
item = &Aggregate{}
case "Apply":
item = &Apply{}
case "Constant":
item = &Constant{}
case "Discretize":
item = &Discretize{}
case "FieldRef":
item = &FieldRef{}
case "Lag":
item = &Lag{}
case "MapValues":
item = &MapValues{}
case "NormContinuous":
item = &NormContinuous{}
case "NormDiscrete":
item = &NormDiscrete{}
case "TextIndex":
item = &TextIndex{}
}
if item != nil {
err = decoder.DecodeElement(item, &tok)
if err != nil {
return err
}
x.Expressions = append(x.Expressions, item)
}
case xml.EndElement:
return nil
}
}
}
/*
<xs:element name="Array" type="ArrayType"/>
*/
type Array ArrayType
/*
<xs:element name="AssociationModel">
<xs:complexType>
<xs:attribute name="algorithmName" type="xs:string"/>
<xs:attribute name="avgNumberOfItemsPerTA" type="REAL-NUMBER"/>
<xs:attribute name="functionName" type="MINING-FUNCTION" use="required"/>
<xs:attribute default="true" name="isScorable" type="xs:boolean"/>
<xs:attribute name="lengthLimit" type="INT-NUMBER"/>
<xs:attribute name="maxNumberOfItemsPerTA" type="INT-NUMBER"/>
<xs:attribute name="minimumConfidence" type="PROB-NUMBER" use="required"/>
<xs:attribute name="minimumSupport" type="PROB-NUMBER" use="required"/>
<xs:attribute name="modelName" type="xs:string"/>
<xs:attribute name="numberOfItems" type="INT-NUMBER" use="required"/>
<xs:attribute name="numberOfItemsets" type="INT-NUMBER" use="required"/>
<xs:attribute name="numberOfRules" type="INT-NUMBER" use="required"/>
<xs:attribute name="numberOfTransactions" type="INT-NUMBER" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="AssociationRule"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Item"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Itemset"/>
<xs:element minOccurs="0" ref="LocalTransformations"/>
<xs:element ref="MiningSchema"/>
<xs:element minOccurs="0" ref="ModelStats"/>
<xs:element minOccurs="0" ref="ModelVerification"/>
<xs:element minOccurs="0" ref="Output"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type AssociationModel struct {
AlgorithmName string `xml:"algorithmName,attr"`
AvgNumberOfItemsPerTA float64 `xml:"avgNumberOfItemsPerTA,attr"`
FunctionName MiningFunction `xml:"functionName,attr"`
IsScorable bool `xml:"isScorable,attr"`
LengthLimit int `xml:"lengthLimit,attr"`
MaxNumberOfItemsPerTA int `xml:"maxNumberOfItemsTA,attr"`
MinimumConfidence float64 `xml:"minimumConfidence,attr"`
MinimumSupport float64 `xml:"minimumSupport,attr"`
ModelName string `xml:"modelName,attr"`
NumberOfItems int `xml:"numberOfItems,attr"`
NumberOfItemsets int `xml:"numberOfItemsets,attr"`
NumberOfRules int `xml:"numberOfRules,attr"`
NumberOfTransactions int `xml:"numberOfTransactions,attr"`
AssociationRules []AssociationRule `xml:"AssociationRule"`
Items []Item `xml:"Item"`
Itemsets []Itemset `xml:"Itemset"`
LocalTransformations LocalTransformations `xml:"LocalTransformations"`
MiningSchema MiningSchema `xml:"MiningSchema"`
ModelStats ModelStats `xml:"ModelStats"`
ModelVerification ModelVerification `xml:"ModelVerification"`
Output Output `xml:"Output"`
Extensions []Extension `xml:"Extension"`
}
func (*AssociationModel) modelElement() {}
/*
<xs:element name="AssociationRule">
<xs:complexType>
<xs:attribute name="affinity" type="PROB-NUMBER" use="optional"/>
<xs:attribute name="antecedent" type="xs:string" use="required"/>
<xs:attribute name="confidence" type="PROB-NUMBER" use="required"/>
<xs:attribute name="consequent" type="xs:string" use="required"/>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="leverage" type="xs:float" use="optional"/>
<xs:attribute name="lift" type="xs:float" use="optional"/>
<xs:attribute name="support" type="PROB-NUMBER" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type AssociationRule struct {
Affinity float64 `xml:"affinity,attr"`
Antecedent string `xml:"antecedent,attr"`
Confidence float64 `xml:"confidence,attr"`
Consequent string `xml:"consequent,attr"`
ID string `xml:"id,attr"`
Leverage float64 `xml:"leverage,attr"`
Lift float64 `xml:"lift,attr"`
Support float64 `xml:"support,attr"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Attribute">
<xs:complexType>
<xs:attribute name="partialScore" type="NUMBER" use="optional"/>
<xs:attribute name="reasonCode" type="xs:string"/>
<xs:sequence>
<xs:element minOccurs="0" ref="ComplexPartialScore"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:group ref="PREDICATE"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Attribute struct {
PartialScore float64 `xml:"partialScore,attr"`
ReasonCode string `xml:"reasonCode,attr"`
ComplexPartialScore ComplexPartialScore `xml:"ComplexPartialScore"`
Predicate Predicate `xml:"Predicate"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BaseCumHazardTables">
<xs:complexType>
<xs:attribute name="maxTime" type="REAL-NUMBER" use="optional"/>
<xs:sequence>
<xs:choice>
<xs:element maxOccurs="unbounded" ref="BaselineCell"/>
<xs:element maxOccurs="unbounded" ref="BaselineStratum"/>
</xs:choice>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BaseCumHazardTables struct {
MaxTime float64 `xml:"maxTime,attr"`
BaselineCells []BaselineCell `xml:"BaselineCell"`
BaselineStratums []BaselineStratum `xml:"BaselineStratum"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BaselineCell">
<xs:complexType>
<xs:attribute name="cumHazard" type="REAL-NUMBER" use="required"/>
<xs:attribute name="time" type="REAL-NUMBER" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BaselineCell struct {
CumHazard float64 `xml:"cumHazard,attr"`
Time float64 `xml:"time"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BaselineModel">
<xs:complexType>
<xs:attribute name="algorithmName" type="xs:string" use="optional"/>
<xs:attribute name="functionName" type="MINING-FUNCTION" use="required"/>
<xs:attribute default="true" name="isScorable" type="xs:boolean" use="optional"/>
<xs:attribute name="modelName" type="xs:string" use="optional"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element minOccurs="0" ref="LocalTransformations"/>
<xs:element ref="MiningSchema"/>
<xs:element minOccurs="0" ref="ModelExplanation"/>
<xs:element minOccurs="0" ref="ModelStats"/>
<xs:element minOccurs="0" ref="ModelVerification"/>
<xs:element minOccurs="0" ref="Output"/>
<xs:element minOccurs="0" ref="Targets"/>
<xs:element ref="TestDistributions"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BaselineModel struct {
AlgorithmName string `xml:"algorithmName,attr"`
FunctionName MiningFunction `xml:"functionName,attr"`
IsScorable bool `xml:"isScorable,attr" default:"true"`
ModelName string `xml:"modelName,attr"`
LocalTransformations *LocalTransformations `xml:"LocalTransformations"`
MiningSchema MiningSchema `xml:"MiningSchema"`
ModelExplanation *ModelExplanation `xml:"ModelExplanation"`
ModelVerification *ModelVerification `xml:"ModelVerification"`
Targets *Targets `xml:"Targets"`
Output *Output `xml:"Output"`
ModelStats *ModelStats `xml:"ModelStats"`
Extensions []Extension `xml:"Extension"`
}
func (*BaselineModel) modelElement() {}
/*
<xs:element name="BaselineStratum">
<xs:complexType>
<xs:attribute name="label" type="xs:string"/>
<xs:attribute name="maxTime" type="REAL-NUMBER" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="BaselineCell"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BaselineStratum struct {
Label string `xml:"label,attr"`
MaxTime RealNumber `xml:"maxTime,attr"`
Value string `xml:"value,attr"`
BaselineCell []BaselineCell `xml:"BaselineCell"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Baseline">
<xs:complexType>
<xs:choice>
<xs:group minOccurs="1" ref="CONTINUOUS-DISTRIBUTION-TYPES"/>
<xs:group minOccurs="1" ref="DISCRETE-DISTRIBUTION-TYPES"/>
</xs:choice>
</xs:complexType>
</xs:element>
*/
type Baseline struct {
}
/*
<xs:element name="BayesInput">
<xs:complexType>
<xs:attribute name="fieldName" type="xs:string" use="required"/>
<xs:sequence>
<xs:choice>
<xs:element maxOccurs="1" minOccurs="1" ref="TargetValueStats"/>
<xs:sequence>
<xs:element maxOccurs="1" minOccurs="0" ref="DerivedField"/>
<xs:element maxOccurs="unbounded" minOccurs="1" ref="PairCounts"/>
</xs:sequence>
</xs:choice>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BayesInput struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BayesInputs">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="BayesInput"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BayesInputs struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BayesOutput">
<xs:complexType>
<xs:attribute name="fieldName" type="xs:string" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element ref="TargetValueCounts"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BayesOutput struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BayesianNetworkModel">
<xs:complexType>
<xs:attribute name="algorithmName" type="xs:string"/>
<xs:attribute name="functionName" type="MINING-FUNCTION" use="required"/>
<xs:attribute default="true" name="isScorable" type="xs:boolean"/>
<xs:attribute name="modelName" type="xs:string"/>
<xs:sequence>
<xs:element minOccurs="1" ref="BayesianNetworkNodes"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element minOccurs="0" ref="LocalTransformations"/>
<xs:element ref="MiningSchema"/>
<xs:element minOccurs="0" ref="ModelExplanation"/>
<xs:element minOccurs="0" ref="ModelStats"/>
<xs:element minOccurs="0" ref="ModelVerification"/>
<xs:element minOccurs="0" ref="Output"/>
<xs:element minOccurs="0" ref="Targets"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BayesianNetworkModel struct {
AlgorithmName string `xml:"algorithmName,attr"`
FunctionName MiningFunction `xml:"functionName,attr"`
IsScorable bool `xml:"isScorable,attr" default:"true"`
ModelName string `xml:"modelName,attr"`
BayesianNetworkNodes BayesianNetworkNodes `xml:"BayesianNetworkNodes"`
LocalTransformations *LocalTransformations `xml:"LocalTransformations"`
MiningSchema MiningSchema `xml:"MiningSchema"`
ModelExplanation *ModelExplanation `xml:"ModelExplanation"`
ModelStats *ModelStats `xml:"ModelStats"`
ModelVerification *ModelVerification `xml:"ModelVerification"`
Output *Output `xml:"Output"`
Targets *Targets `xml:"Targets"`
Extensions []Extension `xml:"Extension"`
}
func (*BayesianNetworkModel) modelElement() {}
/*
<xs:element name="BayesianNetworkNodes">
<xs:complexType>
<xs:sequence>
<xs:choice maxOccurs="unbounded">
<xs:element ref="ContinuousNode"/>
<xs:element ref="DiscreteNode"/>
</xs:choice>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BayesianNetworkNodes struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BlockIndicator">
<xs:complexType>
<xs:attribute name="field" type="FIELD-NAME" use="required"/>
</xs:complexType>
</xs:element>
*/
type BlockIndicator struct {
Field FieldName `xml:"field,attr"`
}
/*
<xs:element name="BoundaryValueMeans">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:group ref="NUM-ARRAY"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BoundaryValueMeans struct {
NumArray NumArray `xml:"Array"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="BoundaryValues">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:group ref="NUM-ARRAY"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type BoundaryValues struct {
NumArray NumArray `xml:"Array"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="CategoricalPredictor">
<xs:complexType>
<xs:attribute name="coefficient" type="REAL-NUMBER" use="required"/>
<xs:attribute name="name" type="FIELD-NAME" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type CategoricalPredictor struct {
Coefficient RealNumber `xml:"coefficient,attr"`
Name FieldName `xml:"fieldName,attr"`
Value string `xml:"value,attr"`
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Categories">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="1" ref="Category"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Categories struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Category">
<xs:complexType>
<xs:attribute name="value" type="xs:string" use="required"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Category struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Characteristic">
<xs:complexType>
<xs:attribute name="baselineScore" type="NUMBER"/>
<xs:attribute name="name" type="FIELD-NAME" use="optional"/>
<xs:attribute name="reasonCode" type="xs:string"/>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Attribute"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Characteristic struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Characteristics">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Characteristic"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type Characteristics struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="ChildParent">
<xs:complexType>
<xs:attribute name="childField" type="xs:string" use="required"/>
<xs:attribute default="no" name="isRecursive" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="no"/>
<xs:enumeration value="yes"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="parentField" type="xs:string" use="required"/>
<xs:attribute name="parentLevelField" type="xs:string" use="optional"/>
<xs:sequence>
<xs:choice>
<xs:element ref="InlineTable"/>
<xs:element ref="TableLocator"/>
</xs:choice>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="FieldColumnPair"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type ChildParent struct {
ChildField string `xml:"childField,attr"`
IsRecursive bool `xml:"isRecursive,attr"`
ParentField string `xml:"parentField,attr"`
ParentLevelField string `xml:"parentLevelField,attr"`
Table Table
Extensions []Extension `xml:"Extension"`
FieldColumnPairs []FieldColumnPair `xml:"FieldColumnPair"`
}
// UnmarshalXML implements the xml.Unmarshaler interface.
func (x *ChildParent) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error {
defaults.SetDefaults(x)
for _, attr := range start.Attr {
switch attr.Name.Local {
case "childField":
x.ChildField = attr.Value
case "isRecursive":
if attr.Value == "yes" {
x.IsRecursive = true
} else if attr.Value == "no" {
x.IsRecursive = false
} else {
return errors.Errorf("invalid value for isRecursive: %s", attr.Value)
}
case "parentField":
x.ParentField = attr.Value
case "parentLevelField":
x.ParentLevelField = attr.Value
}
}
for {
token, err := decoder.Token()
if err != nil {
return err
}
switch tok := token.(type) {
case xml.StartElement:
var item Table
switch tok.Name.Local {
case "Extension":
var e Extension
err = decoder.DecodeElement(&e, &tok)
if err != nil {
return err
}
x.Extensions = append(x.Extensions, e)
case "FieldColumnPair":
var e FieldColumnPair
err = decoder.DecodeElement(&e, &tok)
if err != nil {
return err
}
x.FieldColumnPairs = append(x.FieldColumnPairs, e)
case "InlineTable":
item = &InlineTable{}
case "TableLocator":
item = &TableLocator{}
}
if item != nil {
err = decoder.DecodeElement(item, &tok)
if err != nil {
return err
}
x.Table = item
}
case xml.EndElement:
return nil
}
}
}
/*
<xs:element name="ClassLabels">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>
<xs:group ref="STRING-ARRAY"/>
</xs:sequence>
</xs:complexType>
</xs:element>
*/
type ClassLabels struct {
Extensions []Extension `xml:"Extension"`
}
/*
<xs:element name="Cluster">
<xs:complexType>
<xs:attribute name="id" type="xs:string" use="optional"/>
<xs:attribute name="name" type="xs:string" use="optional"/>
<xs:attribute name="size" type="xs:nonNegativeInteger" use="optional"/>
<xs:sequence>
<xs:element minOccurs="0" ref="Covariances"/>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="Extension"/>