-
Notifications
You must be signed in to change notification settings - Fork 11
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
26 changed files
with
744 additions
and
599 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# project-specific | ||
|
||
_autosummary | ||
|
||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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
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,4 @@ | ||
from .cli import CLI | ||
|
||
if __name__ == "__main__": | ||
CLI() |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Version of vecto package.""" | ||
|
||
VERSION = "0.1.7" | ||
VERSION = "0.1.8" |
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 |
---|---|---|
@@ -1 +1,41 @@ | ||
from .analogy import ThreeCosAvg, ThreeCosMul, ThreeCosMul2, LinearOffset, LRCos, PairDistance | ||
import argparse | ||
import logging | ||
import os | ||
from .analogy import Analogy | ||
from vecto.utils.data import save_json, print_json | ||
# from vecto.config import load_config | ||
from vecto.embeddings import load_from_dir | ||
from vecto.utils import get_time_str | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
def run(args): | ||
# config = load_config() | ||
# print(config) | ||
print(args) | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("embeddings") | ||
parser.add_argument("dataset") | ||
parser.add_argument("--method", help="analogy solving method", default="LRCos") | ||
parser.add_argument("--path_out", help="destination folder to save results") | ||
args = parser.parse_args(args) | ||
embeddings = load_from_dir(args.embeddings) | ||
# print("embeddings", embeddings) | ||
benchmark = Analogy(method=args.method) | ||
results = benchmark.get_result(embeddings, args.dataset) | ||
if args.path_out: | ||
if os.path.isdir(args.path_out) or args.path_out.endswith("/"): | ||
dataset = os.path.basename(os.path.normpath(args.dataset)) | ||
timestamp = get_time_str() | ||
name_file_out = os.path.join(args.path_out, | ||
"analogical_reasoning", | ||
dataset, | ||
args.method, | ||
timestamp, | ||
"results.json") | ||
save_json(results, name_file_out) | ||
else: | ||
save_json(results, args.path_out) | ||
else: | ||
print_json(results) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.