/** * Test a maxent classifier. The data representation is the same as for * training. * * @param classifier the classifier to test * @param features an array of instances represented as arrays of features * @param labels corresponding labels * @return accuracy on the data */ static public double test(Classifier classifier, String[][]features, String[] labels) { return test(classifier, new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence())); }
/** * Test a maxent classifier. The data representation is the same as for * training. * * @param classifier the classifier to test * @param features an array of instances represented as arrays of features * @param labels corresponding labels * @return accuracy on the data */ static public double test(Classifier classifier, String[][]features, String[] labels) { return test(classifier, new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence())); }
/** * Test a maxent classifier. The data representation is the same as for * training. * * @param classifier the classifier to test * @param features an array of instances represented as arrays of features * @param labels corresponding labels * @return accuracy on the data */ static public double test(Classifier classifier, String[][]features, String[] labels) { return test(classifier, new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence())); }
/** * Train a maxent classifier. Each row of <code>features</code> * represents the features of a training instance. The label for * that instance is in the corresponding position of * <code>labels</code>. * * @param features Each row gives the on features of an instance * @param labels Each position gives the label of an instance * @param var Gaussian prior variance for training * @param save if non-null, save the trained model to this file * @return the maxent classifier * @exception IOException if the trained model cannot be saved */ static public Classifier train(String[][]features, String[] labels, double var, File save) throws IOException { return train(new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence()), var, save); }
/** * Train a maxent classifier. Each row of <code>features</code> * represents the features of a training instance. The label for * that instance is in the corresponding position of * <code>labels</code>. * * @param features Each row gives the on features of an instance * @param labels Each position gives the label of an instance * @param var Gaussian prior variance for training * @param save if non-null, save the trained model to this file * @return the maxent classifier * @exception IOException if the trained model cannot be saved */ static public Classifier train(String[][]features, String[] labels, double var, File save) throws IOException { return train(new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence()), var, save); }
/** * Train a maxent classifier. Each row of <code>features</code> * represents the features of a training instance. The label for * that instance is in the corresponding position of * <code>labels</code>. * * @param features Each row gives the on features of an instance * @param labels Each position gives the label of an instance * @param var Gaussian prior variance for training * @param save if non-null, save the trained model to this file * @return the maxent classifier * @exception IOException if the trained model cannot be saved */ static public Classifier train(String[][]features, String[] labels, double var, File save) throws IOException { return train(new PipeExtendedIterator( new ArrayDataAndTargetIterator(features, labels), new CharSequenceArray2TokenSequence()), var, save); }