MD-metrics-HPO
HuangJintao 6 months ago
parent c1e07eabb6
commit f1e732afaf

@ -8,11 +8,11 @@ import py_entitymatching.catalog.catalog_manager as cm
import pandas as pd import pandas as pd
from smac import HyperparameterOptimizationFacade, Scenario from smac import HyperparameterOptimizationFacade, Scenario
from ml_er.magellan_new import matching from ml_er.magellan_er import matching
from settings import * from settings import *
class Classifier: class Optimization:
@property @property
def configspace(self) -> ConfigurationSpace: def configspace(self) -> ConfigurationSpace:
cs = ConfigurationSpace(seed=0) cs = ConfigurationSpace(seed=0)
@ -68,8 +68,8 @@ class Classifier:
def ml_er_hpo(): def ml_er_hpo():
classifier = Classifier() optimization = Optimization()
cs = classifier.configspace cs = optimization.configspace
str_configspace = csj.write(cs) str_configspace = csj.write(cs)
dict_configspace = json.loads(str_configspace) dict_configspace = json.loads(str_configspace)
# 将超参数空间保存本地 # 将超参数空间保存本地
@ -88,7 +88,7 @@ def ml_er_hpo():
smac = HyperparameterOptimizationFacade( smac = HyperparameterOptimizationFacade(
scenario, scenario,
classifier.train, optimization.train,
initial_design=initial_design, initial_design=initial_design,
overwrite=True, # If the run exists, we overwrite it; alternatively, we can continue from last state overwrite=True, # If the run exists, we overwrite it; alternatively, we can continue from last state
) )

@ -155,6 +155,7 @@ def matching(config: Configuration, blocking_result_):
predictions = predictions.reset_index(drop=True) predictions = predictions.reset_index(drop=True)
predictions = predictions.astype(str) predictions = predictions.astype(str)
# 目前predictions包含的属性左右表全部属性+gold+predicted
sim_tensor_dict = build_col_pairs_sim_tensor_dict(predictions) sim_tensor_dict = build_col_pairs_sim_tensor_dict(predictions)
predictions['confidence'] = 0 predictions['confidence'] = 0

@ -1,4 +1,4 @@
from ml_er.magellan_new import blocking_mining from ml_er.magellan_er import blocking_mining
if __name__ == '__main__': if __name__ == '__main__':
blocking_mining() blocking_mining()

Loading…
Cancel
Save