test_class.file: dataprep-backend-service/src/test/java/org/talend/dataprep/util/ShannonEntropyTest.java
test_class.identifier: ShannonEntropyTest
test_case.body: @Test(expected = IllegalArgumentException.class)
      public void should_not_compute_entropy_for_a_value_with_frequency_of_zero() {
          // given
          List frequencies = Arrays.asList(0.25, 0.25, 0.25, 0.0);
  
          // when
          ShannonEntropy.computeWithFrequencies(frequencies);
          // then
      }
test_case.class_method_signature: ShannonEntropyTest.should_not_compute_entropy_for_a_value_with_frequency_of_zero()
test_case.full_signature: @Test(expected = IllegalArgumentException.class) public void should_not_compute_entropy_for_a_value_with_frequency_of_zero()
test_case.identifier: should_not_compute_entropy_for_a_value_with_frequency_of_zero
test_case.invocations: asList computeWithFrequencies
test_case.modifiers: @Test(expected = IllegalArgumentException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_not_compute_entropy_for_a_value_with_frequency_of_zero()
focal_class.file: dataprep-backend-service/src/main/java/org/talend/dataprep/util/ShannonEntropy.java
focal_class.identifier: ShannonEntropy
focal_class.class_method_signature: ShannonEntropy.computeWithFrequencies(Collection<Double> frequencies)
focal_class.full_signature: public static double computeWithFrequencies(Collection<Double> frequencies)
focal_class.identifier: computeWithFrequencies
focal_class.modifiers: public static
focal_class.parameters: (Collection<Double> frequencies)
focal_class.return: double
focal_class.signature: double computeWithFrequencies(Collection<Double> frequencies)
focal_class.class_method_signature: ShannonEntropy.computeWithValues(Collection<T> values)
focal_class.full_signature: public static double computeWithValues(Collection<T> values)
focal_class.identifier: computeWithValues
focal_class.modifiers: public static
focal_class.parameters: (Collection<T> values)
focal_class.return: double
focal_class.signature: double computeWithValues(Collection<T> values)
focal_class.class_method_signature: ShannonEntropy.maxEntropy(int cardinality)
focal_class.full_signature: public static double maxEntropy(int cardinality)
focal_class.identifier: maxEntropy
focal_class.modifiers: public static
focal_class.parameters: (int cardinality)
focal_class.return: double
focal_class.signature: double maxEntropy(int cardinality)
focal_method.body: public static double computeWithFrequencies(Collection<Double> frequencies) {
          if (frequencies.contains(0D)) {
              throw new IllegalArgumentException(
                      "Values with null frequency are not permitted when computing Shannon entropy");
          }
  
          if (frequencies.isEmpty()) {
              return Double.MAX_VALUE;
          }
          double entropy = frequencies.stream().mapToDouble(d -> d).map(s -> s * Math.log(s)).sum();
          entropy = (-entropy / Math.log(2));
  
          return Math.abs(entropy);
      }
focal_method.class_method_signature: ShannonEntropy.computeWithFrequencies(Collection<Double> frequencies)
focal_method.full_signature: public static double computeWithFrequencies(Collection<Double> frequencies)
focal_method.identifier: computeWithFrequencies
focal_method.invocations: contains isEmpty sum map mapToDouble stream log log abs
focal_method.modifiers: public static
focal_method.parameters: (Collection<Double> frequencies)
focal_method.return: double
focal_method.signature: double computeWithFrequencies(Collection<Double> frequencies)