File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
netshare/pre_post_processors/netshare Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 4
4
import pandas as pd
5
5
import numpy as np
6
6
7
- from .util import create_sdmetrics_config
7
+ from .util import create_sdmetrics_config , convert_sdmetricsConfigQuant_to_fieldValueDict
8
8
from sdmetrics .reports .timeseries import QualityReport
9
9
10
10
@@ -18,7 +18,9 @@ def compare_rawdf_syndfs(
18
18
comparison_type = 'quantitative' )
19
19
report = QualityReport (config_dict = sdmetrics_config ['config' ])
20
20
report .generate (raw_df , syn_dfs [0 ], sdmetrics_config ['metadata' ])
21
- print ("\n \n \n " , report .dict_metric_scores )
21
+ metricValueDict = convert_sdmetricsConfigQuant_to_fieldValueDict (
22
+ report .dict_metric_scores )
23
+ print (metricValueDict )
22
24
23
25
()+ 1
24
26
Original file line number Diff line number Diff line change 3
3
import pickle
4
4
import math
5
5
import json
6
+ import ast
6
7
import socket
7
8
import struct
8
9
import ipaddress
25
26
from ...model_managers .netshare_manager .netshare_util import get_configid_from_kv
26
27
27
28
29
+ def convert_sdmetricsConfigQuant_to_fieldValueDict (
30
+ sdmetricsConfigQuant
31
+ ):
32
+ '''Convert the sdmetricsConfigQuant to fieldValueDict
33
+ Args:
34
+ sdmetricsConfigQuant (dict): returned by create_sdmetrics_config(..., comparison_type='quantitative')
35
+ Returns:
36
+ fieldValueDict (dict): {field_name: value}
37
+ '''
38
+
39
+ fieldValueDict = {}
40
+ for metric_type , metrics in sdmetricsConfigQuant .items ():
41
+ for metric_class_name , metric_class in metrics .items ():
42
+ for field_name , field_value in metric_class .items ():
43
+ fieldValueDict [ast .literal_eval (
44
+ field_name )[0 ]] = field_value [0 ][0 ]
45
+
46
+ return fieldValueDict
47
+
48
+
28
49
def create_sdmetrics_config (
29
50
config_pre_post_processor ,
30
51
comparison_type = 'both'
You can’t perform that action at this time.
0 commit comments