Examples of Weight


Examples of org.apache.lucene.search.Weight

  @Test
  public void testExplain() throws IOException {
    this.addDocumentNoNorms("<http://renaud.delbru.fr/rdf/foaf#me> <http://xmlns.com/foaf/0.1/name> \"Renaud Delbru\" . ");

    final Query query = ntq("renaud").getLuceneProxyQuery();
    final Weight w = searcher.createNormalizedWeight(query);
    assertTrue(searcher.getTopReaderContext() instanceof AtomicReaderContext);
    final AtomicReaderContext context = (AtomicReaderContext) searcher.getTopReaderContext();

    // Explain entity 0
    Explanation explanation = w.explain(context, 0);
    assertNotNull("explanation is null and it shouldn't be", explanation);

    // TODO: the similarity is random
    // All this Explain does is return the term frequency
//    final float termFreq = explanation.getDetails()[0].getDetails()[0].getValue();
//    assertEquals("term frq is not 2", 2f, termFreq, 0f);

    // Explain non existing entity
    explanation = w.explain(context, 1);
    assertNotNull("explanation is null and it shouldn't be", explanation);
    //All this Explain does is return the term frequency
    assertEquals("term frq is not 0", 0f, explanation.getValue(), 0f);
  }

Examples of org.apache.mahout.utils.vectors.Weight

      doc.add(text);
      writer.addDocument(doc);
    }
    writer.close();
    IndexReader reader = IndexReader.open(directory, true);
    Weight weight = new TFIDF();
    TermInfo termInfo = new CachedTermInfo(reader, "content", 1, 100);
    VectorMapper mapper = new TFDFMapper(reader, weight, termInfo);
    LuceneIterable iterable = new LuceneIterable(reader, "id", "content", mapper);
   
    int i = 0;

Examples of org.apache.mahout.vectorizer.Weight

      doc.add(text);
      writer.addDocument(doc);
    }
    writer.close();
    IndexReader reader = IndexReader.open(directory, true);
    Weight weight = new TFIDF();
    TermInfo termInfo = new CachedTermInfo(reader, "content", 1, 100);
    VectorMapper mapper = new TFDFMapper(reader, weight, termInfo);
    Iterable<Vector> iterable = new LuceneIterable(reader, "id", "content", mapper);

    int i = 0;

Examples of org.broadleafcommerce.core.catalog.domain.Weight

            }

            if (option instanceof BandedPriceFulfillmentOption) {
                orderItem.setPrice(new Money(total.divide(new BigDecimal(orderItemsToCreate))));
            } else if (option instanceof BandedWeightFulfillmentOption) {
                Weight weight = new Weight();
                weight.setWeight(total.divide(new BigDecimal(orderItemsToCreate)));
                weight.setWeightUnitOfMeasure(WeightUnitOfMeasureType.POUNDS);
                orderItem.getSku().setWeight(weight);
                orderItem.setPrice(new Money(BigDecimal.ZERO));
            }
            orderItem.setOrder(result);

Examples of org.neuroph.core.Weight

      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          if (index >= weights.length)
            throw new EncogEngineError("Weight size mismatch.");

          Weight weight = connection.getWeight();
          FlatWeight flatWeight = new FlatWeight(weights, index++);
          flatWeight.setValue(weight.getValue());
          connection.setWeight(flatWeight);
        }
      }
    }
  }

Examples of org.neuroph.core.Weight

    for (int layerIndex = network.getLayers().size() - 1; layerIndex > 0; layerIndex--) {
      Layer layer = network.getLayers().get(layerIndex);

      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          Weight weight = connection.getWeight();

          if (weight instanceof FlatWeight) {
            Weight weight2 = new Weight(weight.getValue());
            //weight2.setPreviousValue(weight.getPreviousValue());
                                                weight2.getTrainingData().set(TrainingData.PREVIOUS_WEIGHT, weight.getTrainingData().get(TrainingData.PREVIOUS_WEIGHT));
            connection.setWeight(weight2);
          }
        }
      }
    }

Examples of org.neuroph.core.Weight

            // iterate neurons at each layer
            for (Neuron neuron : layer.getNeurons()) {
                // iterate connections/weights for each neuron
                for (Connection connection : neuron.getInputConnections()) {
                    // for each connection weight apply accumulated weight change
                    Weight weight = connection.getWeight();
                    // get deltaWeightSum
                    double deltaWeightSum = weight.getTrainingData().get(TrainingData.DELTA_WEIGHT_SUM);
                    // apply the deltaWeightSum
                    weight.inc(deltaWeightSum);
                    // reset the deltaWeightSum to prepare it for next epoch
                    weight.getTrainingData().set(TrainingData.DELTA_WEIGHT_SUM, 0);
                }
            }
        }
    }

Examples of org.neuroph.core.Weight

    protected void initTrainingDataBuffer() {
        for (int i = neuralNetwork.getLayersCount() - 1; i > 0; i--) {
            Layer layer = neuralNetwork.getLayers().get(i);
            for (Neuron neuron : layer.getNeurons()) {
                for (Connection connection : neuron.getInputConnections()) {
                    Weight weight = connection.getWeight();
                    weight.initTrainingDataBuffer(this.trainingDataBufferSize);
                }
            }
        }
    }

Examples of org.neuroph.core.Weight

    double[] output = new double[inputConnections.size()];

                int i = 0;
    for(Connection connection : inputConnections) {
      Neuron neuron = connection.getFromNeuron();
      Weight weight = connection.getWeight();
      output[i++] = neuron.getOutput() - weight.getValue();
    }

    return output;
  }

Examples of org.neuroph.core.Weight

                        // tanh can be used to minimise the impact of big error values, which can cause network instability
                        // suggested at https://sourceforge.net/tracker/?func=detail&atid=1107579&aid=3130561&group_id=238532
                        // double neuronError = Math.tanh(neuron.getError());
     
      Weight weight = connection.getWeight();
     
      double currentWeighValue = weight.getValue();
      double previousWeightValue = weight.getTrainingData().get(TrainingData.PREVIOUS_WEIGHT);
      double deltaWeight = this.learningRate * neuronError * input +
        momentum * (currentWeighValue - previousWeightValue);
                        // save previous weight value
                        weight.getTrainingData().set(TrainingData.PREVIOUS_WEIGHT, currentWeighValue);
                        this.applyWeightChange(weight, deltaWeight);
    }
  }
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.