MCPcopy Create free account
hub / github.com/apple/coremltools / generateInterface

Function generateInterface

mlmodel/tests/KNNValidatorTests.cpp:25–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 void setNumberOfNeighbors(Specification::KNearestNeighborsClassifier* nnModel, int numberOfNeighbors, bool forRange);
24
25 void generateInterface(Specification::Model& m1) {
26
27 m1.set_specificationversion(MLMODEL_SPECIFICATION_VERSION);
28 Specification::ModelDescription* interface = m1.mutable_description();
29 Specification::Metadata* metadata = interface->mutable_metadata();
30 metadata->set_shortdescription(std::string("Testing nearest neighbor validator"));
31
32 Specification::FeatureDescription *input = interface->add_input();
33 Specification::FeatureType* inputType = new Specification::FeatureType;
34 inputType->mutable_multiarraytype()->mutable_shape()->Add(4);
35 inputType->mutable_multiarraytype()->set_datatype(::CoreML::Specification::ArrayFeatureType_ArrayDataType_FLOAT32);
36 input->set_name("input");
37 input->set_allocated_type(inputType);
38
39 Specification::FeatureDescription *output = interface->add_output();
40 Specification::FeatureType* outputType = new Specification::FeatureType;
41 outputType->mutable_stringtype();
42 output->set_name("output");
43 output->set_allocated_type(outputType);
44
45 interface->set_predictedfeaturename("output");
46
47 }
48
49 void addDataPoints(Specification::KNearestNeighborsClassifier* nnModel) {
50

Calls 2

AddMethod · 0.45
set_nameMethod · 0.45

Tested by

no test coverage detected