本文整理了Java中de.bwaldvogel.liblinear.Linear.saveModel()
方法的一些代码示例,展示了Linear.saveModel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Linear.saveModel()
方法的具体详情如下:
包路径:de.bwaldvogel.liblinear.Linear
类名称:Linear
方法名:saveModel
Linear.saveModel介绍
[英]Writes the model to the file with ISO-8859-1 charset. It uses java.util.Locale#ENGLISH for number formatting.
[中]使用ISO-8859-1字符集将模型写入文件。它使用java。util。语言环境#用于数字格式的英语。
代码示例
代码示例来源:origin: linkedin/ml-ease
/**
* see {@link Linear#saveModel(Writer, Model)}
*/
public void save(Writer writer) throws IOException {
Linear.saveModel(writer, this);
}
代码示例来源:origin: de.bwaldvogel/liblinear
/**
* see {@link Linear#saveModel(java.io.File, Model)}
*/
public void save(File file) throws IOException {
Linear.saveModel(file, this);
}
代码示例来源:origin: linkedin/ml-ease
/**
* see {@link Linear#saveModel(java.io.File, Model)}
*/
public void save(File file) throws IOException {
Linear.saveModel(file, this);
}
代码示例来源:origin: de.bwaldvogel/liblinear
/**
* see {@link Linear#saveModel(Writer, Model)}
*/
public void save(Writer writer) throws IOException {
Linear.saveModel(writer, this);
}
代码示例来源:origin: de.bwaldvogel/liblinear
/**
* Writes the model to the file with ISO-8859-1 charset.
* It uses {@link java.util.Locale#ENGLISH} for number formatting.
*/
public static void saveModel(File modelFile, Model model) throws IOException {
BufferedWriter modelOutput = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(modelFile), FILE_CHARSET));
saveModel(modelOutput, model);
}
代码示例来源:origin: linkedin/ml-ease
/**
* Writes the model to the file with ISO-8859-1 charset.
* It uses {@link java.util.Locale#ENGLISH} for number formatting.
*/
public static void saveModel(File modelFile, Model model) throws IOException {
BufferedWriter modelOutput = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(modelFile), FILE_CHARSET));
saveModel(modelOutput, model);
}
代码示例来源:origin: eu.fbk.utils/utils-svm
@Override
void doWrite(final Path path) throws IOException {
// Write the dictionary
this.dictionary.writeTo(path.resolve("dictionary"));
// Write the model
try (BufferedWriter writer = Files.newBufferedWriter(path.resolve("model"))) {
Linear.saveModel(writer, this.model);
}
}
代码示例来源:origin: chungkwong/MathOCR
@Override
public void write(LinearModel model,String fileName) throws IOException{
saveFeatureList(model.getFeatures(),fileName);
Linear.saveModel(new File(fileName),model.getModel());
}
@Override
代码示例来源:origin: linkedin/ml-ease
private void run(String[] args) throws IOException, InvalidInputDataException {
parse_command_line(args);
readProblem(inputFilename);
if (cross_validation)
do_cross_validation();
else {
Model model = Linear.train(prob, param);
Linear.saveModel(new File(modelFilename), model);
}
}
}
代码示例来源:origin: de.bwaldvogel/liblinear
private void run(String[] args) throws IOException, InvalidInputDataException {
parse_command_line(args);
readProblem(inputFilename);
if (find_C) {
do_find_parameter_C();
} else if (cross_validation)
do_cross_validation();
else {
Model model = Linear.train(prob, param);
Linear.saveModel(new File(modelFilename), model);
}
}
代码示例来源:origin: eu.fbk.utils/utils-svm
private static Classifier trainJava(final Parameters parameters,
final Iterable trainingSet) throws IOException {
// Prepare the svm_parameter object based on supplied parameters
final Parameter parameter = encodeParameters(parameters);
parameter.setEps(getDefaultEpsilon(parameters) * 0.1f);
// Encode the training set as an svm_problem object, filling a dictionary meanwhile
final Dictionary dictiOnary= Dictionary.create();
dictionary.indexFor("_unused"); // just to avoid using feature index 0
final Problem problem = encodeProblem(dictionary, trainingSet, parameters);
// Perform training
final Model model = Linear.train(problem, parameter);
// Compute model hash
final StringWriter writer = new StringWriter();
Linear.saveModel(writer, model);
final String modelString = writer.toString();
final String modelHash = computeHash(dictionary, modelString);
// Build and return the SVM object
return new LibLinearClassifier(parameters, modelHash, dictionary, model);
}
代码示例来源:origin: org.maltparser/maltparser
System.setOut(NoPrintStream.NO_PRINTSTREAM);
System.setErr(NoPrintStream.NO_PRINTSTREAM);
Linear.saveModel(new File(getFile(".mod").getAbsolutePath()), Linear.train(problem, getLiblinearParameters()));
System.setOut(err);
System.setOut(out);
代码示例来源:origin: org.clulab/processors
System.setOut(NoPrintStream.NO_PRINTSTREAM);
System.setErr(NoPrintStream.NO_PRINTSTREAM);
Linear.saveModel(new File(getFile(".mod").getAbsolutePath()), Linear.train(problem, getLiblinearParameters()));
System.setOut(err);
System.setOut(out);