public ListDataSet searchSimilar(Sample sample, int start, int count) throws Exception { ListDataSet ds = ListDataSet.Factory.emptyDataSet(); try { List<Future<ListDataSet>> futures = new ArrayList<Future<ListDataSet>>(); for (Object key : getAlgorithmMap().keySet()) { Algorithm a = getAlgorithmMap().get(key); if (a instanceof SimilaritySearcher) { futures.add(executors.submit(new SearchSimilarFuture((SimilaritySearcher) a, sample, start, count))); } } for (Future<ListDataSet> f : futures) { ds.addAll(f.get()); } } catch (Exception e) { e.printStackTrace(); } return ds; }
public ListDataSet search(String query, int start, int count) throws Exception { ListDataSet ds = ListDataSet.Factory.emptyDataSet(); try { List<Future<ListDataSet>> futures = new ArrayList<Future<ListDataSet>>(); for (Object key : getAlgorithmMap().keySet()) { Algorithm a = getAlgorithmMap().get(key); if (a instanceof Index) { futures.add(executors.submit(new SearchFuture((Index) a, query, start, count))); } } for (Future<ListDataSet> f : futures) { ds.addAll(f.get()); } } catch (Exception e) { e.printStackTrace(); } return ds; }
public ListDataSet MNISTTest() throws IOException { ListDataSet ds = DataSet.Factory.emptyDataSet();
public synchronized ListDataSet searchSimilar(Sample sample, int start, int count) throws Exception { Term term = new Term(Sample.ID, sample.getId()); TermQuery tq = new TermQuery(term); TopDocs td = getIndexSearcher().search(tq, count); if (td == null || td.totalHits == 0) { ListDataSet ds = ListDataSet.Factory.emptyDataSet(); return ds; } MoreLikeThis mlt = new MoreLikeThis(indexSearcher.getIndexReader()); mlt.setFieldNames(new String[] { Variable.LABEL, Variable.DESCRIPTION, Variable.TAGS }); mlt.setMaxWordLen(MAXWORDLENGTH); Query query = mlt.like(td.scoreDocs[0].doc); BooleanQuery bq = new BooleanQuery(); bq.add(query, Occur.MUST); bq.add(new TermQuery(new Term("Id", sample.getId())), Occur.MUST_NOT); return search(bq, start, count); }
public ListDataSet MNISTTrain() throws IOException { ListDataSet ds = DataSet.Factory.emptyDataSet();
public Object call() { ListDataSet ds = ListDataSet.Factory.emptyDataSet(); if (getCoreObject() instanceof HasDataSetMap) { try { ((HasDataSetMap) getCoreObject()).getDataSetMap().add(ds); } catch (Exception e) { ds.showGUI(); } } else { ds.showGUI(); } return ds; }
public Map<String, Object> calculateObjects(Map<String, Object> input) { Map<String, Object> result = new HashMap<String, Object>(); ListDataSet iris = DataSet.Factory.emptyDataSet(); iris.setLabel("Iris flower data set"); iris.setMetaData(Sample.URL, "http://archive.ics.uci.edu/ml/datasets/Iris");