it.unimi.dsi.fastutil.floats.FloatSet Java Examples

The following examples show how to use it.unimi.dsi.fastutil.floats.FloatSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProbabilisticGraphicalModel.java    From jstarcraft-rns with Apache License 2.0 6 votes vote down vote up
/**
 * setup init member method
 *
 * @throws ModelException if error occurs during setting up
 */
@Override
public void prepare(Configurator configuration, DataModule model, DataSpace space) {
    super.prepare(configuration, model, space);
    factorSize = configuration.getInteger("recommender.topic.number", 10);
    burnIn = configuration.getInteger("recommender.pgm.burnin", 100);
    sampleSize = configuration.getInteger("recommender.pgm.samplelag", 100);

    // TODO 此处会与scoreIndexes一起重构,本质为连续特征离散化.
    FloatSet scores = new FloatRBTreeSet();
    for (MatrixScalar term : scoreMatrix) {
        scores.add(term.getValue());
    }
    scores.remove(0F);
    scoreIndexes = new Float2IntLinkedOpenHashMap();
    int index = 0;
    for (float score : scores) {
        scoreIndexes.put(score, index++);
    }
    scoreSize = scoreIndexes.size();
}
 
Example #2
Source File: PersonalityDiagnosisModel.java    From jstarcraft-rns with Apache License 2.0 5 votes vote down vote up
/**
 * initialization
 *
 * @throws ModelException if error occurs
 */
@Override
public void prepare(Configurator configuration, DataModule model, DataSpace space) {
    super.prepare(configuration, model, space);
    prior = 1F / userSize;
    sigma = configuration.getFloat("recommender.PersonalityDiagnosis.sigma");

    FloatSet sorts = new FloatRBTreeSet();
    for (MatrixScalar term : scoreMatrix) {
        sorts.add(term.getValue());
    }
    sorts.remove(0F);
    scores = new FloatArrayList(sorts);
}
 
Example #3
Source File: FloatColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public FloatColumn unique() {
  final FloatSet values = new FloatOpenHashSet();
  for (int i = 0; i < size(); i++) {
    values.add(getFloat(i));
  }
  final FloatColumn column = FloatColumn.create(name() + " Unique values");
  for (float value : values) {
    column.append(value);
  }
  return column;
}
 
Example #4
Source File: FloatColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public int countUnique() {
  FloatSet uniqueElements = new FloatOpenHashSet();
  for (int i = 0; i < size(); i++) {
    uniqueElements.add(getFloat(i));
  }
  return uniqueElements.size();
}
 
Example #5
Source File: FloatColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public FloatColumn unique() {
  final FloatSet values = new FloatOpenHashSet();
  for (int i = 0; i < size(); i++) {
    values.add(getFloat(i));
  }
  final FloatColumn column = FloatColumn.create(name() + " Unique values");
  for (float value : values) {
    column.append(value);
  }
  return column;
}
 
Example #6
Source File: FloatColumn.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Override
public int countUnique() {
  FloatSet uniqueElements = new FloatOpenHashSet();
  for (int i = 0; i < size(); i++) {
    uniqueElements.add(getFloat(i));
  }
  return uniqueElements.size();
}
 
Example #7
Source File: ValueInTransformFunction.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
private static float[] filterFloats(FloatSet floatSet, float[] source) {
  FloatList floatList = new FloatArrayList();
  for (float value : source) {
    if (floatSet.contains(value)) {
      floatList.add(value);
    }
  }
  if (floatList.size() == source.length) {
    return source;
  } else {
    return floatList.toFloatArray();
  }
}