Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created June 24, 2024 21:39
Show Gist options
  • Save quantra-go-algo/34e820620d311e184211dc31f404b61a to your computer and use it in GitHub Desktop.
Save quantra-go-algo/34e820620d311e184211dc31f404b61a to your computer and use it in GitHub Desktop.
# select features from n number of trials
def choose_features(feature_hits, TRIALS, thresh):
# Define the boundaries for the green zone
# Define the green zone threshold
green_zone_thresh = TRIALS - thresh
# Define the blue zone upper threshold
blue_zone_upper = green_zone_thresh
# Define the blue zone lower threshold
blue_zone_lower = thresh
# Select the input features as green whenever their hits are higher than the green zone threshold
green_zone = [key for key, value in feature_hits.items() if value >= green_zone_thresh]
# Select the input features as blue whenever their hits are between the blue zone lower threshold and the blue zone upper threshold
blue_zone = [key for key, value in feature_hits.items() if (value >= blue_zone_lower and value < blue_zone_upper)]
return green_zone, blue_zone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment