Java 类weka.core.Aggregateable 实例源码

项目:repo.kmeanspp.silhouette_score    文件:AggregateableFilteredClassifier.java   
@SuppressWarnings("unchecked")
@Override
public AggregateableFilteredClassifier aggregate(
  AggregateableFilteredClassifier toAggregate) throws Exception {

  if (!(getClassifier() instanceof Aggregateable)) {
    throw new IllegalArgumentException(
      "Can't aggregate because base classifier is not Aggregateable!");
  }

  if (!getClassifier().getClass().isAssignableFrom(
    toAggregate.getClassifier().getClass())) {
    throw new IllegalArgumentException(
      "The base classifier to aggregate is not of the same "
        + "type as our base classifier!");
  }

  ((Aggregateable) getClassifier()).aggregate(toAggregate.getClassifier());

  return this;
}
项目:repo.kmeanspp.silhouette_score    文件:NaiveBayes.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public NaiveBayes aggregate(NaiveBayes toAggregate) throws Exception {

  // Highly unlikely that discretization intervals will match between the
  // two classifiers
  if (m_UseDiscretization || toAggregate.getUseSupervisedDiscretization()) {
    throw new Exception("Unable to aggregate when supervised discretization "
      + "has been turned on");
  }

  if (!m_Instances.equalHeaders(toAggregate.m_Instances)) {
    throw new Exception("Can't aggregate - data headers don't match: "
      + m_Instances.equalHeadersMsg(toAggregate.m_Instances));
  }

  ((Aggregateable) m_ClassDistribution)
    .aggregate(toAggregate.m_ClassDistribution);

  // aggregate all conditional estimators
  for (int i = 0; i < m_Distributions.length; i++) {
    for (int j = 0; j < m_Distributions[i].length; j++) {
      ((Aggregateable) m_Distributions[i][j])
        .aggregate(toAggregate.m_Distributions[i][j]);
    }
  }

  return this;
}
项目:umple    文件:NaiveBayes.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public NaiveBayes aggregate(NaiveBayes toAggregate) throws Exception {

  // Highly unlikely that discretization intervals will match between the
  // two classifiers
  if (m_UseDiscretization || toAggregate.getUseSupervisedDiscretization()) {
    throw new Exception("Unable to aggregate when supervised discretization "
      + "has been turned on");
  }

  if (!m_Instances.equalHeaders(toAggregate.m_Instances)) {
    throw new Exception("Can't aggregate - data headers don't match: "
      + m_Instances.equalHeadersMsg(toAggregate.m_Instances));
  }

  ((Aggregateable) m_ClassDistribution)
    .aggregate(toAggregate.m_ClassDistribution);

  // aggregate all conditional estimators
  for (int i = 0; i < m_Distributions.length; i++) {
    for (int j = 0; j < m_Distributions[i].length; j++) {
      ((Aggregateable) m_Distributions[i][j])
        .aggregate(toAggregate.m_Distributions[i][j]);
    }
  }

  return this;
}
项目:repo.kmeanspp.silhouette_score    文件:AggregateableFilteredClassifier.java   
@Override
public void finalizeAggregation() throws Exception {

  ((Aggregateable) getClassifier()).finalizeAggregation();
}