-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import pickle as pkl | ||
import warnings | ||
|
||
import pandas as pd | ||
|
||
class Evaluation: | ||
|
||
def __init__(self, gold_standard_dict): | ||
self.label = None | ||
self.node_table = None | ||
# self.edge_table = None TODO: later iteration | ||
self.load_files_from_dict(gold_standard_dict) | ||
return | ||
|
||
def to_file(self, file_name): | ||
""" | ||
Saves dataset object to pickle file | ||
""" | ||
with open(file_name, "wb") as f: | ||
pkl.dump(self, f) | ||
|
||
@classmethod | ||
def from_file(cls, file_name): | ||
""" | ||
Loads dataset object from a pickle file. | ||
Usage: dataset = Dataset.from_file(pickle_file) | ||
""" | ||
with open(file_name, "rb") as f: | ||
return pkl.load(f) | ||
|
||
def load_files_from_dict(self, gold_standard_dict): | ||
|
||
self.label = gold_standard_dict["label"] | ||
node_data_files = gold_standard_dict["node_files"] | ||
data_loc = gold_standard_dict["data_dir"] | ||
|
||
single_node_table = pd.read_table(os.path.join(data_loc, node_file)) | ||
self.node_table = single_node_table | ||
|
||
# self.node_table = pd.DataFrame(node_set, columns=[self.NODE_ID]) | ||
# for loop? and read in node dataset into a pandas df | ||
|
||
def percision_recall(): | ||
None | ||
# https://scikit-learn.org/stable/modules/generated/sklearn.metrics.average_precision_score.html |