## python – Random Forest Method – ValueError: The input contains NaN, infinite or a value that is too large for dtype (& # 39; float32 & # 39;).

I try to use the Random Forest method on a dataset and I get the following error message: ValueError: The input contains NaN, infinite or a value that is too large for dtype (& # 39; float32 & # 39;). Could someone tell me what I can change about the function to make the code work:

``````"""Get ranks from Random Forest"""

print("nMétodo_Random_Forest")

random_forest = RandomForestRegressor(n_estimators=10)
np.nan_to_num(x_train)
np.nan_to_num(y_train)
random_forest.fit(x_train, y_train)

# Get rank by doing two times a sort.
imp_array = np.array(random_forest.feature_importances_)
imp_order = imp_array.argsort()
ranks = imp_order.argsort()

# Plot Random Forest
imp = pd.Series(random_forest.feature_importances_, index=x_train.columns)
imp = imp.sort_values()

imp.plot(kind="barh")
plt.xlabel("Importance")
plt.ylabel("Features")
plt.title("Feature importance using Random Forest")
# plt.show()
plt.savefig(RESULT_PATH + '/ranks_RF.png', bbox_inches='tight')

return ranks
``````

## bash – Notify-Send Infinite notification

I have created a short script to notify me when my battery is under 25% and over 75%. I use notify-send to send notifications and play an alarm sound to notify the user of the event. The problem I am facing is that I want to send a permanent notification while the alarm sound is playing continuously. If the battery exceeds 75% and the AC power is still connected, the notification must persist until the user unplugs it. If the battery power drops below 25%, the scripts do the same.

The problem I have is that when sending notifications, the notifications are stacked over the previous notifications and I can't figure out how to display a persistent notification with a constant alarm sound in the background.

Image and code are attached below to better understand my problem.

``````#!/bin/bash
while true
do
export DISPLAY=:0.0
battery_level=`acpi -b | grep -P -o '(0-9)+(?=%)'`
ac_adapter=\$(acpi -a | cut -d' ' -f3 | cut -d- -f1)
if ( "\$ac_adapter" = "on" ); then
if ( \$battery_level -ge 75 ); then              #check if the battery level is over 75%
while :
do
notify-send -u critical "Please unplug your AC adapter" "Battery level: \${battery_level}% (charged above 75%)" -i battery-full-charged; play /home/ali/Music/alarm.wav
sleep 1
ac_adapter=\$(acpi -a | cut -d' ' -f3 | cut -d- -f1)
if ( "\$ac_adapter" = "off" ); then
break              #Abandon the loop.
fi
done

fi
else
if ( \$battery_level -lt 25 ); then              #check if the battery level is less than 25%
while :
do
notify-send -u critical "Please plug your AC adapter" "Battery level: \${battery_level}% (charge below 25%)" -i battery-caution; play /home/ali/Music/alarm.wav
sleep 1
ac_adapter=\$(acpi -a | cut -d' ' -f3 | cut -d- -f1)
if ( "\$ac_adapter" = "on" ); then
break              #Abandon the loop.
fi
done

fi
fi
sleep 1                                             #wait for 1 seconds before checking again

done

``````

## nt.number theory – A homogeneous polynomial with zeros in an infinite geometric shape

To let $$a_1, …, a_n in overline { mathbb {Q}} ^ times$$ be algebraic numbers so that $$frac {a_i} {a_j}$$ is not a root of unity for $$i neq j$$, Continue to leave $$m in mathbb {N}$$. $$m> 1$$,

Question: Is there a homogeneous polynomial? $$P in overline { mathbb {Q}} (X_1, …, X_n)$$ in the $$n$$ Variables of some degree $$k$$, so that $$P (a_1 ^ {m ^ ell},…, a_n ^ {m ^ ell}) = 0$$ for all $$ell in mathbb {N} _0$$?

## In this case, should I use normal pagination or an infinite scroll?

Let me answer only as a user of websites. I have no UX designer research to support me, just this personal raw emotion and experience as an (admittedly perhaps unusual) end user:

The mere thought of endless scrolling gives me visceral anger as the first reaction (anger is omitted for brevity). When I notice that there is an infinite amount of scrolling on a page, my immediate thought is: "Oh, great, I hope I never really have to go very far down."

I think infinite scroll doesn't have to be bad, but I think the following questions are worth asking:

1. How likely are your users to want to go back to a certain point in the content? If so, do you have a good search function (specific to your content, e.g. a search for time ranges for content with a clear chronological order) that can meet these requirements? Do you have a way to bookmark a particular point in your infinitely scrollable content?

2. How big is your content in terms of screen area? Sometimes I'm on a social media site and I want to catch up on all the new things in my feeds / watches / subscriptions / whatever: if the content is big, just scrolling becomes annoying and it also makes it harder and harder It is more time consuming to find exactly what I'm looking for. I want to come back to that.

3. How big is your content in relation to the actual memory consumption of the computer? Once I wanted to go through someone's Instagram account for a couple of years: halfway my somewhat high-end computer on this website started to slow down because if you scroll endlessly, you probably won't unload the content above (Instagram it certainly wasn't), so my browser collected gigabytes of image data in memory.

In summary: Does your general use case mostly support the occasional search of a data record that is larger than a single page but not significantly larger?

Disclaimer: I know I'm funny. My personal preference will almost always be pagination. I surf web pagination More pleasant for me to scroll. I don't expect the world to align with me. I just want the option to use pagination on pages that are important to me (unfortunately often not), or at least go back a way or find a certain point in the infinite scroll if I have to deal with it.

P.S. Are you interested in users who surf with restricted or without activated JavaScript? It is worth remembering that there are such people, and there are several good reasons (accessibility requirements and computer security awareness are the main argument, although there are others) to surf with scripts disabled by default. Infinite scrolling can only work with JavaScript enabled, while pagination with JavaScript can be made more user-friendly, but can deteriorate more directly to simple HTTP requests if necessary.

## ca.classical analysis and odes – Can you express the functional square root of the sine as an infinite product?

Cross-Post from MSE.

It is known that the sine can be expressed as an infinite product: $$sin (x) = x prod_ {n = 1} ^ { infty} Big {(} 1 – frac {x ^ {2}} {n ^ {2} { pi} ^ {2 }} Big {)}.$$ We can define this functional square root of a function $$g ( cdot)$$ the function $$f ( cdot)$$ that is enough $$f (f (x)) = g (x)$$, The square root of the sine function in relation to the functional composition has already been discussed several times on MO. For example, the formal power series is considered here.

I wonder if the functional square root of the sine also has an infinite representation of power. If not, has research been done on this question?

## Zero is infinite proof

0 ^ ln (sin (ln (pi))) = infinite

I made infinity infinite with math to prove the opposite and explain why

## Analysis – the two infinite summations are equivalent?

To let $${a_k }$$ be a non-negative sequence of numbers. Now we have two infinite summation problems $${a_k }$$:
$$sum_ {k geq2} bigg ( frac { delta ^ {k-1}} {(k-1)!} – frac { delta ^ k} {k!} bigg) a_k$$

and

$$bigg ( sum_ {k geq1} (k-1) frac { delta ^ {k-1}} {k!} a_k bigg) / bigg ( sum_ {k geq1} frac { Delta ^ {k-1}} {k!} A_k bigg).$$

These two summations are the same or not?

## The ideal pinhole camera has an infinite depth of field

What does it mean to say that the ideal pinhole camera has an "infinite depth of field"?

According to Wikipedia, the depth of field is "the distance between the closest and most distant object that has an acceptably sharp focus in an image". Given this definition, I conclude that an infinite depth of field only means that the pinhole camera has enough focus to resolve all objects, regardless of their distance. Is that correct?

I would like people to clarify this, please.

## Find the smallest value n, from which the difference between the sum of an infinite series and a partial sum is less than 0.001

Pick some values ​​of n and see how big the error is, and then check if
You can find a value of n where the error is close to 0.001

One way is to keep growing `n` until the error approaches `0.001`

``````ClearAll(k, n)
exact = Sum(1/k!, {k, 1, Infinity});
Manipulate(
partial = Sum(1/k!, {k, 1, n});
Grid({
{Row({"n=", n})},
{Row({"difference = ", (exact - partial) // N})}
})
,
{{n, 1, "n"}, 1, 100, 1, Appearance -> "Labeled"},
TrackedSymbols :> {n}
)
``````

This is what it looks like `n=5` will do

``````  (exact - Sum(1/k!, {k, 1, 5})) // N
(*0.00161516*)
``````

The equation itself is not easy to solve analytically

`````` eq = exact - Sum(1/k!, {k, 1, n}) ==1/1000
``````

You could plan it and see where `n` is

`````` Plot(eq, {n, 1, 10})
``````

So the root is there `n=5`

## fa.functional analysis – reference for an infinite system of SDEs

Consider a system of the following form
begin {align *} mathrm {d} X_k (t) = large (AX (t) large) _k mathrm {d} t + B_k (X_k (t)) mathrm {d} t + mathrm {d} W_k (t ), quad k in mathbb {Z}, end {align *}
Where $$A$$ is matrix, $$B_k$$ is a nonlinear function and $$W_k$$ is an independent standard Viennese process, also known as the Brownian movement.

I am familiar with the series of books by Da Prato and Zabczyk, in which such a system is dealt with in a Banach room. But I'm looking for references for the solution of an infinite system of SDEs with finite dimensional approximations.