Package org.ejml.simple

Examples of org.ejml.simple.SimpleMatrix.elementSum()


    for (int i = 0; i < output.numRows(); ++i) {
      for (int j = 0; j < output.numCols(); ++j) {
        output.set(i, j, Math.exp(output.get(i, j)));
      }
    }
    double sum = output.elementSum();
    // will be safe, since exp should never return 0
    return output.scale(1.0 / sum);
  }

  /**
 
View Full Code Here


        errorMatrix[(centroids.get(centroid).trainingExamples.get(trainingExample))] = centroids.get(centroid).features;
      }
    }   
    SimpleMatrix errorSimpleMatrix = new SimpleMatrix(errorMatrix).minus(datasetMatrix);
    errorSimpleMatrix = errorSimpleMatrix.mult(errorSimpleMatrix.transpose());
    double error = errorSimpleMatrix.elementSum() / (noFeatures * noTrainingExamples);
   
    LOGGER.info("Clustering completed - Error: " + Math.floor(error * 100) + "%");     

    return centroids;
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.