catch (Exception e) {e.printStackTrace();}
}
public void train(String trainFile, String modelFile, byte vectorType, int labelCutoff, int featureCutoff, int numThreads, byte solver, double cost, double eps, double bias) throws Exception
{
AbstractTrainSpace space = null;
boolean hasWeight = AbstractTrainSpace.hasWeight(vectorType, trainFile);
switch (vectorType)
{
case AbstractTrainSpace.VECTOR_SPARSE:
space = new SparseTrainSpace(hasWeight); break;
case AbstractTrainSpace.VECTOR_STRING:
space = new StringTrainSpace(hasWeight, labelCutoff, featureCutoff); break;
}
space.readInstances(UTInput.createBufferedFileReader(trainFile));
space.build();
AbstractModel model = getModel(space, numThreads, solver, cost, eps, bias);
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(modelFile)));
out.writeObject(model);