Examples of Distribution


Examples of ar.edu.unlp.yaqc4j.randoms.Distribution

   */
  @Test
  @Generator(klass = double.class, generator = PercentageGen.class)
  public void testNullGen(final double d) {
    final int iterations = 10000;
    Distribution rand = Arbitrary.defaultDistribution();
    NullGen<Integer> ngen = new NullGen<Integer>(new IntegerSimpleGen(), d);
    int nulls = 0;
    for (int i = 0; i < iterations; ++i) {
      if (ngen.arbitrary(rand, 0, 100) == null) {
        nulls++;
View Full Code Here

Examples of avrora.util.profiling.Distribution

        analyzeStates();
    }

    private void analyzeAggregationPoints() {
        Iterator i = graph.getStateCache().getStateIterator();
        Distribution sizeDist = new Distribution("Set Size Statistics", "Number of sets",
                "Aggregate size", "Distribution of Set Size");
        while (i.hasNext()) {
            StateCache.State state = (StateCache.State)i.next();
            StateCache.Set stateSet = state.info.stateSet;
            int size = stateSet == null ? 0 : stateSet.size();
            sizeDist.record(size);
        }
        sizeDist.processData();
        sizeDist.textReport();
    }
View Full Code Here

Examples of buri.ddmsence.samples.util.Distribution

   * Google Pie Graph of the distribution.
   *
   * @return URL representing the Google URL
   */
  private URL buildMimeTypeGraph() throws IOException {
    Distribution distribution = new Distribution();
    for (Resource resource : getResources()) {
      // Check any records that have a format (mimeType is required if format is present)
      if (resource.getFormat() != null) {
        String mimeType = resource.getFormat().getMimeType();
        distribution.incrementCount(mimeType);
      }
    }
    return (buildPieGraphURL("DDMS%20MimeType%20Distribution", distribution, PIE_GRAPH_3D));
  }
View Full Code Here

Examples of buri.ddmsence.samples.util.Distribution

   * Traverses the keywords of any loaded records and creates a Google Pie Graph of the distribution.
   *
   * @return URL representing the Google URL
   */
  private URL buildKeywordGraph() throws IOException {
    Distribution distribution = new Distribution();
    for (Resource resource : getResources()) {
      // Check any records that have a keyword (subjectCoverage is required)
      for (SubjectCoverage subjectCoverage : resource.getSubjectCoverages()) {
        if (!subjectCoverage.getKeywords().isEmpty()) {
          List<Keyword> keywords = subjectCoverage.getKeywords();
          // Record the counts for each keyword's usage
          for (Keyword keyword : keywords) {
            // Split multiword keywords.
            String[] splitValues = keyword.getValue().split(" ");
            for (int i = 0; i < splitValues.length; i++) {
              distribution.incrementCount(splitValues[i]);
            }
          }
        }
      }
    }
View Full Code Here

Examples of buri.ddmsence.samples.util.Distribution

   * Examines every date field in a Resource and creates a distribution of years.
   *
   * @return URL representing the Google URL
   */
  private URL buildDateGraph() throws IOException {
    Distribution distribution = new Distribution();
    for (Resource resource : getResources()) {
      // Examine the ddms:dates element (optional field with optional attributes)
      // Ignores ddms:DateHourMinType dates, which were introduced in DDMS 4.1, to simplify example
      Dates dates = resource.getDates();
      if (dates != null) {
        if (dates.getCreated() != null)
          distribution.incrementCount(String.valueOf(dates.getCreated().getYear()));
        if (dates.getPosted() != null)
          distribution.incrementCount(String.valueOf(dates.getPosted().getYear()));
        if (dates.getValidTil() != null)
          distribution.incrementCount(String.valueOf(dates.getValidTil().getYear()));
        if (dates.getInfoCutOff() != null)
          distribution.incrementCount(String.valueOf(dates.getInfoCutOff().getYear()));
        if (dates.getApprovedOn() != null)
          distribution.incrementCount(String.valueOf(dates.getApprovedOn().getYear()));
        if (dates.getReceivedOn() != null)
          distribution.incrementCount(String.valueOf(dates.getReceivedOn().getYear()));
      }

      // Resource createDate (required field in 3.0, 4.0.1, and 4.1, optional in 2.0)
      if (resource.getCreateDate() != null)
        distribution.incrementCount(String.valueOf(resource.getCreateDate().getYear()));

      // ddms:temporalCoverage (optional field)
      // getStart() returns the date if present. getStartString() returns the XML format or
      // the two allowed strings, Not Applicable, and Unknown.
      List<TemporalCoverage> timePeriods = resource.getTemporalCoverages();
      for (TemporalCoverage timePeriod : timePeriods) {
        if (timePeriod.getStart() != null)
          distribution.incrementCount(String.valueOf(timePeriod.getStart().getYear()));
        if (timePeriod.getEnd() != null)
          distribution.incrementCount(String.valueOf(timePeriod.getEnd().getYear()));
      }
    }
    return (buildPieGraphURL("DDMS%20Date%20Distribution", distribution, PIE_GRAPH));
  }
View Full Code Here

Examples of buri.ddmsence.samples.util.Distribution

   * Examines every Resource and creates a distribution of DDMS Versions
   *
   * @return URL representing the Google URL
   */
  private URL buildVersionGraph() throws IOException {
    Distribution distribution = new Distribution();
    for (Resource resource : getResources()) {
      distribution.incrementCount(DDMSVersion.getVersionForNamespace(resource.getNamespace()).getVersion());
    }
    return (buildPieGraphURL("DDMS%20Version%20Distribution", distribution, PIE_GRAPH));
  }
View Full Code Here

Examples of com.compomics.util.math.statistics.Distribution

    private double[] estimateCoverableAA(String proteinMatchKey) throws IllegalArgumentException, SQLException, IOException, ClassNotFoundException, InterruptedException {

        ProteinMatch proteinMatch = identification.getProteinMatch(proteinMatchKey);
        String sequence = sequenceFactory.getProtein(proteinMatch.getMainMatch()).getSequence();
        double[] result = new double[sequence.length()];
        Distribution peptideLengthDistribution = metrics.getPeptideLengthDistribution();
        Enzyme enzyme = searchParameters.getEnzyme();

        // special case for no cleavage searches
        if (enzyme.isWholeProtein()) {
            for (int i = 0; i < result.length; i++) {
                result[i] = 1.0;
            }
            return result;
        }

        int lastCleavage = -1;
        char previousChar = sequence.charAt(0), nextChar;

        for (int i = 0; i < sequence.length() - 1; i++) {
            double p = 1;
            if (!enzyme.isSemiSpecific()) {
                nextChar = sequence.charAt(i + 1);
                if (enzyme.isCleavageSite(previousChar, nextChar)) {
                    int length = i - lastCleavage;
                    if (peptideLengthDistribution == null) { //backward compatibility check
                        int pepMax = idFilter.getMaxPepLength();
                        if (length > pepMax) {
                            p = 0;
                        }
                    } else {
                        p = peptideLengthDistribution.getProbabilityAt(length);
                    }
                    for (int j = lastCleavage + 1; j <= i; j++) {
                        result[j] = p;
                    }
                    lastCleavage = i;
                }
                previousChar = nextChar;
            } else {
                result[i] = p;
            }
        }

        double p = 1;

        if (!enzyme.isSemiSpecific()) {
            int length = sequence.length() - lastCleavage + 1;
            if (peptideLengthDistribution == null) { //backward compatibility check
                int pepMax = idFilter.getMaxPepLength();
                if (length > pepMax) {
                    p = 0;
                }
            } else {
                p = peptideLengthDistribution.getProbabilityAt(length);
            }
            for (int j = lastCleavage; j < sequence.length(); j++) {
                result[j] = p;
            }
        } else {
View Full Code Here

Examples of com.tinkerpop.furnace.generators.Distribution

        int numNodes = 100;
        int numEdges = 1000;
        long seed = System.currentTimeMillis();
        Random random = new Random(seed);
        //normal
        Distribution n = new NormalDistribution(2);
        n = n.initialize(numNodes,numEdges);
        int degreeSum = 0;
        for (int i=0;i<numNodes;i++) {
            int degree=n.nextValue(random);
            degreeSum+=degree;
        }
        System.out.println(degreeSum);

        random = new Random(seed);
        n = new NormalDistribution(2);
        n = n.initialize(numNodes,numEdges);
        for (int i=0;i<numNodes;i++) {
            degreeSum-=n.nextValue(random);
        }
        assertEquals(0,degreeSum);

        //scale free
        n = new PowerLawDistribution(2.9);
        n = n.initialize(numNodes,numEdges);
        degreeSum = 0;
        for (int i=0;i<numNodes;i++) {
            int degree=n.nextValue(random);
            //System.out.println(degree);
            degreeSum+=degree;
        }
        System.out.println(degreeSum);
View Full Code Here

Examples of com.tinkerpop.gremlin.algorithm.generator.Distribution

            for (int i = 0; i < numVertices; i++) {
                final Vertex v = g.addVertex("oid", i, "name", RandomStringUtils.randomAlphabetic(r.nextInt(1024)));
                ids.add(v.id());
            }

            final Distribution inDist = new PowerLawDistribution(2.3);
            final Distribution outDist = new PowerLawDistribution(2.8);
            final DistributionGenerator generator = DistributionGenerator.build(g)
                    .label("knows")
                    .seedGenerator(r::nextLong)
                    .outDistribution(outDist)
                    .inDistribution(inDist)
View Full Code Here

Examples of de.lmu.ifi.dbs.elki.data.synthetic.bymodel.distribution.Distribution

      max = Double.valueOf(maxstr);
    }

    // *** new uniform generator
    Random random = cluster.getNewRandomGenerator();
    Distribution generator = new UniformDistribution(min, max, random);
    cluster.addGenerator(generator);

    // TODO: check for unknown attributes.
    for(Node child : new XMLNodeIterator(cur.getFirstChild())) {
      if(child.getNodeType() == Node.ELEMENT_NODE) {
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.