public void actionPerformed(ActionEvent e) { mFileChooser.setDialogTitle("Predictions CSV"); mFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); mFileChooser.setSelectedFile(new File("predictions.csv")); mFileChooser.setFileFilter(null); if (UIUtil.runFileChooser(mFileChooser, mParent, null, "lastPredictionLocation") == JFileChooser.APPROVE_OPTION) { // Time to copy the predictions autoweka.Util.copyFile(mOutputFile, mFileChooser.getSelectedFile()); } };
public boolean openTestingSet() { mFileChooser.setDialogTitle("Testing Set ARFF"); mFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); mFileChooser.setFileFilter(UIUtil.msArffFileFilter); if (UIUtil.runFileChooser(mFileChooser, this, mTestingSetText, "lastArffLocation") == JFileChooser.APPROVE_OPTION) { // Time to do the predictions return true; } return false; }
public void openExperiment(String experimentPath) { mFileChooser.setDialogTitle("Experiment"); if (experimentPath == null) { mFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); mFileChooser.setDialogTitle("Experiment to run"); mFileChooser.setFileFilter(null); if (UIUtil.runFileChooser(mFileChooser, this, mExperimentText, "lastExperimentDirLocation") == JFileChooser.CANCEL_OPTION) { return; } } else { mFileChooser.setSelectedFile(new File(experimentPath)); mExperimentText.setEnabled(false); mExperimentText.setEditable(false); mExperimentText.setText(experimentPath); mMakePredictionsButton.setEnabled(false); } try { File expFolder = mFileChooser.getSelectedFile(); File exp = new File( expFolder.getAbsolutePath() + File.separator + expFolder.getName() + ".experiment"); if (!exp.exists() || !exp.isFile()) { throw new RuntimeException( expFolder.getAbsolutePath() + " does not appear to contain a .experiment"); } TrajectoryGroup group = TrajectoryMerger.mergeExperimentFolder(expFolder.getAbsolutePath()); ArrayList<String> inProgressSeeds = new ArrayList<String>(); // Go through all the logs and see if we can parse any other partial trajectories File[] files = new File(expFolder.getAbsolutePath() + File.separator + "out" + File.separator + "logs") .listFiles(); for (File f : files) { String fName = f.getName(); if (fName.endsWith(".log")) { String seed = fName.substring(0, fName.length() - 4); if (!group.getSeeds().contains(seed)) { inProgressSeeds.add(seed); } } } // Do we want use these inprogress seeds if (!inProgressSeeds.isEmpty()) { Collections.sort(inProgressSeeds); StringBuilder msgSB = new StringBuilder("It looks like there are partial runs for the following seeds:\n"); for (String s : inProgressSeeds) { msgSB.append(s); msgSB.append("\n"); } msgSB.append( "Do you wish to use these experiments?\nYou may not be able to make predictions from\nthese experiments without training a model first."); // We want to use these partial runs if we're in force open mode if (experimentPath != null || JOptionPane.showConfirmDialog( this, msgSB.toString(), "Use Partial Runs", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { for (String s : inProgressSeeds) { group.addTrajectory( TrajectoryParser.getTrajectory( Experiment.createFromFolder(expFolder), expFolder, s)); } } } mBest = new GetBestFromTrajectoryGroup(group); // Set all the text blocks mExperimentText.setText(expFolder.getAbsolutePath()); mSelectedErrorLabel.setText(Float.toString(mBest.errorEstimate)); mSelectedSeedLabel.setText(mBest.seed); mNumEvaluationsLabel.setText(mBest.numEval == -1 ? "" : Integer.toString(mBest.numEval)); mNumTimeOutEvaluationsLabel.setText( mBest.numTimeOut == -1 ? "" : Integer.toString(mBest.numTimeOut)); mNumMemOutEvaluationsLabel.setText( mBest.numMemOut == -1 ? "" : Integer.toString(mBest.numMemOut)); setText(mClassifierText, mBest.classifierClass); setText(mClassifierParamsText, mBest.classifierArgs); setText(mAttributeSearchText, mBest.attributeSearchClass); setText(mAttributeSearchParamsText, mBest.attributeSearchArgs); setText(mAttributeEvalText, mBest.attributeEvalClass); setText(mAttributeEvalParamsText, mBest.attributeEvalArgs); // Enable the dataset button mMakePredictionsButton.setEnabled(true); } catch (Exception e) { UIUtil.showExceptionDialog(this, "Failed to open experiment", e); } }