本文整理了Java中cc.mallet.types.InstanceList.load()
方法的一些代码示例,展示了InstanceList.load()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InstanceList.load()
方法的具体详情如下:
包路径:cc.mallet.types.InstanceList
类名称:InstanceList
方法名:load
[英]Constructs a new InstanceList
, deserialized from file
. If the string value of file
is "-", then deserialize from System.in.
[中]构造一个新的InstanceList
,从file
反序列化。如果file
的字符串值为“-”,则从系统反序列化。在里面
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main(String[] args) throws Exception {
InstanceList data = InstanceList.load(new File(args[0]));
CoordinateDescent trainer = new CoordinateDescent(data, Double.parseDouble(args[1]));
System.out.println(trainer);
}
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main(String[] args) throws Exception {
InstanceList data = InstanceList.load(new File(args[0]));
CoordinateDescent trainer = new CoordinateDescent(data, Double.parseDouble(args[1]));
System.out.println(trainer);
}
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main (String[] args) throws IOException {
InstanceList training = InstanceList.load (new File(args[0]));
int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;
InstanceList testing =
args.length > 2 ? InstanceList.load (new File(args[2])) : null;
LDAHyper lda = new LDAHyper (numTopics, 50.0, 0.01);
lda.printLogLikelihood = true;
lda.setTopicDisplay(50,7);
lda.addInstances(training);
lda.estimate();
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main (String[] args) throws IOException {
InstanceList training = InstanceList.load (new File(args[0]));
int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;
InstanceList testing =
args.length > 2 ? InstanceList.load (new File(args[2])) : null;
LDAHyper lda = new LDAHyper (numTopics, 50.0, 0.01);
lda.printLogLikelihood = true;
lda.setTopicDisplay(50,7);
lda.addInstances(training);
lda.estimate();
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main (String[] args) throws IOException {
InstanceList training = InstanceList.load (new File(args[0]));
int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;
SimpleLDA lda = new SimpleLDA (numTopics, 50.0, 0.01);
lda.addInstances(training);
lda.sample(1000);
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main (String[] args)
{
InstanceList ilist = InstanceList.load (new File(args[0]));
int numIterations = args.length > 1 ? Integer.parseInt(args[1]) : 1000;
int numTopWords = args.length > 2 ? Integer.parseInt(args[2]) : 20;
System.out.println ("Data loaded.");
TopicalNGrams tng = new TopicalNGrams (10);
tng.estimate (ilist, 200, 1, 0, null, new Randoms());
tng.printTopWords (60, true);
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args)
{
InstanceList ilist = InstanceList.load (new File(args[0]));
int numIterations = args.length > 1 ? Integer.parseInt(args[1]) : 1000;
int numTopWords = args.length > 2 ? Integer.parseInt(args[2]) : 20;
System.out.println ("Data loaded.");
TopicalNGrams tng = new TopicalNGrams (10);
tng.estimate (ilist, 200, 1, 0, null, new Randoms());
tng.printTopWords (60, true);
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws IOException {
InstanceList training = InstanceList.load (new File(args[0]));
int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;
NPTopicModel lda = new NPTopicModel (5.0, 10.0, 0.1);
lda.addInstances(training, numTopics);
lda.sample(1000);
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws IOException {
InstanceList training = InstanceList.load (new File(args[0]));
int numTopics = args.length > 1 ? Integer.parseInt(args[1]) : 200;
SimpleLDA lda = new SimpleLDA (numTopics, 50.0, 0.01);
lda.addInstances(training);
lda.sample(1000);
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws Exception {
InstanceList data = InstanceList.load(new File(args[0]));
LeastSquares ls = null;
if (args.length > 1) {
ls = new LeastSquares(data, Double.parseDouble(args[1]));
}
else {
ls = new LeastSquares(data);
}
ls.printSummary();
}
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main (String[] args)
{
InstanceList ilist = InstanceList.load (new File(args[0]));
int numIterations = args.length > 1 ? Integer.parseInt(args[1]) : 1000;
int numTopWords = args.length > 2 ? Integer.parseInt(args[2]) : 20;
System.out.println ("Data loaded.");
TopicalNGrams tng = new TopicalNGrams (10);
tng.estimate (ilist, 200, 1, 0, null, new Randoms());
tng.printTopWords (60, true);
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws IOException
{
InstanceList ilist = InstanceList.load (new File(args[0]));
int numIterations = args.length > 1 ? Integer.parseInt(args[1]) : 1000;
int numTopWords = args.length > 2 ? Integer.parseInt(args[2]) : 20;
System.out.println ("Data loaded.");
LDA lda = new LDA (10);
lda.estimate (ilist, numIterations, 50, 0, null, new Randoms()); // should be 1100
lda.printTopWords (numTopWords, true);
lda.printDocumentTopics (new File(args[0]+".lda"));
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main (String[] args) throws IOException
{
InstanceList ilist = InstanceList.load (new File(args[0]));
int numIterations = args.length > 1 ? Integer.parseInt(args[1]) : 1000;
int numTopWords = args.length > 2 ? Integer.parseInt(args[2]) : 20;
System.out.println ("Data loaded.");
LDA lda = new LDA (10);
lda.estimate (ilist, numIterations, 50, 0, null, new Randoms()); // should be 1100
lda.printTopWords (numTopWords, true);
lda.printDocumentTopics (new File(args[0]+".lda"));
}
代码示例来源:origin: cc.mallet/mallet
public static void main(String[] args) throws Exception {
CommandOption.setSummary (Regression.class, "Run a regression, print the learned parameters");
CommandOption.process (Regression.class, args);
InstanceList data = InstanceList.load(new File(inputFile.value));
double regularization = regularizationOption.value;
Regression regression = new Regression(data, regularization);
if (outputFile.value != null) {
regression.printParameters(outputFile.value);
}
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main(String[] args) throws Exception {
CommandOption.setSummary (Regression.class, "Run a regression, print the learned parameters");
CommandOption.process (Regression.class, args);
InstanceList data = InstanceList.load(new File(inputFile.value));
double regularization = regularizationOption.value;
Regression regression = new Regression(data, regularization);
if (outputFile.value != null) {
regression.printParameters(outputFile.value);
}
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws Exception {
InstanceList data = InstanceList.load(new File(args[0]));
LinearRegressionTrainer trainer = new LinearRegressionTrainer(data);
Optimizer optimizer = new OrthantWiseLimitedMemoryBFGS(trainer);
//Optimizer optimizer = new LimitedMemoryBFGS(trainer);
optimizer.optimize();
optimizer.optimize();
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws Exception {
InstanceList instances = InstanceList.load(new File(args[0]));
ParallelTopicModel model = new ParallelTopicModel(50, 5.0, 0.01);
model.addInstances(instances);
model.setNumIterations(100);
model.estimate();
TopicReports reports = new JSONTopicReports(model);
reports.printSummary(new File("summary.json"), 20);
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main (String[] args) throws Exception {
CommandOption.setSummary (FeatureCountTool.class,
"Print feature counts and instances per feature (eg document frequencies) in an instance list");
CommandOption.process (FeatureCountTool.class, args);
InstanceList instances = InstanceList.load (new File(inputFile.value));
FeatureCountTool counter = new FeatureCountTool(instances);
counter.count();
counter.printCounts();
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws Exception {
CommandOption.setSummary (FeatureCooccurrenceCounter.class,
"Build a file containing weights between word types");
CommandOption.process (FeatureCooccurrenceCounter.class, args);
InstanceList training = InstanceList.load (new File(inputFile.value));
FeatureCooccurrenceCounter counter = new FeatureCooccurrenceCounter(training);
counter.count();
counter.printCounts();
}
代码示例来源:origin: cc.mallet/mallet
public static void main (String[] args) throws Exception {
CommandOption.setSummary (FeatureCountTool.class,
"Print feature counts and instances per feature (eg document frequencies) in an instance list");
CommandOption.process (FeatureCountTool.class, args);
InstanceList instances = InstanceList.load (new File(inputFile.value));
FeatureCountTool counter = new FeatureCountTool(instances);
counter.count();
counter.printCounts();
}
内容来源于网络,如有侵权,请联系作者删除!