当前位置: 首页>>代码示例>>Java>>正文


Java Clusterer类代码示例

本文整理汇总了Java中weka.clusterers.Clusterer的典型用法代码示例。如果您正苦于以下问题:Java Clusterer类的具体用法?Java Clusterer怎么用?Java Clusterer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Clusterer类属于weka.clusterers包,在下文中一共展示了Clusterer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFinalizedClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
public Clusterer getFinalizedClusterer() throws DistributedWekaException {
  if (m_canopy == null) {
    throw new DistributedWekaException(
      "CanopyMapTask has not been initialized yet!");
  }

  if (!m_finalized) {
    throw new DistributedWekaException(
      "This map task has note been finalized yet!");
  }

  if (m_finalFullPreprocess == null) {
    return m_canopy;
  }

  PreconstructedFilteredClusterer fc = new PreconstructedFilteredClusterer();
  fc.setFilter((Filter) m_finalFullPreprocess);
  fc.setClusterer(m_canopy);

  return fc;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:22,代码来源:CanopyMapTask.java

示例2: makeFinalClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Make the final PreconstructedKMeans clusterer to wrap the centroids and
 * stats found during map-reduce.
 * 
 * @param best the best result from the runs of k-means that were performed in
 *          parallel
 * @param preprocess any pre-processing filters applied
 * @param initialStartingPoints the initial starting centroids
 * @param finalNumIterations the final number of iterations performed
 * @return a final clusterer object
 * @throws DistributedWekaException if a problem occurs
 */
protected Clusterer makeFinalClusterer(KMeansReduceTask best,
  Filter preprocess, Instances initialStartingPoints, int finalNumIterations)
  throws DistributedWekaException {

  Clusterer finalClusterer = null;
  PreconstructedKMeans finalKMeans = new PreconstructedKMeans();
  // global priming data for the distance function (this will be in
  // the transformed space if we're using preprocessing filters)
  Instances globalPrimingData = best.getGlobalDistanceFunctionPrimingData();
  NormalizableDistance dist = new EuclideanDistance();
  dist.setInstances(globalPrimingData);
  finalKMeans.setClusterCentroids(best.getCentroidsForRun());
  finalKMeans.setFinalNumberOfIterations(finalNumIterations + 1);
  if (initialStartingPoints != null) {
    finalKMeans.setInitialStartingPoints(initialStartingPoints);
  }
  try {
    finalKMeans.setDistanceFunction(dist);
    finalKMeans.setClusterStats(best.getAggregatedCentroidSummaries());
  } catch (Exception e) {
    throw new DistributedWekaException(e);
  }

  if (!getInitWithRandomCentroids()) {
    finalKMeans.setInitializationMethod(new SelectedTag(
      SimpleKMeans.KMEANS_PLUS_PLUS, SimpleKMeans.TAGS_SELECTION));
  }

  finalKMeans.setDisplayStdDevs(getDisplayCentroidStdDevs());

  finalClusterer = finalKMeans;

  if (preprocess != null) {
    PreconstructedFilteredClusterer fc =
      new PreconstructedFilteredClusterer();
    fc.setFilter(preprocess);
    fc.setClusterer(finalKMeans);
    finalClusterer = fc;
  }

  return finalClusterer;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:55,代码来源:KMeansClustererHadoopJob.java

示例3: createScorer

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Static factory method to create an appropriate concrete ScoringModel
 * given a particular base model
 *
 * @param model the model to wrap in a ScoringModel
 * @return a concrete subclass of ScoringModel
 * @throws Exception if a problem occurs
 */
public static ScoringModel createScorer(Object model) throws Exception {
  if (model instanceof Classifier) {
    return new ClassifierScoringModel(model);
  } else if (model instanceof Clusterer) {
    return new ClustererScoringModel(model);
  }
  return null;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:17,代码来源:WekaScoringMapTask.java

示例4: BatchClustererEvent

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Creates a new <code>BatchClustererEvent</code> instance.
 *
 * @param source the source object
 * @param scheme a Clusterer
 * @param tstI the training/test instances
 * @param setNum the set number of the training/testinstances
 * @param maxSetNum the last set number in the series
 * @param testOrTrain 0 if the set is a test set, >0 if it is a training set
 */
public BatchClustererEvent(Object source, Clusterer scheme, DataSetEvent tstI, int setNum, int maxSetNum, int testOrTrain) {
  super(source);
  //    m_trainingSet = trnI;
  m_clusterer = scheme;
  m_testSet = tstI;
  m_setNumber = setNum;
  m_maxSetNumber = maxSetNum;
  if(testOrTrain == 0)
      m_testOrTrain = TEST;
  else
      m_testOrTrain = TRAINING;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:23,代码来源:BatchClustererEvent.java

示例5: getClustererSpec

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Gets the clusterer specification string, which contains the class name of
 * the clusterer and any options to the clusterer.
 * 
 * @return the clusterer string.
 */
protected String getClustererSpec() {
  Clusterer c = getClusterer();
  if (c instanceof OptionHandler) {
    return c.getClass().getName() + " "
      + Utils.joinOptions(((OptionHandler) c).getOptions());
  }
  return c.getClass().getName();
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:15,代码来源:AddCluster.java

示例6: getClustererSpec

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
  * Gets the clusterer specification string, which contains the class name of
  * the clusterer and any options to the clusterer.
  *
  * @return the clusterer string.
  */
 protected String getClustererSpec() {
   Clusterer c = getClusterer();
   if (c instanceof OptionHandler) {
     return c.getClass().getName() + " "
+ Utils.joinOptions(((OptionHandler)c).getOptions());
   }
   return c.getClass().getName();
 }
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:15,代码来源:AddCluster.java

示例7: getClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * returns a configured cluster algorithm
 */
protected Clusterer getClusterer() {
  EM c = new EM();
  try {
    c.setOptions(new String[0]);
  }
  catch (Exception e) {
    e.printStackTrace();
  }
  return c;
}
 
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:14,代码来源:AddClusterTest.java

示例8: getClustererSpec

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
  * Gets the clusterer specification string, which contains the class name of
  * the clusterer and any options to the clusterer.
  *
  * @return the clusterer string.
  */
 protected String getClustererSpec() {
   
   Clusterer c = getClusterer();
   if (c instanceof OptionHandler) {
     return c.getClass().getName() + " "
+ Utils.joinOptions(((OptionHandler)c).getOptions());
   }
   return c.getClass().getName();
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:16,代码来源:AddCluster.java

示例9: createScorer

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Static factory method to create an instance of an appropriate subclass of
 * WekaScoringModel given a Weka model.
 * 
 * @param model a Weka model
 * @return an appropriate WekaScoringModel for this type of Weka model
 * @exception Exception if an error occurs
 */
public static WekaScoringModel createScorer(Object model) throws Exception {
  if (model instanceof Classifier) {
    return new WekaScoringClassifier(model);
  } else if (model instanceof Clusterer) {
    return new WekaScoringClusterer(model);
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pdi-weka-scoring-plugin,代码行数:17,代码来源:WekaScoringModel.java

示例10: ClassifierWrapper

import weka.clusterers.Clusterer; //导入依赖的package包/类
public ClassifierWrapper(Clusterer clusterer) {
    this.clusterer = clusterer;
    this.wrapperType = WRAPPERTYPE_CLUSTERER;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:5,代码来源:ClassifierWrapper.java

示例11: getClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
public Clusterer getClusterer() {
    return clusterer;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:4,代码来源:ClassifierWrapper.java

示例12: setClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
public void setClusterer(Clusterer clusterer) {
    this.clusterer = clusterer;
    this.wrapperType = WRAPPERTYPE_CLUSTERER;
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:5,代码来源:ClassifierWrapper.java

示例13: getClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
@Override
public Clusterer getClusterer() {
  return m_finalClusterer;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:5,代码来源:KMeansClustererHadoopJob.java

示例14: setModel

import weka.clusterers.Clusterer; //导入依赖的package包/类
@Override
public void setModel(Object model) {
  m_model = (Clusterer) model;

}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:6,代码来源:WekaScoringMapTask.java

示例15: saveClusterer

import weka.clusterers.Clusterer; //导入依赖的package包/类
/**
 * Saves the currently selected clusterer
 */
protected void saveClusterer(String name, Clusterer clusterer,
  Instances trainHeader, int[] ignoredAtts) {

  File sFile = null;
  boolean saveOK = true;

  int returnVal = m_FileChooser.showSaveDialog(this);
  if (returnVal == JFileChooser.APPROVE_OPTION) {
    sFile = m_FileChooser.getSelectedFile();
    if (!sFile.getName().toLowerCase().endsWith(MODEL_FILE_EXTENSION)) {
      sFile = new File(sFile.getParent(), sFile.getName()
        + MODEL_FILE_EXTENSION);
    }
    m_Log.statusMessage("Saving model to file...");

    try {
      OutputStream os = new FileOutputStream(sFile);
      if (sFile.getName().endsWith(".gz")) {
        os = new GZIPOutputStream(os);
      }
      ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
      objectOutputStream.writeObject(clusterer);
      if (trainHeader != null) {
        objectOutputStream.writeObject(trainHeader);
      }
      if (ignoredAtts != null) {
        objectOutputStream.writeObject(ignoredAtts);
      }
      objectOutputStream.flush();
      objectOutputStream.close();
    } catch (Exception e) {

      JOptionPane.showMessageDialog(null, e, "Save Failed",
        JOptionPane.ERROR_MESSAGE);
      saveOK = false;
    }
    if (saveOK) {
      m_Log.logMessage("Saved model (" + name + ") to file '"
        + sFile.getName() + "'");
    }
    m_Log.statusMessage("OK");
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:47,代码来源:ClustererPanel.java


注:本文中的weka.clusterers.Clusterer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。