public QNModel constructModel() throws IOException { String[] outcomeLabels = getOutcomes(); int[][] outcomePatterns = getOutcomePatterns(); String[] predLabels = getPredicates(); Context[] params = getParameters(outcomePatterns); return new QNModel(params, predLabels, outcomeLabels); } }
@Override public void checkModelType() throws IOException { String modelType = readUTF(); if (!modelType.equals("QN")) System.out.println("Error: attempting to load a " + modelType + " model as a MAXENT_QN model." + " You should expect problems."); }
readInt(); readDouble(); String[] outcomeLabels = getOutcomes(); int[][] outcomePatterns = getOutcomePatterns(); String[] predLabels = getPredicates(); Context[] params = getParameters(outcomePatterns); return new GISModel(params, predLabels, outcomeLabels);
@Override public void persist() throws IOException { writeUTF("QN"); writeInt(OUTCOME_LABELS.length); writeUTF(OUTCOME_LABELS[i]); ComparablePredicate[] sorted = sortValues(); List<List<ComparablePredicate>> compressed = compressOutcomes(sorted); writeInt(compressed.size()); writeUTF(a.size() + a.get(0).toString()); writeInt(PARAMS.length); writeUTF(sorted[i].name); writeDouble(sorted[i].params[j]); close();
writeUTF("GIS"); writeInt(1); writeDouble(1); writeInt(OUTCOME_LABELS.length); writeUTF(OUTCOME_LABEL); ComparablePredicate[] sorted = sortValues(); List<List<ComparablePredicate>> compressed = compressOutcomes(sorted); writeInt(compressed.size()); writeUTF(aCompressed.size() + ((List<?>) aCompressed).get(0).toString()); writeInt(PARAMS.length); writeUTF(aSorted.name); writeDouble(aSorted.params[j]); close();
private void init(AbstractModel model, DataOutputStream dos) { if (model.getModelType() == ModelType.Perceptron) { delegateWriter = new BinaryPerceptronModelWriter(model, dos); } else if (model.getModelType() == ModelType.Maxent) { delegateWriter = new BinaryGISModelWriter(model, dos); } else if (model.getModelType() == ModelType.MaxentQn) { delegateWriter = new BinaryQNModelWriter(model, dos); } if (model.getModelType() == ModelType.NaiveBayes) { delegateWriter = new BinaryNaiveBayesModelWriter(model, dos); } }
public void checkModelType() throws IOException { String modelType = readUTF(); switch (modelType) { case "Perceptron": delegateModelReader = new PerceptronModelReader(this.dataReader); break; case "GIS": delegateModelReader = new GISModelReader(this.dataReader); break; case "QN": delegateModelReader = new QNModelReader(this.dataReader); break; case "NaiveBayes": delegateModelReader = new NaiveBayesModelReader(this.dataReader); break; default: throw new IOException("Unknown model format: " + modelType); } }
public void checkModelType() throws java.io.IOException { String modelType = readUTF(); if (!modelType.equals("GIS")) System.out.println("Error: attempting to load a " + modelType + " model as a GIS model." + " You should expect problems."); } }
public void trainModel() throws IOException { new SuffixSensitiveGISModelWriter(GIS.trainModel( ObjectStreamUtils.createObjectStream(events),100,10), new File(modelName + modelExtension)).persist(); } }
private SimilarityModel(String modelName, boolean train) throws IOException { this.modelName = modelName; if (train) { events = new ArrayList<Event>(); } else { testModel = (new SuffixSensitiveGISModelReader(new File(modelName + modelExtension))).getModel(); SAME_INDEX = testModel.getIndex(SAME); } }
public QNModel constructModel() throws IOException { String[] outcomeLabels = getOutcomes(); int[][] outcomePatterns = getOutcomePatterns(); String[] predLabels = getPredicates(); Context[] params = getParameters(outcomePatterns); return new QNModel(params, predLabels, outcomeLabels); } }
private void init(AbstractModel model, EncryptedDataOutputStream dos) { if (model.getModelType() == ModelType.Perceptron) { delegateWriter = new BinaryPerceptronModelWriter(model, dos); } else if (model.getModelType() == ModelType.Maxent) { delegateWriter = new BinaryGISModelWriter(model, dos); } else if (model.getModelType() == ModelType.MaxentQn) { delegateWriter = new BinaryQNModelWriter(model, dos); } if (model.getModelType() == ModelType.NaiveBayes) { delegateWriter = new BinaryNaiveBayesModelWriter(model, dos); } }
public void checkModelType() throws IOException { String modelType = readUTF(); switch (modelType) { case "Perceptron": delegateModelReader = new PerceptronModelReader(this.dataReader); break; case "GIS": delegateModelReader = new GISModelReader(this.dataReader); break; case "QN": delegateModelReader = new QNModelReader(this.dataReader); break; case "NaiveBayes": delegateModelReader = new NaiveBayesModelReader(this.dataReader); break; default: throw new IOException("Unknown model format: " + modelType); } }
@Override public void checkModelType() throws IOException { String modelType = readUTF(); if (!modelType.equals("QN")) System.out.println("Error: attempting to load a " + modelType + " model as a MAXENT_QN model." + " You should expect problems."); }
public void checkModelType() throws java.io.IOException { String modelType = readUTF(); if (!modelType.equals("GIS")) System.out.println("Error: attempting to load a " + modelType + " model as a GIS model." + " You should expect problems."); } }
public QNModel constructModel() throws IOException { String[] outcomeLabels = getOutcomes(); int[][] outcomePatterns = getOutcomePatterns(); String[] predLabels = getPredicates(); Context[] params = getParameters(outcomePatterns); return new QNModel(params, predLabels, outcomeLabels); } }
private void init(AbstractModel model, DataOutputStream dos) { if (model.getModelType() == ModelType.Perceptron) { delegateWriter = new BinaryPerceptronModelWriter(model, dos); } else if (model.getModelType() == ModelType.Maxent) { delegateWriter = new BinaryGISModelWriter(model, dos); } else if (model.getModelType() == ModelType.MaxentQn) { delegateWriter = new BinaryQNModelWriter(model, dos); } if (model.getModelType() == ModelType.NaiveBayes) { delegateWriter = new BinaryNaiveBayesModelWriter(model, dos); } }
public void checkModelType() throws IOException { String modelType = readUTF(); switch (modelType) { case "Perceptron": delegateModelReader = new PerceptronModelReader(this.dataReader); break; case "GIS": delegateModelReader = new GISModelReader(this.dataReader); break; case "QN": delegateModelReader = new QNModelReader(this.dataReader); break; case "NaiveBayes": delegateModelReader = new NaiveBayesModelReader(this.dataReader); break; default: throw new IOException("Unknown model format: " + modelType); } }
@Override public void checkModelType() throws IOException { String modelType = readUTF(); if (!modelType.equals("QN")) System.out.println("Error: attempting to load a " + modelType + " model as a MAXENT_QN model." + " You should expect problems."); }
public void checkModelType() throws java.io.IOException { String modelType = readUTF(); if (!modelType.equals("GIS")) System.out.println("Error: attempting to load a " + modelType + " model as a GIS model." + " You should expect problems."); } }