TensorTonic
Problems
Log Transform
Feature EngineeringData Processing
Easy

The log1p transformation compresses the range of nonnegative data while handling zero naturally. Apply the natural logarithm of one plus each value:

yi=ln⁡(1+xi)y_i = \ln(1 + x_i)yi​=ln(1+xi​)

Here, x_i is an input value and y_i is its transformed value. Return the transformed values as a list. You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.

Loading visualization...

Examples

Input: values = [0, 1, 2, 3]

Output: [0.0, 0.6931, 1.0986, 1.3863]

Explanation: Adding one makes the zero input valid, and the natural logarithm compresses the remaining values.

Input: values = [99, 999]

Output: [4.6052, 6.9078]

Hint 1

Use math.log1p to compute the transformation directly.

Hint 2

You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.

Requirements

  • Apply the natural logarithm of 1 + x to every value.
  • You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.
  • Preserve the original value order.
  • Return a list of floats.

Constraints

  • Every input value is nonnegative.
  • values is nonempty.
  • Time limit: 300 ms.
Try Similar Problems
Min-Max Normalize Rows or Columns in NumPyEasyBinningEasyImplement z-Score StandardizationEasyRank TransformEasyPolynomial FeaturesEasyStreaming Min-Max NormalizationMediumImplement Robust Scaling in PythonMediumMin-Max Scale Each Feature Column in PythonMediumMissing Value ImputationEasyAngle FeaturesEasyFeature ScalingEasyDistance MetricsEasy
Scratchpad

Accepts: array

You must run your code first.
Log Transform

Log Transform

Feature EngineeringData Processing
Easy

The log1p transformation compresses the range of nonnegative data while handling zero naturally. Apply the natural logarithm of one plus each value:

yi=ln⁡(1+xi)y_i = \ln(1 + x_i)yi​=ln(1+xi​)

Here, x_i is an input value and y_i is its transformed value. Return the transformed values as a list. You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.

Loading visualization...

Examples

Input: values = [0, 1, 2, 3]

Output: [0.0, 0.6931, 1.0986, 1.3863]

Explanation: Adding one makes the zero input valid, and the natural logarithm compresses the remaining values.

Input: values = [99, 999]

Output: [4.6052, 6.9078]

Hint 1

Use math.log1p to compute the transformation directly.

Hint 2

You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.

Requirements

  • Apply the natural logarithm of 1 + x to every value.
  • You do not need to round the transformed values; answers that match the expected values to four decimal places are accepted.
  • Preserve the original value order.
  • Return a list of floats.

Constraints

  • Every input value is nonnegative.
  • values is nonempty.
  • Time limit: 300 ms.
Try Similar Problems
Min-Max Normalize Rows or Columns in NumPyEasyBinningEasyImplement z-Score StandardizationEasyRank TransformEasyPolynomial FeaturesEasyStreaming Min-Max NormalizationMediumImplement Robust Scaling in PythonMediumMin-Max Scale Each Feature Column in PythonMediumMissing Value ImputationEasyAngle FeaturesEasyFeature ScalingEasyDistance MetricsEasy
Scratchpad

Accepts: array

You must run your code first.
Problems
Loading...
1 / 1