Algorithm-TrunkClassifier

 view release on metacpan or  search on metacpan

Algorithm/TrunkClassifier/ppport.h  view on Meta::CPAN

#ifndef UV_MAX
#  define UV_MAX                         PERL_ULONG_MAX
#endif

#endif

#ifndef IVSIZE
#  ifdef LONGSIZE
#    define IVSIZE LONGSIZE
#  else
#    define IVSIZE 4 /* A bold guess, but the best we can make. */
#  endif
#endif
#ifndef UVTYPE
#  define UVTYPE                         unsigned IVTYPE
#endif

#ifndef UVSIZE
#  define UVSIZE                         IVSIZE
#endif
#ifndef sv_setuv

Algorithm/TrunkClassifier/ppport.h  view on Meta::CPAN

#endif

#ifndef PERL_MAGIC_backref
#  define PERL_MAGIC_backref             '<'
#endif

#ifndef PERL_MAGIC_ext
#  define PERL_MAGIC_ext                 '~'
#endif

/* That's the best we can do... */
#ifndef sv_catpvn_nomg
#  define sv_catpvn_nomg                 sv_catpvn
#endif

#ifndef sv_catsv_nomg
#  define sv_catsv_nomg                  sv_catsv
#endif

#ifndef sv_setsv_nomg
#  define sv_setsv_nomg                  sv_setsv

Algorithm/TrunkClassifier/src/feature_selection.c  view on Meta::CPAN

		else if(strcmp(sampleNames[sample], MALIGN) == 0){
			malignIndexes[malignCounter] = sample;
			malignCounter++;
		}
	}
	
	//Perform t-test
	int feature;
	double currentT = 0;
	double topT = 0;
	int bestFeature;
	for(feature = 0; feature < numFeatures; feature++){

		//Calculate sum of normal samples
		double sumNormal = 0;
		int normalBuffer;
		for(sample = 0; sample < numNormal; sample++){
			normalBuffer = normalIndexes[sample];
			sumNormal += expData[feature][normalBuffer];
		}
		//Calculate sum of malign samples

Algorithm/TrunkClassifier/src/feature_selection.c  view on Meta::CPAN

			normalVar += pow(expData[feature][normalBuffer] - normalMean, 2);
		}

		//Calculate variance of malign samples
		double malignVar = 0;
		for(sample = 0; sample < numMalign; sample++){
			malignBuffer = malignIndexes[sample];
			malignVar += pow(expData[feature][malignBuffer] - malignMean, 2);
		}
		
		//Calculate t and compare to previous best
		if(normalVar == 0 && malignVar == 0){
			normalVar = 0.000001;
		}
		currentT = fabs(normalMean - malignMean) / sqrt ((normalVar / numNormal) + (malignVar / numMalign));
		if(currentT > topT){
			topT = currentT;
			bestFeature = feature;
		}
	}
	
	//Return index of best feature
	return bestFeature;
}



( run in 0.923 second using v1.01-cache-2.11-cpan-4e96b696675 )