Skip to content

Instantly share code, notes, and snippets.

View fPkX6F1nGTX's full-sized avatar

Seth Bradford Wagenman fPkX6F1nGTX

View GitHub Profile
@joshuashaffer
joshuashaffer / pointTriangleDistance.py
Created July 1, 2015 22:28
Computes the distance between a point an triangle. Python.
#!/usr/bin/env python
#
# Tests distance between point and triangle in 3D. Aligns and uses 2D technique.
#
# Was originally some code on mathworks
import numpy
from numpy import dot
from math import sqrt
@aisu-wata0
aisu-wata0 / ParamRepeatPruner.py
Last active October 25, 2022 15:40
For optuna/optuna#2021. Class that prunes trials with the same parameters as past trials. You also can allow repeats if you want, and get the average of these past trials instead of pruning.
import optuna
from optuna.trial import TrialState
import numpy as np
from typing import Dict, List, Optional
from collections import defaultdict
class ParamRepeatPruner:
"""Prunes reapeated trials, which means trials with the same paramters won't waste time/resources."""