MCPcopy Create free account
hub / github.com/audeering/opensmile / myFinaliseInstance

Method myFinaliseInstance

src/classifiers/svmSink.cpp:849–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847
848
849int cSvmSink::myFinaliseInstance()
850{
851 int ret = cDataSink::myFinaliseInstance();
852
853 if ((ret)&&(model != NULL)) {
854 modelObj = new smileSvmModel((cSmileComponent*)this, model);
855 if (getInt("showStatsDebug")) {
856 modelObj->setStatsDebug();
857 }
858 if (ignoreLogitModel) {
859 modelObj->setIgnoreLogitModel();
860 }
861 ret = modelObj->load();
862 if (!ret) {
863 delete modelObj;
864 modelObj = NULL;
865 } else {
866 // build feature mapping table
867 SMILE_IMSG(3, "Building feature index mapping table...");
868 int N = reader_->getLevelN();
869 for (int i = 0; i < N; i++) {
870 char * name = reader_->getElementName(i);
871 if (name == NULL) {
872 SMILE_IERR(2, "Cannot get name from input level for element # %i! Thus, cannot compute feature mapping. Unless the features in the model file are in exact the same order as in the input level (and none are missing in the model), the result of SVMSINK WILL PROBABLY BE WRONG!!", i);
873 } else {
874 modelObj->buildFtSelMap(i, name);
875 free(name);
876 }
877 }
878 if (!modelObj->checkFtSelMap()) {
879 delete modelObj;
880 modelObj = NULL;
881 ret = 0;
882 SMILE_IERR(1, "Aborting due to missing attributes in input level!");
883 }
884 SMILE_IMSG(3, "Done with building feature index mapping table.");
885 }
886
887 if (saveResult) {
888 bool doAppend = false;
889 FILE *f = NULL;
890 if (appendSaveResult_) {
891 f = fopen(resultFile, "r");
892 if (f != NULL) {
893 doAppend = true;
894 fclose(f);
895 }
896 }
897 if (doAppend)
898 f = fopen(resultFile, "a");
899 else
900 f = fopen(resultFile, "w");
901 if (f != NULL) {
902 if (!doAppend) {
903 if (instName_ != NULL) {
904 fprintf(f, "name;");
905 }
906 fprintf(f, "time;length;classindex;classname;confidence");

Callers

nothing calls this directly

Calls 9

setStatsDebugMethod · 0.80
setIgnoreLogitModelMethod · 0.80
buildFtSelMapMethod · 0.80
checkFtSelMapMethod · 0.80
getNclassesMethod · 0.80
classNameMethod · 0.80
loadMethod · 0.45
getLevelNMethod · 0.45
getElementNameMethod · 0.45

Tested by

no test coverage detected