Exemplo n.º 1
0
 protected AbstractCluster(Vector center2, Vector radius2, int id2) {
   setNumObservations(0);
   setTotalObservations(0);
   setCenter(new RandomAccessSparseVector(center2));
   setRadius(new RandomAccessSparseVector(radius2));
   setS0(0);
   setS1(center.like());
   setS2(center.like());
   this.id = id2;
 }
Exemplo n.º 2
0
 @Override
 public void computeParameters() {
   if (getS0() == 0) {
     return;
   }
   setNumObservations((long) getS0());
   setTotalObservations(getTotalObservations() + getNumObservations());
   setCenter(getS1().divide(getS0()));
   // compute the component stds
   if (getS0() > 1) {
     setRadius(
         getS2()
             .times(getS0())
             .minus(getS1().times(getS1()))
             .assign(new SquareRootFunction())
             .divide(getS0()));
   }
   setS0(0);
   setS1(center.like());
   setS2(center.like());
 }