Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Bechberger committed Aug 14, 2020
1 parent 737dc8f commit f49b96c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions temci/report/rundata.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from temci.utils.settings import Settings
import temci.utils.util as util
from collections import defaultdict
if util.can_import("scipy"):
import scipy
if util.can_import("numpy"):
import numpy as np
import typing as t
import yaml

Expand Down Expand Up @@ -524,8 +524,8 @@ def _speed_up(self, property: str, data1: RunData, data2: RunData):
Calculates the speed up from the second to the first
(e.g. the first is RESULT * 100 % faster than the second).
"""
return (scipy.mean(data1[property]) - scipy.mean(data2[property])) \
/ scipy.mean(data1[property])
return (np.mean(data1[property]) - np.mean(data2[property])) \
/ np.mean(data1[property])

def _estimate_time_for_run_datas(self, run_bin_size: int, data1: RunData, data2: RunData,
min_runs: int, max_runs: int) -> float:
Expand All @@ -538,7 +538,7 @@ def _estimate_time_for_run_datas(self, run_bin_size: int, data1: RunData, data2:
estimate = self.tester.estimate_needed_runs(data1[prop], data2[prop],
run_bin_size, min_runs, max_runs)
needed_runs.append(estimate)
avg_time = max(scipy.mean(data1["__ov-time"]), scipy.mean(data2["__ov-time"]))
avg_time = max(np.mean(data1["__ov-time"]), np.mean(data2["__ov-time"]))
return max(needed_runs) * avg_time

def get_program_ids_to_bench(self) -> t.List[int]:
Expand Down Expand Up @@ -599,7 +599,7 @@ def estimate_time_for_next_round(self, run_bin_size: int, all: bool) -> float:
summed = 0
to_bench = range(0, len(self.runs)) if all else self.get_program_ids_to_bench()
for i in to_bench:
summed += scipy.mean(self.runs[i]["__ov-time"] if "__ov-time" in self.runs[i].data else 0) * run_bin_size
summed += np.mean(self.runs[i]["__ov-time"] if "__ov-time" in self.runs[i].data else 0) * run_bin_size
return summed

#ef add_run_data(self, data: t.Dict[str, t.List[Number]] = None, attributes: t.Dict[str, str] = None,
Expand Down
7 changes: 3 additions & 4 deletions temci/utils/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
Utility functions and classes that don't depend on the rest of the temci code base.
"""
import enum

import functools
import os
import resource
import subprocess
import typing as t
import sys
Expand Down Expand Up @@ -316,9 +315,9 @@ def geom_std(values: t.List[float]) -> float:
Source: https://en.wikipedia.org/wiki/Geometric_standard_deviation
"""
import scipy.stats as stats
import scipy as sp
import numpy as np
gmean = stats.gmean(values)
return sp.exp(sp.sqrt(sp.sum([sp.log(x / gmean) ** 2 for x in values]) / len(values)))
return np.exp(np.sqrt(np.sum([np.log(x / gmean) ** 2 for x in values]) / len(values)))


def parse_timespan(time: str) -> float:
Expand Down

0 comments on commit f49b96c

Please sign in to comment.