This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Naive, brute-force approach. | |
# You simply count how many values are smaller than the one for which you want to compute the percentile. | |
# | |
def getPercentileOfDensity(density): | |
nbInf = 0 | |
for d in sortedDensities: | |
if d < density: | |
nbInf+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Naive, brute-force approach. | |
# You simply count how many values are smaller than the one for which you want to compute the percentile. | |
# | |
def getPercentileOfDensity(density): | |
nbInf = 0 | |
for d in sortedDensities: | |
if d < density: | |
nbInf+=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# For both approaches, "sortedDensities" (given as arg "densitiesList" in the dichotomy-based solution) | |
# is a list of the reference dataset, from which are computed the corresponding percentile of each | |
# "density" of another dataset. | |
# The second function is ill-named, as it doens't return a percentile but the index of the "densitiesList" array | |
# used to compute the "density" percentile. | |
## | |
## | |
# Naive, brute-force approach. |