### Question:
CorrelatedAttributeSelector extends AbstractAttributeSelector { @Override public FeatureList selectAttributes(long organismId, long attributeGroupId) throws ApplicationException { AttributeData attributeSet = cache.getAttributeData(namespace, organismId, attributeGroupId); Matrix data = attributeSet.getData(); int numAttributes = data.numCols(); int numGenes = data.numRows(); DenseVector sums = new DenseVector(numAttributes); data.columnSums(sums.getData()); boolean oldMode = false; boolean scaled = false; FeatureLoader featureLoader = new FeatureLoader(cache, namespace, organismId, oldMode, scaled); CoAnnotationSet annoSet = cache.getCoAnnotationSet(organismId, goBranch); DenseVector scores = new DenseVector(numAttributes); FeatureList candidateFeatures = getCandidateFeatures(organismId, attributeGroupId); double n = numGenes; final double yhatSum = MatrixUtils.sum(annoSet.GetBHalf()); double correctionFactor = yhatSum + n*annoSet.GetConstant(); double diagSum = 0; for (int i=0; i<numGenes; i++) { diagSum += annoSet.GetCoAnnotationMatrix().get(i, i); } correctionFactor += diagSum; correctionFactor = correctionFactor/(n*n); double annoSetSum = annoSet.GetCoAnnotationMatrix().elementSum(); int i=0; DenseVector tempVec = new DenseVector(numGenes); for (Feature feature: candidateFeatures) { double score = 0d; double s = sums.get(i); double mean = s*(s-1)/(n*n); double var = mean*(1-mean); SymMatrix network = featureLoader.load(feature); double attributeCoannoProd = network.elementMultiplySum(annoSet.GetCoAnnotationMatrix()); if (attributeCoannoProd == 0) { score = Double.MIN_VALUE; } else { double networkSum = s*(s-1); network.mult(annoSet.GetBHalf().getData(), tempVec.getData()); double tempVecSum = MatrixUtils.sum(tempVec); double term1 = attributeCoannoProd + tempVecSum + networkSum*annoSet.GetConstant(); double term2 = annoSetSum + n*yhatSum + n*n*annoSet.GetConstant(); score = (term1-term2)/(Math.sqrt(var)*n*n); double correction = -mean/Math.sqrt(var)*correctionFactor; score = score - correction; } scores.set(i, score); i += 1; if (i % 1000 == 0) { logger.debug("i: " + i); } } FeatureList featureList = selectTopFeatures(organismId, attributeGroupId, candidateFeatures, scores, sums); return featureList; } CorrelatedAttributeSelector(DataCache cache, String goBranch, int maxAttributes); @Override FeatureList selectAttributes(long organismId, long attributeGroupId);  }### Answer:
@Test public void testSelectAttributes() throws Exception { int maxAttributes = 3; DenseVector target = new DenseVector(cacheConfig.getOrg1numGenes()); CorrelatedAttributeSelector selector = new CorrelatedAttributeSelector(cacheBuilder.getCache(), "BP", maxAttributes); FeatureList featureList = selector.selectAttributes(cacheConfig.getOrg1Id(), cacheConfig.getAttributeGroupId()[0]); assertNotNull(featureList); }