from triager import Triager from tablemaker import make_table from mailer import send_mail if __name__ == "__main__": triager = Triager() print("Gathering issues for triage...") issues = triager.triage() if issues: table = make_table(issues) print(table) print("Mailing table to maintainers...") send_mail( content=table, sender=triager.sender, receivers=triager.maintainers, )
metric = random.choice(metrics) return N, K, distribution, xi, metric def trial(trial_number, metric, K, N, distribution, xi): X = point.PointCloud.generate_with_classes(N, K, distribution, [True, False]) Y = point.PointCloud.generate(N, M, distribution) for y in Y: closest_point = y.nearest_point(X, metric) y.clazz = closest_point.clazz perturbed_Y = deepcopy(Y).perturb_points(xi) for y in perturbed_Y: closest_point = y.nearest_point(X, metric) y.clazz = closest_point.clazz confusion_matrix = ConfusionMatrix.generate_from_point_clouds(Y, perturbed_Y) result = [trial_number, metric, K, N, xi.sigma] + confusion_matrix.row() print(result) return result results = [] for trial_number in range(trials): N, K, distribution, xi, metric = generate_params(N_Range, K_Range, metrics, distributions, sigma_range) results.append(trial(trial_number, metric, K, N, distribution, xi)) tablemaker.make_table('experiment1-2(1)', ['Trial', 'Metric', 'K', 'N', 'sigma'] + ConfusionMatrix.headers(), results)
import point from helpertools import Metric import random from numpy import inf from statistics import mean, stdev import tablemaker def trial(trial_number, metric, K, N, distribution): point_cloud = point.PointCloud.generate(N, K, distribution) point_distances = (point.distances(point_cloud.points, metric) for point in point_cloud.points) ratios = [min(distances)/max(distances) for distances in point_distances] result = trial_number, metric, K, N, mean(ratios), stdev(ratios) print(result) return result N_Values = list(range(1, 11)) + list(range(20, 101, 10)) # The dimension of space K_Values = [5, 50, 500] # The number of point values metrics = [Metric(ord) for ord in [1, 2, inf]] # Different norms to use trials = 25 distribution = (lambda: random.uniform(0, 1)) # Point Distribution results = [trial(trial_number, metric, K, N, distribution) for metric in metrics for N in N_Values for K in K_Values for trial_number in range(trials)] tablemaker.make_table('experiment1-1', ['TrialNumber', 'Metric', 'K', 'N', 'Mean', 'StandardDeviation'], results)