Elron commited on
Commit
b2c0792
·
verified ·
1 Parent(s): cf8846d

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. metrics.py +15 -4
  2. text2sql_utils.py +4 -2
  3. version.py +1 -1
metrics.py CHANGED
@@ -32,8 +32,6 @@ import numpy
32
  import numpy as np
33
  import pandas as pd
34
  import requests
35
- from scipy.stats import bootstrap
36
- from scipy.stats._warnings_errors import DegenerateDataWarning
37
 
38
  from .artifact import Artifact
39
  from .base_metric import Metric
@@ -76,8 +74,6 @@ from .utils import deep_copy, recursive_copy, retry_connection_with_exponential_
76
  logger = get_logger()
77
  settings = get_settings()
78
 
79
- warnings.filterwarnings("ignore", category=DegenerateDataWarning)
80
-
81
 
82
  @retry_connection_with_exponential_backoff(backoff_factor=2)
83
  def hf_evaluate_load(path: str, *args, **kwargs):
@@ -221,6 +217,11 @@ class ConfidenceIntervalMixin(Artifact):
221
  pass
222
 
223
  def bootstrap(self, data: List[Any], score_names: List[str]):
 
 
 
 
 
224
  if self.ci_score_names is not None:
225
  score_names = self.ci_score_names
226
 
@@ -1349,6 +1350,11 @@ class MetricWithConfidenceInterval(Metric):
1349
  Returns:
1350
  Dict of confidence interval values
1351
  """
 
 
 
 
 
1352
  result = {}
1353
 
1354
  if not self._can_compute_confidence_intervals(num_predictions=len(instances)):
@@ -1433,6 +1439,11 @@ class MetricWithConfidenceInterval(Metric):
1433
  self, references, predictions, task_data, score_name
1434
  ):
1435
  """Computed confidence intervals for a set of references and predictions."""
 
 
 
 
 
1436
  random_gen = self.new_random_generator()
1437
 
1438
  def statistic(arr, axis):
 
32
  import numpy as np
33
  import pandas as pd
34
  import requests
 
 
35
 
36
  from .artifact import Artifact
37
  from .base_metric import Metric
 
74
  logger = get_logger()
75
  settings = get_settings()
76
 
 
 
77
 
78
  @retry_connection_with_exponential_backoff(backoff_factor=2)
79
  def hf_evaluate_load(path: str, *args, **kwargs):
 
217
  pass
218
 
219
  def bootstrap(self, data: List[Any], score_names: List[str]):
220
+ from scipy.stats import bootstrap
221
+ from scipy.stats._warnings_errors import DegenerateDataWarning
222
+
223
+ warnings.filterwarnings("ignore", category=DegenerateDataWarning)
224
+
225
  if self.ci_score_names is not None:
226
  score_names = self.ci_score_names
227
 
 
1350
  Returns:
1351
  Dict of confidence interval values
1352
  """
1353
+ from scipy.stats import bootstrap
1354
+ from scipy.stats._warnings_errors import DegenerateDataWarning
1355
+
1356
+ warnings.filterwarnings("ignore", category=DegenerateDataWarning)
1357
+
1358
  result = {}
1359
 
1360
  if not self._can_compute_confidence_intervals(num_predictions=len(instances)):
 
1439
  self, references, predictions, task_data, score_name
1440
  ):
1441
  """Computed confidence intervals for a set of references and predictions."""
1442
+ from scipy.stats import bootstrap
1443
+ from scipy.stats._warnings_errors import DegenerateDataWarning
1444
+
1445
+ warnings.filterwarnings("ignore", category=DegenerateDataWarning)
1446
+
1447
  random_gen = self.new_random_generator()
1448
 
1449
  def statistic(arr, axis):
text2sql_utils.py CHANGED
@@ -856,8 +856,10 @@ def compare_dfs_ignore_colnames_subset(
856
 
857
  def sort_df(df):
858
  sorted_df = df.copy()
859
- for col in sorted_df.columns:
860
- sorted_df[col] = sorted_df[col].astype(str).sort_values(ignore_index=True)
 
 
861
  return sorted_df
862
 
863
  if df1.empty or df2.empty or len(df1) != len(df2):
 
856
 
857
  def sort_df(df):
858
  sorted_df = df.copy()
859
+ for i in range(len(sorted_df.columns)):
860
+ sorted_df.iloc[:, i] = (
861
+ sorted_df.iloc[:, i].astype(str).sort_values(ignore_index=True)
862
+ )
863
  return sorted_df
864
 
865
  if df1.empty or df2.empty or len(df1) != len(df2):
version.py CHANGED
@@ -1 +1 @@
1
- version = "1.26.8"
 
1
+ version = "1.26.9"