public ParseFileWizardStep(String i18nKey, CSVDataReader reader) { super(i18nKey); this.editor = new MetaDataDeclarationEditor(reader, false); skipCommentsBox.setSelected( reader.getParameterAsBoolean(CSVDataReader.PARAMETER_SKIP_COMMENTS)); useFirstRowAsColumnNamesBox.setSelected( reader.getParameterAsBoolean(CSVDataReader.PARAMETER_USE_FIRST_ROW_AS_ATTRIBUTE_NAMES)); useQuotesBox.setSelected(reader.getParameterAsBoolean(CSVDataReader.PARAMETER_USE_QUOTES)); String sep = LineParser.DEFAULT_SPLIT_EXPRESSION; regexButton.setSelected(true); try { sep = reader.getParameter(CSVDataReader.PARAMETER_COLUMN_SEPARATORS); } catch (UndefinedParameterError e1) { e1.printStackTrace(); } if (sep.equals(LineParser.SPLIT_BY_COMMA_EXPRESSION)) { commaButton.setSelected(true); } if (sep.equals(LineParser.SPLIT_BY_SEMICOLON_EXPRESSION)) { semicolonButton.setSelected(true); } if (sep.equals(LineParser.SPLIT_BY_TAB_EXPRESSION)) { tabButton.setSelected(true); } if (sep.equals(LineParser.SPLIT_BY_SPACE_EXPRESSION)) { spaceButton.setSelected(true); } }
// private IOObject getValidations( WhiBoCentroidClusterModel // centroidClusterModel, ExampleSet exampleSet) { private IOObject getValidations(ClusterModel centroidClusterModel, ExampleSet exampleSet) { CentroidClusterModel centroidClusterModelRapid = null; WhiBoCentroidClusterModel centroidClusterModelWhiBo = null; if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) { centroidClusterModelRapid = (CentroidClusterModel) centroidClusterModel; } else { centroidClusterModelWhiBo = (WhiBoCentroidClusterModel) centroidClusterModel; } // Gets distance measure from the component repository on the basis of // selected parameter String className = getParameterType("Distance_Measure").toString(0); rs.fon.whibo.GC.component.DistanceMeasure.DistanceMeasure distance = null; Constructor c = null; try { c = Class.forName(className).getConstructor(new Class[] {List.class}); distance = (rs.fon.whibo.GC.component.DistanceMeasure.DistanceMeasure) c.newInstance(new Object[] {new LinkedList<SubproblemParameter>()}); } catch (Exception e) { } Evaluation e = null; double evaluation = 0; MyPerformanceCriterion mpc = new MyPerformanceCriterion(); LinkedList<SubproblemParameter> ll = new LinkedList<SubproblemParameter>(); // Instantiates sub-problem parameter class for validation measures that // need parameters SubproblemParameter sp = new SubproblemParameter(); sp.setParametertType(Integer.class); sp.setMinValue("1"); sp.setMaxValue("1000"); // Gets and executes evaluation components from the component repository // on the basis of selected parameter if (getParameterAsBoolean("Intra_Cluster_Distance")) { e = new IntraClusterDistance(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Intra_Cluster_Distance", evaluation); } if (getParameterAsBoolean("Connectivity")) { try { sp.setXenteredValue(getParameter("NN_Connectivity").toString()); } catch (UndefinedParameterError e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IllegalArgumentException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ll.add(sp); e = new Connectivity(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Connectivity", evaluation); } if (getParameterAsBoolean("Global_Silhouette_Index")) { e = new GlobalSilhouetteIndex(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Global_Silhouette_Index", evaluation); } if (getParameterAsBoolean("XB_Index")) { e = new XBIndex(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("XB_Index", evaluation); } if (getParameterAsBoolean("Min_Max_Cut")) { e = new MInMaxCut(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Min_Max_Cut", evaluation); } if (getParameterAsBoolean("Symmetry")) { try { sp.setXenteredValue(getParameter("NN_Symmetry").toString()); } catch (UndefinedParameterError e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IllegalArgumentException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ll.removeFirstOccurrence(sp); ll.add(sp); // e=new Symmetry(ll); // if // (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) // evaluation = e.Evaluate(distance, centroidClusterModelRapid, // exampleSet); // else // evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, // exampleSet); // mpc.addPerformance("Symmetry", evaluation); // } // if(getParameterAsBoolean("BIC")){ // e=new BIC(ll); // if // (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) // evaluation = e.Evaluate(distance, centroidClusterModelRapid, // exampleSet); // else // evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, // exampleSet); // mpc.addPerformance("BIC", evaluation); } if (getParameterAsBoolean("Fowlkes_Mallows_Index")) { e = new FowlkesMallowsIndex(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Fowlkes_Mallows_Index", evaluation); } if (getParameterAsBoolean("Jaccard_Index")) { e = new JaccardIndex(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Jaccard_Index", evaluation); } if (getParameterAsBoolean("Rand_Index")) { e = new RandIndex(ll); evaluation = e.Evaluate(distance, centroidClusterModel, exampleSet); mpc.addPerformance("Rand_Index", evaluation); } if (getParameterAsBoolean("Adjusted_Rand_Index")) { e = new AdjustedRandIndex(ll); if (centroidClusterModel.getClass().equals(CentroidClusterModel.class)) evaluation = e.Evaluate(distance, centroidClusterModelRapid, exampleSet); else evaluation = e.Evaluate(distance, centroidClusterModelWhiBo, exampleSet); mpc.addPerformance("Adjusted_Rand_Index", evaluation); } return mpc; }
/** * Displays the best machting error bubble depending on the given {@link UserError}. If no * explicit match can be found, displays a generic error bubble. * * @param error the error in question, must not be {@code null} * @return the bubble instance, never {@code null} */ public static BubbleWindow displayBubbleForUserError(final UserError error) { if (error == null) { throw new IllegalArgumentException("userError must not be null!"); } if (error instanceof PortUserError) { PortUserError userError = (PortUserError) error; if (userError.getCode() == 149) { // for "no data" errors we display an error bubble instead of a dialog return displayInputPortNoDataInformation(userError.getPort()); } else if (userError.getCode() == 156) { return displayInputPortWrongTypeInformation( userError.getPort(), userError.getExpectedType(), userError.getActualType()); } else { return displayGenericPortError(userError); } } else if (error.getClass().equals(UndefinedParameterError.class)) { UndefinedParameterError userError = (UndefinedParameterError) error; if (userError.getCode() == 205 || userError.getCode() == 217) { // for "missing mandatory parameter" errors we display an error bubble // instead of a dialog Operator op = userError.getOperator(); ParameterType param = op != null ? op.getParameterType(userError.getKey()) : null; if (op != null && param != null) { return displayMissingMandatoryParameterInformation(op, param); } else { return displayGenericUserError(error); } } else { Operator op = userError.getOperator(); ParameterType param = op != null ? op.getParameterType(userError.getKey()) : null; if (op != null && param != null) { return displayMissingMandatoryParameterInformation(op, param); } else { return displayGenericUserError(error); } } } else if (error instanceof ParameterError) { ParameterError userError = (ParameterError) error; Operator op = userError.getOperator(); ParameterType param = op != null ? op.getParameterType(userError.getKey()) : null; if (op != null && param != null) { return displayGenericParameterError(userError); } else { return displayGenericUserError(error); } } else if (error instanceof AttributeNotFoundError) { AttributeNotFoundError userError = (AttributeNotFoundError) error; Operator op = userError.getOperator(); ParameterType param = op != null ? op.getParameterType(userError.getKey()) : null; if (op != null && param != null) { return displayAttributeNotFoundParameterInformation(userError); } else { return displayGenericUserError(error); } } else if (error instanceof ProcessExecutionUserErrorError) { ProcessExecutionUserErrorError userError = (ProcessExecutionUserErrorError) error; if (userError.getUserError() != null && userError.getUserError().getOperator() != null) { return displayUserErrorInExecutedProcess(userError); } else { return displayGenericUserError(error); } } else { return displayGenericUserError(error); } }