/** * Output a representation of this classifier * * @return a representation of this classifier */ public String toString() { if (m_AttributeSelection == null) { return "AttributeSelectedClassifier: No attribute selection possible.\n\n" +m_Classifier.toString(); } StringBuffer result = new StringBuffer(); result.append("AttributeSelectedClassifier:\n\n"); result.append(m_AttributeSelection.toResultsString()); result.append("\n\nHeader of reduced data:\n"+m_ReducedHeader.toString()); result.append("\n\nClassifier Model\n"+m_Classifier.toString()); return result.toString(); }
/** * Output a representation of this classifier * * @return a representation of this classifier */ public String toString() { if (m_AttributeSelection == null) { return "AttributeSelectedClassifier: No attribute selection possible.\n\n" +m_Classifier.toString(); } StringBuffer result = new StringBuffer(); result.append("AttributeSelectedClassifier:\n\n"); result.append(m_AttributeSelection.toResultsString()); result.append("\n\nHeader of reduced data:\n"+m_ReducedHeader.toString()); result.append("\n\nClassifier Model\n"+m_Classifier.toString()); return result.toString(); }
/** * feature selection * * @param aContext * lab context * @param trainData * weka instances * @param featureSearcher * searcher * @param attributeEvaluator * evaluator * @return attribute selection * @throws Exception * in case of errors */ private AttributeSelection featureSelectionSinglelabel(Instances trainData, List<String> featureSearcher, List<String> attributeEvaluator) throws Exception { AttributeSelection selector = singleLabelAttributeSelection(trainData, featureSearcher, attributeEvaluator); FileUtils.writeStringToFile(new File(workingFolder, featureSelectionFile), selector.toResultsString(), "utf-8"); return selector; }
/** * feature selection * * @param aContext * lab context * @param trainData * weka instances * @param featureSearcher * searcher * @param attributeEvaluator * evaluator * @return attribute selection * @throws Exception * in case of errors */ private AttributeSelection featureSelectionSinglelabel(Instances trainData, List<String> featureSearcher, List<String> attributeEvaluator) throws Exception { AttributeSelection selector = singleLabelAttributeSelection(trainData, featureSearcher, attributeEvaluator); FileUtils.writeStringToFile(new File(workingFolder, featureSelectionFile), selector.toResultsString(), UTF_8); return selector; }
public void apply() throws Exception { // FEATURE SELECTION if (!multiLabel) { if (featureSearcher != null && attributeEvaluator != null) { AttributeSelection attSel = featureSelectionSinglelabel(trainData, featureSearcher, attributeEvaluator); FileUtils.writeStringToFile(new File(workingFolder, featureSelectionFile), attSel.toResultsString(), "utf-8"); trainData = attSel.reduceDimensionality(trainData); testData = attSel.reduceDimensionality(testData); } } else { if (attributeEvaluator != null && labelTransformationMethod != null && numLabelsToKeep > 0) { Remove attSel = featureSelectionMultilabel(trainData, attributeEvaluator, labelTransformationMethod, numLabelsToKeep); Logger.getLogger(getClass()).info("APPLYING FEATURE SELECTION"); trainData = applyAttributeSelectionFilter(trainData, attSel); testData = applyAttributeSelectionFilter(testData, attSel); } } }
public void apply() throws Exception { // FEATURE SELECTION if (!multiLabel) { if (featureSearcher != null && attributeEvaluator != null) { AttributeSelection attSel = featureSelectionSinglelabel(trainData, featureSearcher, attributeEvaluator); FileUtils.writeStringToFile(new File(workingFolder, featureSelectionFile), attSel.toResultsString(), UTF_8); trainData = attSel.reduceDimensionality(trainData); testData = attSel.reduceDimensionality(testData); } } else { if (attributeEvaluator != null && labelTransformationMethod != null && numLabelsToKeep > 0) { Remove attSel = featureSelectionMultilabel(trainData, attributeEvaluator, labelTransformationMethod, numLabelsToKeep); Logger.getLogger(getClass()).info("APPLYING FEATURE SELECTION"); trainData = applyAttributeSelectionFilter(trainData, attSel); testData = applyAttributeSelectionFilter(testData, attSel); } } }
return trainSelector.toResultsString();
new File(aContext.getStorageLocation(OUTPUT_KEY, AccessMode.READWRITE) .getAbsolutePath() + "/" + FEATURE_SELECTION_DATA_KEY), selector.toResultsString()); if (applySelection) { trainData = selector.reduceDimensionality(trainData);
return trainSelector.toResultsString();
outBuff.append(eval.toResultsString()); } else { outBuff.append(eval.CVResultsString());
outBuff.append(eval.toResultsString()); } else { outBuff.append(eval.CVResultsString());
/** * Builds a model using the current scheme using the given data. * * @param data the instances to test the selection scheme on * @return a string containing the results. */ protected String useScheme(Instances data) throws Exception { AttributeSelection attsel = null; try { attsel = new AttributeSelection(); attsel.setSearch(m_Search); attsel.setEvaluator(m_Evaluator); attsel.setSeed(42); } catch (Exception e) { e.printStackTrace(); fail("Problem setting up attribute selection: " + e); } attsel.SelectAttributes(data); return attsel.toResultsString(); }
/** * Builds a model using the current scheme using the given data. * * @param data the instances to test the selection scheme on * @return a string containing the results. */ protected String useScheme(Instances data) throws Exception { AttributeSelection attsel = null; try { attsel = new AttributeSelection(); attsel.setSearch(m_Search); attsel.setEvaluator(m_Evaluator); attsel.setSeed(42); } catch (Exception e) { e.printStackTrace(); fail("Problem setting up attribute selection: " + e); } attsel.SelectAttributes(data); return attsel.toResultsString(); }
m_selectedAttsStore.put(setNum != null ? setNum : -1, selectedAtts); String results = eval.toResultsString(); outputTextData(results, setNum); applyFiltering(StepManager.CON_TRAININGSET, selectedAtts, train,
if (!attsel1A.toResultsString().equals(attsel1B.toResultsString())) { if (m_Debug) { println("\n=== Full report ===\n" + "\nFirst search\n" + attsel1A.toResultsString() + "\n\n"); println("\nSecond search\n" + attsel1B.toResultsString() + "\n\n");
if (attselB.toResultsString().equals(attselI.toResultsString())) {
m_selectedAttsStore.put(setNum != null ? setNum : -1, selectedAtts); String results = eval.toResultsString(); outputTextData(results, setNum); applyFiltering(StepManager.CON_TRAININGSET, selectedAtts, train,
if (attselB.toResultsString().equals(attselI.toResultsString())) {
if (!attsel1A.toResultsString().equals(attsel1B.toResultsString())) { if (m_Debug) { println("\n=== Full report ===\n" + "\nFirst search\n" + attsel1A.toResultsString() + "\n\n"); println("\nSecond search\n" + attsel1B.toResultsString() + "\n\n");