Tabnine Logo
StatsUtils.clamp
Code IndexAdd Tabnine to your IDE (free)

How to use
clamp
method
in
net.semanticmetadata.lire.utils.StatsUtils

Best Java code snippets using net.semanticmetadata.lire.utils.StatsUtils.clamp (Showing top 6 results out of 315)

origin: dermotte/LIRE

private LinkedList<keypoint> createGaussRndPts(int width, int height, int samples) {
  Random ran = new Random();
  int size, x, y;
  keypoint key;
  LinkedList<keypoint> keypointsList = new LinkedList<keypoint>();
  sizeLookUp = getLookupTable(Math.min(width, height)/4);
  for (int i = 0; i < samples; i++) {
    size = sizeLookUp[ran.nextInt(sizeLookUp.length)];
    // sanity check: Is the size fit for the image size?!?
    if (size > Math.min(width, height)) {
      System.err.println("[" + getClass().getName() + "] Too big a patch for this image. Consider using bigger images.");
      size = sizeLookUp[0];
    }
    // bounding box
    double boundx = width - size;
    double boundy = height - size;
    // System.out.printf("(%d, %d) %d, %f -- ", width, height, size, boundx);
    x = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundx / 2 + width / 2);
    y = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundy / 2 + height / 2);
    // System.out.printf("(%d, %d)\n", x, y);
    key = new keypoint(x, y, size);
    keypointsList.add(key);
  }
  return keypointsList;
}
origin: dermotte/LIRE

private LinkedList<keypoint> createGaussRndPts(int width, int height, int samples) {
  Random ran = new Random();
  int size, x, y;
  keypoint key;
  LinkedList<keypoint> keypointsList = new LinkedList<keypoint>();
  sizeLookUp = getLookupTable(Math.min(width, height)/4);
  for (int i = 0; i < samples; i++) {
    size = sizeLookUp[ran.nextInt(sizeLookUp.length)];
    // sanity check: Is the size fit for the image size?!?
    if (size > Math.min(width, height)) {
      System.err.println("[" + getClass().getName() + "] Too big a patch for this image. Consider using bigger images.");
      size = sizeLookUp[0];
    }
    // bounding box
    double boundx = width - size;
    double boundy = height - size;
    // System.out.printf("(%d, %d) %d, %f -- ", width, height, size, boundx);
    x = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundx / 2 + width / 2);
    y = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundy / 2 + height / 2);
    // System.out.printf("(%d, %d)\n", x, y);
    key = new keypoint(x, y, size);
    keypointsList.add(key);
  }
  return keypointsList;
}
origin: dermotte/liresolr

rsp.add("bs_list", hashStrings);
List<String> hashQuery = orderHashes(hashes, paramField, true);
int queryLength = (int) StatsUtils.clamp(accuracy * hashes.length,
    3, hashQuery.size());
rsp.add("bs_query", String.join(" ", hashQuery.subList(0, queryLength)));
int queryLength = (int) StatsUtils.clamp(accuracy * MetricSpaces.getPostingListLength(feat),
    3, MetricSpaces.getPostingListLength(feat));
rsp.add("ms_query", MetricSpaces.generateBoostedQuery(feat, queryLength));
origin: dermotte/liresolr

} else if (MetricSpaces.supportsFeature(feat)) {
  int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(feat), 3, MetricSpaces.getPostingListLength(feat));
  String msQuery = MetricSpaces.generateBoostedQuery(feat, queryLength);
  QueryParser qp = new QueryParser(paramField.replace("_ha", "_ms"), new WhitespaceAnalyzer());
origin: dermotte/liresolr

int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(queryFeature),
    3, MetricSpaces.getPostingListLength(queryFeature));
queryString = MetricSpaces.generateBoostedQuery(queryFeature, queryLength);
origin: dermotte/liresolr

} else if (MetricSpaces.supportsFeature(queryFeature)) {
  int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(queryFeature), 3, MetricSpaces.getPostingListLength(queryFeature));
  String msQuery = MetricSpaces.generateBoostedQuery(queryFeature, queryLength);
  QueryParser qp = new QueryParser(paramField.replace("_ha", "_ms"), new WhitespaceAnalyzer());
net.semanticmetadata.lire.utilsStatsUtilsclamp

Javadoc

Simple clamp function for doubles.

Popular methods of StatsUtils

  • drawSample
    Draws a set if size size of sample number from 0 to maximum, following an even distribution. Each dr
  • convertTime

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JFileChooser (javax.swing)
  • Top 12 Jupyter Notebook extensions
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