/** * Gets the current settings of FuzzyRoughSubsetEval * * @return an array of strings suitable for passing to setOptions() */ public String[] getOptions() { Vector<String> result; result = new Vector<String>(); result.add("-Z"); result.add( (m_FuzzyMeasure.getClass().getName() + " " + Utils.joinOptions(m_FuzzyMeasure.getOptions())) .trim()); result.add("-I"); result.add( (m_Implicator.getClass().getName() + " " + Utils.joinOptions(m_Implicator.getOptions())) .trim()); result.add("-T"); result.add( (m_TNorm.getClass().getName() + " " + Utils.joinOptions(m_TNorm.getOptions())).trim()); result.add("-R"); result.add( (m_Similarity.getClass().getName() + " " + Utils.joinOptions(m_Similarity.getOptions())) .trim()); return result.toArray(new String[result.size()]); }
protected void resetOptions() { m_trainInstances = null; try { m_Similarity.setTNorm(new TNormLukasiewicz()); } catch (Exception e) { } }
/** * Generates an attribute evaluator. Has to initialise all fields of the evaluator that are not * being set via options. * * @param data set of instances serving as training data * @throws Exception if the evaluator has not been generated successfully */ public void buildEvaluator(Instances data) throws Exception { // can evaluator handle data? getCapabilities().testWithFail(data); m_trainInstances = new Instances(data); m_trainInstances.deleteWithMissingClass(); m_numAttribs = m_trainInstances.numAttributes(); m_numInstances = m_trainInstances.numInstances(); // if the data has no decision feature, m_classIndex is negative m_classIndex = m_trainInstances.classIndex(); // supervised if (m_classIndex >= 0) { m_isNumeric = m_trainInstances.attribute(m_classIndex).isNumeric(); if (m_isNumeric) { m_DecisionSimilarity = m_Similarity; } else m_DecisionSimilarity = m_SimilarityEq; } m_Similarity.setInstances(m_trainInstances); m_DecisionSimilarity.setInstances(m_trainInstances); m_SimilarityEq.setInstances(m_trainInstances); m_composition = m_Similarity.getTNorm(); m_FuzzyMeasure.set( m_Similarity, m_DecisionSimilarity, m_TNorm, m_composition, m_Implicator, m_SNorm, m_numInstances, m_numAttribs, m_classIndex, m_trainInstances); }
/** * Return a description of the fuzzy rough attribute evaluator. * * @return a description of the evaluator as a String. */ public String toString() { StringBuffer text = new StringBuffer(); if (m_trainInstances == null) { text.append("FRFS feature evaluator has not been built yet\n"); } else { text.append("\nFuzzy rough feature selection\n\nMethod: " + m_FuzzyMeasure); text.append("\nSimilarity measure: " + m_Similarity); text.append("\nDecision similarity: " + m_DecisionSimilarity); text.append("\nImplicator: " + m_Implicator); text.append("\nT-Norm: " + m_TNorm + "\nRelation composition: " + m_Similarity.getTNorm()); text.append("\n(S-Norm: " + m_SNorm + ")\n\n"); } return text.toString(); }