Package de.lmu.ifi.dbs.elki.data.model

Examples of de.lmu.ifi.dbs.elki.data.model.Model


     * @param c Clustering to inspect
     * @return the clustering cast to return a mean model, null otherwise.
     */
    @SuppressWarnings("unchecked")
    private static <NV extends NumberVector<NV, ?>> Clustering<MeanModel<NV>> findMeanModel(Clustering<?> c) {
      final Model firstModel = c.getAllClusters().get(0).getModel();
      if(c.getAllClusters().get(0).getModel() instanceof MeanModel<?> && firstModel instanceof EMModel<?>) {
        return (Clustering<MeanModel<NV>>) c;
      }
      return null;
    }
View Full Code Here


     * @param c Clustering to inspect
     * @return the clustering cast to return a mean model, null otherwise.
     */
    @SuppressWarnings("unchecked")
    private static Clustering<MeanModel<? extends NumberVector<?, ?>>> findMeanModel(Clustering<?> c) {
      final Model firstModel = c.getAllClusters().get(0).getModel();
      if(firstModel instanceof MeanModel<?> && !(firstModel instanceof EMModel<?>)) {
        return (Clustering<MeanModel<? extends NumberVector<?, ?>>>) c;
      }
      return null;
    }
View Full Code Here

    TextWriterStream out = new TextWriterStream(outStream, writers);
    printSettings(out, sr);

    // Write cluster information
    out.commentPrintLn("Cluster: " + naming.getNameFor(clus));
    Model model = clus.getModel();
    if (model != ClusterModel.CLUSTER) {
      TextWriterWriterInterface<?> mwri = writers.getHandler(model);
      mwri.writeObject(out, null, model);
    }
    if(clus.getParents().size() > 0) {
View Full Code Here

     * @param c Clustering to inspect
     * @return the clustering cast to return a mean model, null otherwise.
     */
    @SuppressWarnings("unchecked")
    private static <NV extends NumberVector<NV, ?>> Clustering<MeanModel<NV>> findMeanModel(Clustering<?> c) {
      final Model firstModel = c.getAllClusters().get(0).getModel();
      if(c.getAllClusters().get(0).getModel() instanceof MeanModel<?> && firstModel instanceof EMModel<?>) {
        return (Clustering<MeanModel<NV>>) c;
      }
      return null;
    }
View Full Code Here

    TextWriterStream out = new TextWriterStream(outStream, writers);
    printSettings(out, sr);

    // Write cluster information
    out.commentPrintLn("Cluster: " + naming.getNameFor(clus));
    Model model = clus.getModel();
    if(model != ClusterModel.CLUSTER && model != null) {
      TextWriterWriterInterface<?> mwri = writers.getHandler(model);
      mwri.writeObject(out, null, model);
    }
    if(clus.getParents().size() > 0) {
View Full Code Here

    bundle.appendColumn(TypeUtil.MODEL, new ArrayList<Model>());

    // generate clusters
    for(GeneratorInterface curclus : generators) {
      ClassLabel l = new SimpleClassLabel(curclus.getName());
      Model model = curclus.makeModel();
      int kept = 0;
      while(kept < curclus.getSize()) {
        // generate the "missing" number of points
        List<Vector> newp = curclus.generate(curclus.getSize() - kept);
        if(curclus instanceof GeneratorInterfaceDynamic) {
View Full Code Here

    }
    ArrayList<Model> models = new ArrayList<Model>();
    Map<Model, TIntList> modelMap = new HashMap<Model, TIntList>();
    { // Build a map from model to the actual objects
      for(int i = 0; i < data.dataLength(); i++) {
        Model model = (Model) data.data(i, modelcol);
        TIntList modelids = modelMap.get(model);
        if(modelids == null) {
          models.add(model);
          modelids = new TIntArrayList();
          modelMap.put(model, modelids);
View Full Code Here

   */
  public Clustering<Model> run(Relation<Model> relation) {
    // Build model mapping
    HashMap<Model, ModifiableDBIDs> modelMap = new HashMap<Model, ModifiableDBIDs>();
    for(DBID id : relation.iterDBIDs()) {
      Model model = relation.get(id);
      ModifiableDBIDs modelids = modelMap.get(model);
      if(modelids == null) {
        modelids = DBIDUtil.newHashSet();
        modelMap.put(model, modelids);
      }
      modelids.add(id);
    }

    Clustering<Model> result = new Clustering<Model>("By Model Clustering", "bymodel-clustering");
    for(Entry<Model, ModifiableDBIDs> entry : modelMap.entrySet()) {
      final Model model = entry.getKey();
      final ModifiableDBIDs ids = entry.getValue();
      final String name = (model instanceof GeneratorInterface) ? ((GeneratorInterface) model).getName() : model.toString();
      Cluster<Model> c = new Cluster<Model>(name, ids, model);
      if(noisepattern != null && noisepattern.matcher(name).find()) {
        c.setNoise(true);
      }
      result.addCluster(c);
View Full Code Here

    // Adjustment constant
    final double minscore = expect / (expect + 1);
   
    HashSet<GeneratorSingleCluster> generators = new HashSet<GeneratorSingleCluster>();
    for(DBID id : models.iterDBIDs()) {
      Model model = models.get(id);
      if(model instanceof GeneratorSingleCluster) {
        generators.add((GeneratorSingleCluster) model);
      }
    }
    if(generators.size() == 0) {
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.data.model.Model

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.