Skip to content

Commit 631e1be

Browse files
committed
update ModelJSON
1 parent 19afb5e commit 631e1be

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

SVMClassifier/ModelJSON.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ public Classifier(List<ModelJSON> models, double[,] normalization)
1212
Models = models;
1313
Normalization = normalization;
1414
}
15+
16+
public Classifier(ModelJSON model, double[,] normalization)
17+
{
18+
Models = new List<ModelJSON>
19+
{
20+
model
21+
};
22+
23+
Normalization = normalization;
24+
}
1525
}
1626

1727
public class ModelJSON

SVMClassifier/Utility.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ public static string Serialize(List<Model> models, ManagedArray normalizationDat
3535
return output;
3636
}
3737

38+
public static string Serialize(Model model, double[,] normalization)
39+
{
40+
var classifier = new Classifier(Convert(model), normalization);
41+
42+
string output = JsonConvert.SerializeObject(classifier);
43+
44+
return output;
45+
}
46+
3847
public static ModelJSON Convert(Model model)
3948
{
4049
var json = new ModelJSON

0 commit comments

Comments
 (0)