Tabnine Logo
NumericVectorFeature
Code IndexAdd Tabnine to your IDE (free)

How to use
NumericVectorFeature
in
com.oculusinfo.ml.feature.numeric

Best Java code snippets using com.oculusinfo.ml.feature.numeric.NumericVectorFeature (Showing top 8 results out of 315)

origin: unchartedsoftware/ensemble-clustering

@Override
public NumericVectorFeature getCentroid() {
  // create the centroid geospatial feature set
  NumericVectorFeature mean = new NumericVectorFeature(name);
  
  mean.setValue(meanVector);
  mean.setWeight(weight);
      
  return mean;
}
origin: unchartedsoftware/ensemble-clustering

@Override
public String toString() {
  return (this.getName() + ":" + vectorToString());
}

origin: unchartedsoftware/ensemble-clustering

@Override
public void remove(NumericVectorFeature feature) {
  double removedWeight = feature.getWeight();
  double newWeight = weight - removedWeight;
  if (0.0 == weight) return;
  // decrement centroid vector
  for (int i=0; i < meanVector.length; i++) {
    meanVector[i] = (meanVector[i] * weight - feature.getValue()[i] * removedWeight) / newWeight;
  }
  weight = newWeight;
}
origin: unchartedsoftware/ensemble-clustering

  public NumericVectorFeature fieldToNumericVectorFeature(String name) {
    Field field = fields.get(name);
    
    if (field == null) return null;
    
    NumericVectorFeature feature = null;
    
    try {
      feature = new NumericVectorFeature(field.name);
    
      String val = field.value.substring(1, field.value.length()-1);  // strip off enclosing [ ]
    
      if (val.isEmpty()) return null;
      
      String[] entries = val.split(";");
    
      double[] vector = new double[entries.length];
    
      for (int i=0; i < entries.length; i++) {
        if (entries[i].isEmpty()) continue;
        vector[i] = Double.parseDouble(entries[i]);
      }
      feature.setValue(vector);
    }
    catch (Exception e) {
      e.printStackTrace();
    }    
    return feature;
  }
}
origin: unchartedsoftware/ensemble-clustering

public void setValue(List<Double> vector) {
  setValue(new ArrayList<Double>(vector));
}

origin: unchartedsoftware/ensemble-clustering

  @Override
  public double distance(NumericVectorFeature x, NumericVectorFeature y) {
    double[] vector1 = x.getValue();
    double[] vector2 = y.getValue();
    
    double d = 0;
    for (int i = 0; i < vector1.length; i++) {
      d += Math.pow(vector1[i] - vector2[i], 2);
    }
    
    // return euclidean distance
    return Math.sqrt( d / (double)vector1.length );
  }
}
origin: unchartedsoftware/ensemble-clustering

double[] meanVector = ((NumericVectorFeature)allFeatures.get(0)).getValue().clone();
  double[] vals = v.getValue();
  double[] vals = v.getValue();
  double[] vals = v.getValue();
origin: unchartedsoftware/ensemble-clustering

@Override
public void add(NumericVectorFeature feature) {
  double addedWeight = feature.getWeight();
  double newWeight = weight + addedWeight;
  if (meanVector == null) {
    if (feature.getValue() != null) {
      meanVector = feature.getValue().clone();
      weight = addedWeight;
    }
  }
  else {
    if (feature.getValue() != null) {
      // incrementally revise the centroid vector
      for (int i=0; i < meanVector.length; i++) {
        meanVector[i] = (meanVector[i] * weight + feature.getValue()[i] * addedWeight) / newWeight;
      }
      weight = newWeight;
    }
  }
}
com.oculusinfo.ml.feature.numericNumericVectorFeature

Javadoc

A NumericVectorFeature represents a vector of double precision numbers. Useful for representing a large class of data that is numeric in nature or can be encoded as such

Most used methods

  • <init>
  • setValue
  • getName
  • getValue
  • getWeight
  • setWeight
  • vectorToString

Popular in Java

  • Making http post requests using okhttp
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now