Commits

Jian Zhou committed 4538841

restore default behavior of CSVMPERF::WriteModel

Comments (0)

Files changed (8)

 		structmodel = read_struct_model(model_file, &struct_parm);
 	}
 
-	void WriteModel(char* model_file, int simple_model_flag) {
+	void WriteModel(char* model_file, int simple_model_flag = 1) {
 		if (kernel_parm.kernel_type == LINEAR && simple_model_flag) {
 			ofstream ofsm;
 			ofsm.open(model_file);
 			int mark=1;
 			ss << GeneName << '\t';
 			for(size_t j=0;j<num_class;j++){
-				if(TargetM[j])
+				if(TargetM[j]==1)
 					if(mark){
 						if(returnindex)
 							ss<<j;
 
 			mark=1;
 			for(size_t j=0;j<num_class;j++){
-				if(ValueM[j])
+				if(ValueM[j]==1)
 					if(mark){
 						if(returnindex)
 							ss<<j;
 
 		void ReadModel(char* model_file) {
 			structmodel = read_struct_model(model_file, &struct_parm);
-			if(structmodel.svm_model->kernel_parm.kernel_type == LINEAR) { /* linear kernel */
-				/* compute weight vector */
-				add_weight_vector_to_linear_model(structmodel.svm_model);
-				structmodel.w=structmodel.svm_model->lin_weights;
+			if(structmodel.svm_model->kernel_parm.kernel_type == LINEAR) { /* linear kernel */
+				/* compute weight vector */
+				add_weight_vector_to_linear_model(structmodel.svm_model);
+				structmodel.w=structmodel.svm_model->lin_weights;
 			}
 		}
 

src/svmstructtree.cpp

 	//	void set_struct_verbosity(long verb);
 
 	//}
-	
+
 	void CSVMSTRUCTTREE::SetVerbosity(size_t V) {
 		struct_verbosity = (long) V;
 		//if( struct_verbosity>1)
 		ifstream ifsm;
 		ifsm.clear();
 		ifsm.open(treefile);
-		if (!ifsm.is_open())
+		if (!ifsm.is_open()){
 			cerr << "Could not read Onto file" << endl;
-
+			exit(1);
+		}
 		static const size_t c_iBuffer = 1024; //change this if not enough
 		char acBuffer[c_iBuffer];
 		vector<string> vecstrTokens;
 		return pRet;
 	}
 
+	
+//DOC* CSVMSTRUCTTREE::CreateDoc(Sleipnir::CDat& Dat, size_t iGene, size_t iDoc) {
+//	WORD* aWords;
+//	size_t i, j, iWord, iWords;
+//	float d;
+//	DOC* pRet;
+//	pRet->fvec->words[0].weight;
+//	//get number of features
+//	iWords = Dat.GetGenes();
+//	//      cout << "CD:iwords=" << iWords << endl;
+//	aWords = new WORD[iWords + 1];
+//	//number the words
+//	for (i = 0; i < iWords; ++i) {
+//		//   cout<<i<<endl;
+//		aWords[i].wnum = i + 1;
+//		// asWords[ i ].wnum = 0;
+//	}
+//	aWords[i].wnum = 0;
+//	//get the values;
+//	iWord = 0;
+//	for (i = 0; i < Dat.GetGenes(); i++) {
+//		if (!Sleipnir::CMeta::IsNaN(d = Dat.Get(iGene, i))) {
+//			//   if (i==0 && j==0)
+//			//       cout<<"First value is "<<d<<endl;
+//			aWords[iWord].weight = d;
+//		} else
+//			aWords[iWord].weight = 0;
+//		iWord++;
+//	}
+//	pRet = create_example(iDoc, 0, 0, 1, create_svector(aWords, "", 1));
+//	delete[] aWords;
+//	// cout<<"done creating DOC"<<endl;
+//	return pRet;
+//}
 
 
 	vector<SVMLabel> CSVMSTRUCTTREE::ReadLabels(ifstream & ifsm) {
 			multilabels[0]=1; //root node is always on
 			for(int i=1; i < vecstrTokens.size();i++){
 				it =  onto_map.find(vecstrTokens[i]);
-				if(it == onto_map.end())
-					cerr<< "Unknown term: "<<vecstrTokens[i]<<endl;
+				if(it == onto_map.end()){
+					if(struct_verbosity>=2)
+						cerr<< "Unknown term: "<<vecstrTokens[i]<<endl;
+				}
 				else{
 					multilabels[onto_map[vecstrTokens[i]]]=1; 
 					struct_parm.treeStruct.nodes[ onto_map[vecstrTokens[i]] ]->inputlabelCount++;
 						cout<<vecstrTokens[0]<<'\t'<<vecstrTokens[i];
 					//label propagation; add print propagation process
 					pnode=struct_parm.treeStruct.nodes[onto_map[vecstrTokens[i]]]->parent;		
-					while(pnode){
+					while(pnode && multilabels[pnode->index]!=1){
 						multilabels[pnode->index]=1;
 						struct_parm.treeStruct.nodes[pnode->index]->inputlabelCount++;
 						if(struct_verbosity>=3)	
 					if(struct_verbosity>=3)
 						cout<<endl;
 					//end label propagation
-					
+
 				}
 			}
+			preprocessLabel(&multilabels);
 			vecLabels.push_back(SVMArc::SVMLabel(vecstrTokens[0], multilabels));
 		}
 		return vecLabels;
 	}
 
+	void CSVMSTRUCTTREE::preprocessLabel(vector<char>* multilabels){
+		int i,iclass,flag_childrenannotated;
+		for ( iclass=0; iclass < multilabels->size();iclass++){
+			if((*multilabels)[iclass]==1){
+				flag_childrenannotated = 0;
+				for( i=0; i<struct_parm.treeStruct.nodes[iclass]->n_children; i++){
+					if((*multilabels)[struct_parm.treeStruct.nodes[iclass]->children[i]->index]==1){
+						flag_childrenannotated=1;
+						break;
+					}
+				}
+				if(flag_childrenannotated==0){
+					vecsetZero(struct_parm.treeStruct.nodes[iclass],multilabels,2);
+					(*multilabels)[iclass]=1;	
+				}
+			}
+		}
+
+
+	}
+
+	void CSVMSTRUCTTREE::vecsetZero (ONTONODE* node, vector<char>* ybar0,char zero) {
+		//printf("setZero\n");
+
+		int i;
+		if((*ybar0)[node->index]!=zero){
+			(*ybar0)[node->index] = zero;
+			for(i=0; i < node->n_children; i++)
+				if((*ybar0)[node->children[i]->index]!=zero)
+					vecsetZero(node->children[i], ybar0,zero);
+		}
+	}
+
 	void CSVMSTRUCTTREE::InitializeLikAfterReadLabels() {
 		struct_parm.condLikelihood = (double*)my_malloc(sizeof(double)*struct_parm.num_classes);
 		struct_parm.condLikelihood[0] = 0; // now the first term in ontofile has to be the 'head node', change this to make code more robust
 		for(int i=1; i<struct_parm.num_classes;i++){
-			struct_parm.condLikelihood[i] = log(struct_parm.treeStruct.nodes[i]->parent->inputlabelCount) 
-				- log(struct_parm.treeStruct.nodes[i]->inputlabelCount);
+			if(struct_parm.treeStruct.nodes[i]->inputlabelCount>0){
+				struct_parm.treeStruct.nodes[i]->posBalanceWeight =  (struct_parm.treeStruct.nodes[0]->inputlabelCount/2)/ struct_parm.treeStruct.nodes[i]->inputlabelCount;
+				struct_parm.treeStruct.nodes[i]->negBalanceWeight =  (struct_parm.treeStruct.nodes[0]->inputlabelCount/2)/ (struct_parm.treeStruct.nodes[0]->inputlabelCount-struct_parm.treeStruct.nodes[i]->inputlabelCount);
+			}else{
+				struct_parm.treeStruct.nodes[i]->posBalanceWeight = 0;
+				struct_parm.treeStruct.nodes[i]->negBalanceWeight = 0;
+			}
+			struct_parm.condLikelihood[i] = log(struct_parm.treeStruct.nodes[i]->parent->inputlabelCount + 1) 
+				- log(struct_parm.treeStruct.nodes[i]->inputlabelCount + 1);
 		}
 	}
 	SAMPLE* CSVMSTRUCTTREE::CreateSample(Sleipnir::CPCL &PCL, vector<SVMLabel> SVMLabels) {
 		//cerr<<"DONE CreateSample"<<endl;
 	}
 
+//
+//	SAMPLE* CSVMSTRUCTTREE::CreateSample(Sleipnir::CDat& Dat, vector<SVMLabel> SVMLabels) {
+//	size_t i, j, iGene, iDoc;
+//	vector<DOC*> vec_pDoc;
+//	vector<double> vecClass;
+//	vector<size_t> veciGene;
+//	iDoc = 0;
+//	float numPositives, numNegatives;
+//	numPositives = numNegatives = 0;
+//	for (i = 0; i < SVMLabels.size(); i++) {
+//		//     cout<< "processing gene " << SVMLabels[i].GeneName << endl;
+//		iGene = Dat.GetGene(SVMLabels[i].GeneName);
+//		//   cout << SVMLabels[i].GeneName<<" gene at location "<<iGene << endl;
+//		if (iGene != -1) {
+//			//       cout << "creating doc" << endl;
+//			iDoc++;
+//			vec_pDoc.push_back(CreateDoc(Dat, iGene, iDoc - 1));
+//			vecClass.push_back(SVMLabels[i].Target);
+//		}
+//	}
+//
+//	DOC** ppDoc;
+//	ppDoc = new DOC*[vec_pDoc.size()];
+//	copy(vec_pDoc.begin(), vec_pDoc.end(), ppDoc);
+//	vec_pDoc.clear();
+//	PATTERN* pPattern = new PATTERN;
+//	pPattern->doc = ppDoc;
+//
+//	pPattern->totdoc = iDoc;
+//	//   cout << "number of document=" << pPattern->totdoc << endl;
+//	LABEL* pLabel = new LABEL;
+//	double* aClass;
+//	aClass = new double[vecClass.size()];
+//	copy(vecClass.begin(), vecClass.end(), aClass);
+//	vecClass.clear();
+//	pLabel->Class = aClass;
+//	pLabel->totdoc = iDoc;
+//
+//	EXAMPLE* aExample;
+//	aExample = new EXAMPLE[1];
+//	//cout<<"aExample @"<<aExample<<endl;
+//	aExample[0].x = *pPattern;
+//	aExample[0].y = *pLabel;
+//	SAMPLE* pSample = new SAMPLE;
+//	pSample->n = 1;
+//	pSample->examples = aExample;
+//	/* cout << "examples @" << pSample->examples << endl;
+//	 cout<< "ppDoc="<<ppDoc<<endl;
+//	 cout << "docs @" << pSample->examples[0].x.doc << endl;
+//	 cout<<"done creating sample"<<endl;
+//	 cout<<"sample @ "<<pSample<<endl;*/
+//	return pSample;
+//}
+
 	//Single gene classification
 
 	vector<Result> CSVMSTRUCTTREE::Classify(Sleipnir::CPCL &PCL,

src/svmstructtree.h

 			Alg = alg;
 		}
 
-
+		void SetEpsilon(float eps) {
+			struct_parm.epsilon = eps;
+		}
 
 		void UseSlackRescaling() {
 			struct_parm.loss_type = SLACK_RESCALING;
 		void ReadModel(char* model_file) {
 
 			structmodel = read_struct_model(model_file, &struct_parm);
-			if(structmodel.svm_model->kernel_parm.kernel_type == LINEAR) { /* linear kernel */
-				/* compute weight vector */
-				add_weight_vector_to_linear_model(structmodel.svm_model);
-				structmodel.w=structmodel.svm_model->lin_weights;
+			if(structmodel.svm_model->kernel_parm.kernel_type == LINEAR) { /* linear kernel */
+				/* compute weight vector */
+				add_weight_vector_to_linear_model(structmodel.svm_model);
+				structmodel.w=structmodel.svm_model->lin_weights;
 			}
 		}
 
 		void ReadOntology(const char* treefile);
 		//creates a Doc for a given gene index in a single microarray
 		static DOC* CreateDoc(Sleipnir::CPCL &PCL, size_t iGene, size_t iDoc);
-
+		//static DOC* CreateDoc(Sleipnir::CDat& Dat, size_t iGene, size_t iDoc);
 		//read labels
 		vector<SVMLabel> ReadLabels(ifstream & ifsm);
+		void vecsetZero (ONTONODE* node, vector<char>* ybar0,char zero);
+		void preprocessLabel(vector<char>* multilabels);
+
 		void InitializeLikAfterReadLabels();
 		//Creates a sample using a single PCL and SVMlabels Looks up genes by name.
 		SAMPLE* CreateSample(Sleipnir::CPCL &PCL, vector<SVMLabel> SVMLabels);
+		//SAMPLE* CreateSample(Sleipnir::CDat& Dat, vector<SVMLabel> SVMLabels);
 
 		//Classify single genes
 		vector<Result> Classify(Sleipnir::CPCL& PCL, vector<SVMLabel> SVMLabels);
 	};
 
 
+				
+			
+
 };
 
 

tools/SVMhierarchy/SVMhierarchy.cpp

 	gengetopt_args_info sArgs;
 
 	CPCL PCL;
+	CDat DAT;
 	SVMArc::CSVMSTRUCTTREE SVM;
 
 	size_t i, j, k , iGene, jGene;
 	}
 
 	SVM.SetTradeoff(sArgs.tradeoff_arg);
-
+	SVM.SetEpsilon(sArgs.epsilon_arg);
 	if (sArgs.slack_flag)
 		SVM.UseSlackRescaling();
 	else
 	//  cout << "there are " << vecLabels.size() << " labels processed" << endl;
 	size_t iFile;
 	vector<string> PCLs;
+
 	if (sArgs.input_given) {
 		cerr << "Loading PCL file" << endl;
 		if (!PCL.Open(sArgs.input_arg, sArgs.skip_arg, sArgs.mmap_flag)) {
 			cerr << "Could not open input PCL" << endl;
-			return 1;
+			exit(1);
 		}
+		cerr << "PCL file Loaded" << endl;
 	}
-	cerr << "PCL file Loaded" << endl;
-
+	//else if (sArgs.dab_input_given){
+	//			cerr << "Loading DAT/DAB file" << endl;
+	//	if (!DAT.Open(sArgs.input_arg, !!sArgs.mmap_flag)) {
+	//		cerr << "Could not open input DAT/DAB file" << endl;
+	//		exit(1);
+	//	}
+	//}
+	//
+	//
 
 
 
 				SVM.PrintResults(AllResults, ofsm);
 			else {
 				cerr << "Could not open output file" << endl;
+				
 			}
 		}
 		else//read model and classify only test examples
 			SVM.ReadModel(sArgs.model_arg);
 			cerr << "Model Loaded" << endl;
 
-			pTestVector[0].reserve((size_t) vecLabels.size() + sArgs.cross_validation_arg);
+			pTestVector[0].reserve((size_t) vecLabels.size()+1 );
 			for (j = 0; j < vecLabels.size(); j++) {
 				pTestVector[0].push_back(vecLabels[j]);		      
 			}

tools/SVMhierarchy/SVMhierarchy.ggo

-package	"SVMhierarchy"
-version	"1.0"
-purpose	"Hierarchical Multilabel SVM powered by SVM-struct"
-
-section "Main"
-option	"labels"				l	"Labels file"
-										string	typestr="filename"	no
-option	"output"				o	"Output file "
-										string	typestr="filename"  no
-option	"input"					i	"Input PCL file "
-										string	typestr="filename"  yes
-option	"model"					m	"Model file"
-										string	typestr="filename"  no
-option	"test_labels"			T	"Test Labels file"
-										string	typestr="filename"	no
-option	"ontoparam"				h	"Ontology file"
-										string	typestr="filename"  no
-option  "all"       			a   "Always classify all genes in PCLs"  
-										flag off
-option  "slack"       			S   "Use slack rescaling (NOT implemented for Hierarchical Multilabel SVM)"
-										flag off
-
-section "Options"
-option "verbosity"  			v   "Sets the svm_struct verbosity"
-										int default="0" no
-option "skip"      				s   "Number of columns to skip in input pcls"
-										int default="2" no
-option	"normalize"				n	"Normalize PCLS to 0 mean 1 variance"
-										flag	off
-option	"cross_validation"		c	"Number of cross-validation sets ( arg of 1 will turn off cross-validation )"
-										int default="5" no
-option "loss_function" 		e   "Sets the loss function for SVM learning: Choice of:
-0\tHamming distance loss: total number of differences in label vector.
-1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-2\tLikelihood distance loss. 
-3\tLikelihood distance loss (modified). 
-\n" 
-										int default="0" no
-option "tradeoff"    			t   "SVM tradeoff constant C"
-										float default="1" no
-option "learning_algorithm" 		w   "Choice of structural learning algorithm:
-
-0\tn-slack algorithm 
-1\tn-slack algorithm with shrinking heuristic
-2\t1-slack algorithm (primal) 
-3\t1-slack algorithm (dual)
-4\t1-slack algorithm (dual) with constraint cache\n" 
-										int default="3" no
-option	"threads"		p	"number of threads (only apply to algorithm 3 currently)"
-										int default="4" no
-option	"mmap"					M	"Memory map binary input"
+package	"SVMhierarchy"
+version	"1.0"
+purpose	"Hierarchical Multilabel SVM powered by SVM-struct"
+
+section "Main"
+option	"labels"				l	"Labels file"
+										string	typestr="filename"	no
+option	"output"				o	"Output file "
+										string	typestr="filename"  no
+option	"input"					i	"Input PCL file "
+										string	typestr="filename"  yes
+option	"dab_input"				d	"Input Dat/Dab file "
+										string	typestr="filename"  yes
+option	"model"					m	"Model file"
+										string	typestr="filename"  no
+option	"test_labels"			T	"Test Labels file"
+										string	typestr="filename"	no
+option	"ontoparam"				h	"Ontology file"
+										string	typestr="filename"  no
+option  "all"       			a   "Always classify all genes in PCLs"  
+										flag off
+option  "slack"       			S   "Use slack rescaling (NOT implemented for Hierarchical Multilabel SVM)"
+										flag off
+
+section "Options"
+option "verbosity"  			v   "Sets the svm_struct verbosity"
+										int default="0" no
+option "skip"      				s   "Number of columns to skip in input pcls"
+										int default="2" no
+option	"normalize"				n	"Normalize PCLS to 0 mean 1 variance"
+										flag	off
+option	"cross_validation"		c	"Number of cross-validation sets ( arg of 1 will turn off cross-validation )"
+										int default="5" no
+option "loss_function" 		e   "Sets the loss function for SVM learning: Choice of:
+0\tHamming distance loss: total number of differences in label vector.
+1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+2\tLikelihood distance loss. 
+3\tLikelihood distance loss (modified). 
+\n" 
+										int default="0" no
+option "tradeoff"    			t   "SVM tradeoff constant C"
+										float default="1" no
+option "epsilon"    			E   "allow that tolerance for termination criterion"
+										float default="0.1" no
+option "learning_algorithm" 		w   "Choice of structural learning algorithm (default 4):
+0\tn-slack algorithm 
+1\tn-slack algorithm with shrinking heuristic
+2\t1-slack algorithm (primal) 
+3\t1-slack algorithm (dual)
+4\t1-slack algorithm (dual) with constraint cache\n" 
+										int default="3" no
+option	"threads"		p	"number of threads (only apply to algorithm 3 currently)"
+										int default="4" no
+option	"mmap"					M	"Memory map binary input"
 										flag	off

tools/SVMhierarchy/cmdline.c

   "  -l, --labels=filename         Labels file",
   "  -o, --output=filename         Output file ",
   "  -i, --input=filename          Input PCL file ",
+  "  -d, --dab_input=filename      Input Dat/Dab file ",
   "  -m, --model=filename          Model file",
   "  -T, --test_labels=filename    Test Labels file",
   "  -h, --ontoparam=filename      Ontology file",
   "  -s, --skip=INT                Number of columns to skip in input pcls  \n                                  (default=`2')",
   "  -n, --normalize               Normalize PCLS to 0 mean 1 variance  \n                                  (default=off)",
   "  -c, --cross_validation=INT    Number of cross-validation sets ( arg of 1 will \n                                  turn off cross-validation )  (default=`5')",
-  "  -e, --loss_function=INT       Sets the loss function for SVM learning: Choice \n                                  of:\n                                  0\tHamming distance loss: total number of \n                                  differences in label vector.\n                                  1\tHamming distance loss (modified): total \n                                  number of differences in label vector; \n                                  over-annotation not counted as difference. \n                                  2\tLikelihood distance loss. \n                                  3\tLikelihood distance loss (modified). \n                                  \n                                    (default=`0')",
+  "  -e, --loss_function=INT       Sets the loss function for SVM learning: Choice \n                                  of:\n\n                                  0\tHamming distance loss: total number of \n                                  differences in label vector.\n\n                                  1\tHamming distance loss (modified): total \n                                  number of differences in label vector; \n                                  over-annotation not counted as difference. \n\n                                  2\tLikelihood distance loss. \n\n                                  3\tLikelihood distance loss (modified). \n\n                                  \n                                    (default=`0')",
   "  -t, --tradeoff=FLOAT          SVM tradeoff constant C  (default=`1')",
-  "  -w, --learning_algorithm=INT  Choice of structural learning algorithm:\n                                  0\tn-slack algorithm \n                                  1\tn-slack algorithm with shrinking heuristic\n                                  2\t1-slack algorithm (primal) \n                                  3\t1-slack algorithm (dual)\n                                  4\t1-slack algorithm (dual) with constraint \n                                  cache\n                                    (default=`3')",
+  "  -E, --epsilon=FLOAT           allow that tolerance for termination criterion  \n                                  (default=`0.1')",
+  "  -w, --learning_algorithm=INT  Choice of structural learning algorithm \n                                  (default 4):\n\n                                  0\tn-slack algorithm \n\n                                  1\tn-slack algorithm with shrinking heuristic\n\n                                  2\t1-slack algorithm (primal) \n\n                                  3\t1-slack algorithm (dual)\n\n                                  4\t1-slack algorithm (dual) with constraint \n                                  cache\n                                    (default=`3')",
   "  -p, --threads=INT             number of threads (only apply to algorithm 3 \n                                  currently)  (default=`4')",
   "  -M, --mmap                    Memory map binary input  (default=off)",
     0
   args_info->labels_given = 0 ;
   args_info->output_given = 0 ;
   args_info->input_given = 0 ;
+  args_info->dab_input_given = 0 ;
   args_info->model_given = 0 ;
   args_info->test_labels_given = 0 ;
   args_info->ontoparam_given = 0 ;
   args_info->cross_validation_given = 0 ;
   args_info->loss_function_given = 0 ;
   args_info->tradeoff_given = 0 ;
+  args_info->epsilon_given = 0 ;
   args_info->learning_algorithm_given = 0 ;
   args_info->threads_given = 0 ;
   args_info->mmap_given = 0 ;
   args_info->output_orig = NULL;
   args_info->input_arg = NULL;
   args_info->input_orig = NULL;
+  args_info->dab_input_arg = NULL;
+  args_info->dab_input_orig = NULL;
   args_info->model_arg = NULL;
   args_info->model_orig = NULL;
   args_info->test_labels_arg = NULL;
   args_info->loss_function_orig = NULL;
   args_info->tradeoff_arg = 1;
   args_info->tradeoff_orig = NULL;
+  args_info->epsilon_arg = 0.1;
+  args_info->epsilon_orig = NULL;
   args_info->learning_algorithm_arg = 3;
   args_info->learning_algorithm_orig = NULL;
   args_info->threads_arg = 4;
   args_info->labels_help = gengetopt_args_info_help[3] ;
   args_info->output_help = gengetopt_args_info_help[4] ;
   args_info->input_help = gengetopt_args_info_help[5] ;
-  args_info->model_help = gengetopt_args_info_help[6] ;
-  args_info->test_labels_help = gengetopt_args_info_help[7] ;
-  args_info->ontoparam_help = gengetopt_args_info_help[8] ;
-  args_info->all_help = gengetopt_args_info_help[9] ;
-  args_info->slack_help = gengetopt_args_info_help[10] ;
-  args_info->verbosity_help = gengetopt_args_info_help[12] ;
-  args_info->skip_help = gengetopt_args_info_help[13] ;
-  args_info->normalize_help = gengetopt_args_info_help[14] ;
-  args_info->cross_validation_help = gengetopt_args_info_help[15] ;
-  args_info->loss_function_help = gengetopt_args_info_help[16] ;
-  args_info->tradeoff_help = gengetopt_args_info_help[17] ;
-  args_info->learning_algorithm_help = gengetopt_args_info_help[18] ;
-  args_info->threads_help = gengetopt_args_info_help[19] ;
-  args_info->mmap_help = gengetopt_args_info_help[20] ;
+  args_info->dab_input_help = gengetopt_args_info_help[6] ;
+  args_info->model_help = gengetopt_args_info_help[7] ;
+  args_info->test_labels_help = gengetopt_args_info_help[8] ;
+  args_info->ontoparam_help = gengetopt_args_info_help[9] ;
+  args_info->all_help = gengetopt_args_info_help[10] ;
+  args_info->slack_help = gengetopt_args_info_help[11] ;
+  args_info->verbosity_help = gengetopt_args_info_help[13] ;
+  args_info->skip_help = gengetopt_args_info_help[14] ;
+  args_info->normalize_help = gengetopt_args_info_help[15] ;
+  args_info->cross_validation_help = gengetopt_args_info_help[16] ;
+  args_info->loss_function_help = gengetopt_args_info_help[17] ;
+  args_info->tradeoff_help = gengetopt_args_info_help[18] ;
+  args_info->epsilon_help = gengetopt_args_info_help[19] ;
+  args_info->learning_algorithm_help = gengetopt_args_info_help[20] ;
+  args_info->threads_help = gengetopt_args_info_help[21] ;
+  args_info->mmap_help = gengetopt_args_info_help[22] ;
   
 }
 
   free_string_field (&(args_info->output_orig));
   free_string_field (&(args_info->input_arg));
   free_string_field (&(args_info->input_orig));
+  free_string_field (&(args_info->dab_input_arg));
+  free_string_field (&(args_info->dab_input_orig));
   free_string_field (&(args_info->model_arg));
   free_string_field (&(args_info->model_orig));
   free_string_field (&(args_info->test_labels_arg));
   free_string_field (&(args_info->cross_validation_orig));
   free_string_field (&(args_info->loss_function_orig));
   free_string_field (&(args_info->tradeoff_orig));
+  free_string_field (&(args_info->epsilon_orig));
   free_string_field (&(args_info->learning_algorithm_orig));
   free_string_field (&(args_info->threads_orig));
   
     write_into_file(outfile, "output", args_info->output_orig, 0);
   if (args_info->input_given)
     write_into_file(outfile, "input", args_info->input_orig, 0);
+  if (args_info->dab_input_given)
+    write_into_file(outfile, "dab_input", args_info->dab_input_orig, 0);
   if (args_info->model_given)
     write_into_file(outfile, "model", args_info->model_orig, 0);
   if (args_info->test_labels_given)
     write_into_file(outfile, "loss_function", args_info->loss_function_orig, 0);
   if (args_info->tradeoff_given)
     write_into_file(outfile, "tradeoff", args_info->tradeoff_orig, 0);
+  if (args_info->epsilon_given)
+    write_into_file(outfile, "epsilon", args_info->epsilon_orig, 0);
   if (args_info->learning_algorithm_given)
     write_into_file(outfile, "learning_algorithm", args_info->learning_algorithm_orig, 0);
   if (args_info->threads_given)
         { "labels",	1, NULL, 'l' },
         { "output",	1, NULL, 'o' },
         { "input",	1, NULL, 'i' },
+        { "dab_input",	1, NULL, 'd' },
         { "model",	1, NULL, 'm' },
         { "test_labels",	1, NULL, 'T' },
         { "ontoparam",	1, NULL, 'h' },
         { "cross_validation",	1, NULL, 'c' },
         { "loss_function",	1, NULL, 'e' },
         { "tradeoff",	1, NULL, 't' },
+        { "epsilon",	1, NULL, 'E' },
         { "learning_algorithm",	1, NULL, 'w' },
         { "threads",	1, NULL, 'p' },
         { "mmap",	0, NULL, 'M' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "Vl:o:i:m:T:h:aSv:s:nc:e:t:w:p:M", long_options, &option_index);
+      c = getopt_long (argc, argv, "Vl:o:i:d:m:T:h:aSv:s:nc:e:t:E:w:p:M", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'd':	/* Input Dat/Dab file .  */
+        
+        
+          if (update_arg( (void *)&(args_info->dab_input_arg), 
+               &(args_info->dab_input_orig), &(args_info->dab_input_given),
+              &(local_args_info.dab_input_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "dab_input", 'd',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'm':	/* Model file.  */
         
         
             goto failure;
         
           break;
-        case 'e':	/* Sets the loss function for SVM learning: Choice of:
-        0\tHamming distance loss: total number of differences in label vector.
-        1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-        2\tLikelihood distance loss. 
-        3\tLikelihood distance loss (modified). 
+        case 'e':	/* Sets the loss function for SVM learning: Choice of:
+        0\tHamming distance loss: total number of differences in label vector.
+        1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+        2\tLikelihood distance loss. 
+        3\tLikelihood distance loss (modified). 
         \n.  */
         
         
             goto failure;
         
           break;
-        case 'w':	/* Choice of structural learning algorithm:
-        0\tn-slack algorithm 
-        1\tn-slack algorithm with shrinking heuristic
-        2\t1-slack algorithm (primal) 
-        3\t1-slack algorithm (dual)
+        case 'E':	/* allow that tolerance for termination criterion.  */
+        
+        
+          if (update_arg( (void *)&(args_info->epsilon_arg), 
+               &(args_info->epsilon_orig), &(args_info->epsilon_given),
+              &(local_args_info.epsilon_given), optarg, 0, "0.1", ARG_FLOAT,
+              check_ambiguity, override, 0, 0,
+              "epsilon", 'E',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'w':	/* Choice of structural learning algorithm (default 4):
+        0\tn-slack algorithm 
+        1\tn-slack algorithm with shrinking heuristic
+        2\t1-slack algorithm (primal) 
+        3\t1-slack algorithm (dual)
         4\t1-slack algorithm (dual) with constraint cache\n.  */
         
         

tools/SVMhierarchy/cmdline.h

   char * input_arg;	/**< @brief Input PCL file .  */
   char * input_orig;	/**< @brief Input PCL file  original value given at command line.  */
   const char *input_help; /**< @brief Input PCL file  help description.  */
+  char * dab_input_arg;	/**< @brief Input Dat/Dab file .  */
+  char * dab_input_orig;	/**< @brief Input Dat/Dab file  original value given at command line.  */
+  const char *dab_input_help; /**< @brief Input Dat/Dab file  help description.  */
   char * model_arg;	/**< @brief Model file.  */
   char * model_orig;	/**< @brief Model file original value given at command line.  */
   const char *model_help; /**< @brief Model file help description.  */
   int cross_validation_arg;	/**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) (default='5').  */
   char * cross_validation_orig;	/**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) original value given at command line.  */
   const char *cross_validation_help; /**< @brief Number of cross-validation sets ( arg of 1 will turn off cross-validation ) help description.  */
-  int loss_function_arg;	/**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  int loss_function_arg;	/**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n (default='0').  */
-  char * loss_function_orig;	/**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  char * loss_function_orig;	/**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n original value given at command line.  */
-  const char *loss_function_help; /**< @brief Sets the loss function for SVM learning: Choice of:
-  0\tHamming distance loss: total number of differences in label vector.
-  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
-  2\tLikelihood distance loss. 
-  3\tLikelihood distance loss (modified). 
+  const char *loss_function_help; /**< @brief Sets the loss function for SVM learning: Choice of:
+  0\tHamming distance loss: total number of differences in label vector.
+  1\tHamming distance loss (modified): total number of differences in label vector; over-annotation not counted as difference. 
+  2\tLikelihood distance loss. 
+  3\tLikelihood distance loss (modified). 
   \n help description.  */
   float tradeoff_arg;	/**< @brief SVM tradeoff constant C (default='1').  */
   char * tradeoff_orig;	/**< @brief SVM tradeoff constant C original value given at command line.  */
   const char *tradeoff_help; /**< @brief SVM tradeoff constant C help description.  */
-  int learning_algorithm_arg;	/**< @brief Choice of structural learning algorithm:
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  float epsilon_arg;	/**< @brief allow that tolerance for termination criterion (default='0.1').  */
+  char * epsilon_orig;	/**< @brief allow that tolerance for termination criterion original value given at command line.  */
+  const char *epsilon_help; /**< @brief allow that tolerance for termination criterion help description.  */
+  int learning_algorithm_arg;	/**< @brief Choice of structural learning algorithm (default 4):
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n (default='3').  */
-  char * learning_algorithm_orig;	/**< @brief Choice of structural learning algorithm:
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  char * learning_algorithm_orig;	/**< @brief Choice of structural learning algorithm (default 4):
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n original value given at command line.  */
-  const char *learning_algorithm_help; /**< @brief Choice of structural learning algorithm:
-  0\tn-slack algorithm 
-  1\tn-slack algorithm with shrinking heuristic
-  2\t1-slack algorithm (primal) 
-  3\t1-slack algorithm (dual)
+  const char *learning_algorithm_help; /**< @brief Choice of structural learning algorithm (default 4):
+  0\tn-slack algorithm 
+  1\tn-slack algorithm with shrinking heuristic
+  2\t1-slack algorithm (primal) 
+  3\t1-slack algorithm (dual)
   4\t1-slack algorithm (dual) with constraint cache\n help description.  */
   int threads_arg;	/**< @brief number of threads (only apply to algorithm 3 currently) (default='4').  */
   char * threads_orig;	/**< @brief number of threads (only apply to algorithm 3 currently) original value given at command line.  */
   unsigned int labels_given ;	/**< @brief Whether labels was given.  */
   unsigned int output_given ;	/**< @brief Whether output was given.  */
   unsigned int input_given ;	/**< @brief Whether input was given.  */
+  unsigned int dab_input_given ;	/**< @brief Whether dab_input was given.  */
   unsigned int model_given ;	/**< @brief Whether model was given.  */
   unsigned int test_labels_given ;	/**< @brief Whether test_labels was given.  */
   unsigned int ontoparam_given ;	/**< @brief Whether ontoparam was given.  */
   unsigned int cross_validation_given ;	/**< @brief Whether cross_validation was given.  */
   unsigned int loss_function_given ;	/**< @brief Whether loss_function was given.  */
   unsigned int tradeoff_given ;	/**< @brief Whether tradeoff was given.  */
+  unsigned int epsilon_given ;	/**< @brief Whether epsilon was given.  */
   unsigned int learning_algorithm_given ;	/**< @brief Whether learning_algorithm was given.  */
   unsigned int threads_given ;	/**< @brief Whether threads was given.  */
   unsigned int mmap_given ;	/**< @brief Whether mmap was given.  */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.