👻 Check our latest review to choose the best laptop for Machine Learning engineers and Deep learning tasks!
This is one of the most important concepts in statistics, an essential subject for learning machine learning.
- Geometric mean : As the arithmetic mean is the sum of all discrete values ‚Äã‚Äãin a set, the geometric mean is the product of discrete values ‚Äã‚Äãin a set. This is useful for a set of positive discrete values.
Example —
Sequence = {1, 3, 9} product = 27 n, Total values ‚Äã‚Äã= 3 Harmonic Mean = (27) ^ (1/3)
Code —
# Geometric mean
import
numpy as np
# discrete set of numbers
from
scipy.stats.mstats
import
g mean
x
=
g mean ([
1
,
3
,
9
])
# Greedy
print
(
"Geometric Mean is:"
, x)
Output:
Geometric Mean is: 3
- Harmonic Mean: Harmonic mean plays a role when it is necessary to calculate the average for terms that are defined in relation to any unit. This is the inverse of the mean of the inverse data. This is used when a reverse change in attitude is involved in the data.
Example —
Sequence = {1, 3, 9} sum of reciprocals = 1/1 + 1/3 + 1/9 n, Total values ‚Äã‚Äã= 3 Harmonic Mean = 3 / ( sum of reciprocals)
Code —
# Harmonic mean
import
numpy as np
# discrete set of numbers
from
scipy.stats.mstats
import
h mean
x
=
h mean ([
1
,
3
,
9
])
# Greedy
print
(
"Harmonic Mean is:"
, x)
Output:
Harmonic Mean is: 2.076923076923077
- Relationship between arithmetic (AM), harmonic (HM) and geometric mean (GM):
Example —
Sequence = {1, 3, 9} sum of reciprocals = 1/1 + 1/3 + 1/9 Sum = 10 Product = 27 n, Total values ‚Äã‚Äã= 3 Arithmetic Mean = 4.33 Geometric Mean = 3 Harmonic Mean = 3 / (sum of reciprocals) = 2.077
👻 Read also: what is the best laptop for engineering students?
We hope this article has helped you to resolve the problem. Apart from Understanding Medium Types | Set 2, check other code Python module-related topics.
Want to excel in Python? See our review of the best Python online courses 2023. If you are interested in Data Science, check also how to learn programming in R.
By the way, this material is also available in other languages:
- Italiano Understanding Medium Types | Set 2
- Deutsch Understanding Medium Types | Set 2
- Français Understanding Medium Types | Set 2
- Español Understanding Medium Types | Set 2
- Türk Understanding Medium Types | Set 2
- Русский Understanding Medium Types | Set 2
- Português Understanding Medium Types | Set 2
- Polski Understanding Medium Types | Set 2
- Nederlandse Understanding Medium Types | Set 2
- 中文 Understanding Medium Types | Set 2
- 한국어 Understanding Medium Types | Set 2
- 日本語 Understanding Medium Types | Set 2
- हिन्दी Understanding Medium Types | Set 2
Jan PorrettiSingapore | 2023-02-04
Maybe there are another answers? What Understanding Medium Types | Set 2 exactly means?. Checked yesterday, it works!
Javier JacksonMoscow | 2023-02-04
Maybe there are another answers? What Understanding Medium Types | Set 2 exactly means?. Will use it in my bachelor thesis
Carlo OConnellMilan | 2023-02-04
I was preparing for my coding interview, thanks for clarifying this - Understanding Medium Types | Set 2 in Python is not the simplest one. Will use it in my bachelor thesis