Calculate Input values. A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not
provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. This condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default For other keyword-only arguments, see the ufunc docs. Element-wise exponential minus one: See also Notes This function provides greater precision than Examples The true value of
>>> np.expm1(1e-10) 1.00000000005e-10 >>> np.exp(1e-10) - 1 1.000000082740371e-10 Mục đích của numpy.log1p () là gì?Xin chào, tôi mới làm quen với kaggle và đang làm việc trên tập dữ liệu Dự đoán nhà . Tôi vừa xem qua một trong những Kernel này và không thể hiểu nó Tôi đã googled nó và tài liệu của numpy cho biết nó Lợi nhuận :
Nhưng mục đích của việc tìm nhật ký có thêm một (+1) trong khi tìm độ lệch của mảng ban đầu và mảng đã biến đổi của các đối tượng địa lý giống nhau là gì? Nó làm gì ? Ai đó có thể hướng dẫn tôi không?
25 hữu ích 4 bình luận 26k xem chia sẻ answer 53 Tài liệu NumPy đưa ra gợi ý :
Vì vậy, ví dụ, chúng ta hãy thêm một số nhỏ khác 0 và
Nếu chúng tôi cố gắng lấy
Nhưng nếu chúng ta sử dụng
Nguyên tắc tương tự áp dụng cho 53 hữu ích 2 bình luận chia sẻ answer 9 Nếu x nằm trong khoảng 0 ... + Inf thì nó sẽ không bao giờ gây ra lỗi (như chúng ta biết log (0) sẽ gây ra lỗi). Không phải lúc nào cũng là lựa chọn tốt nhất, vì như bạn thấy, bạn sẽ mất một đường cong lớn trước x = 0, đó là một trong những điều tốt nhất về hàm log 9 hữu ích 1 bình luận chia sẻ answer 0 Khi giá trị đầu vào của bạn quá nhỏ, bằng cách sử dụng 0 hữu ích 0 bình luận chia sẻ Đăng nhập để trả lời câu hỏiCó thể bạn quan tâmReturn the natural logarithm of one plus the input array, element-wise. Calculates Input values. outndarray, None, or tuple of ndarray and None, optionalA location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. wherearray_like, optionalThis condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an
uninitialized out array is created via the default For other keyword-only arguments, see the ufunc docs. ReturnsyndarrayNatural logarithm of 1 + x, element-wise. This is a scalar if x is a scalar. Notes For real-valued input, Logarithm is a multivalued function: for each x there is an infinite number of z such that exp(z) = 1 + x. The convention is to return the z whose imaginary part lies in [-pi, pi]. For real-valued input data types, For complex-valued input, References 1M. Abramowitz and I.A. Stegun, “Handbook of Mathematical Functions”, 10th printing, 1964, pp. 67. https://personal.math.ubc.ca/~cbm/aands/page_67.htm 2Wikipedia, “Logarithm”. https://en.wikipedia.org/wiki/Logarithm Examples >>> np.log1p(1e-99) 1e-99 >>> np.log(1 + 1e-99) 0.0 |