forked from srlearn/srlearn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_data.py
More file actions
88 lines (77 loc) · 2.2 KB
/
example_data.py
File metadata and controls
88 lines (77 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 2017, 2018, 2019 Alexander L. Hayes
"""
A BoostSRL database with the "Toy-Cancer" dataset.
Importing this module makes ``example_data.train`` and ``example_data.test`` available
in the namespace.
Examples
--------
>>> from srlearn import example_data
>>> print(example_data.train)
Positive Examples:
['cancer(Alice).', 'cancer(Bob).', 'cancer(Chuck).', 'cancer(Fred).']
Negative Examples:
['cancer(Dan).', 'cancer(Earl).']
Facts:
['friends(Alice, Bob).', 'friends(Alice, Fred).', ..., 'smokes(Bob).']
Ellipsis added to the facts for easier reading.
>>> from srlearn import example_data
>>> print(example_data.test)
Positive Examples:
['cancer(Zod).', 'cancer(Xena).', 'cancer(Yoda).']
Negative Examples:
['cancer(Voldemort).', 'cancer(Watson).']
Facts:
['friends(Zod, Xena).', 'friends(Xena, Watson).', ..., 'smokes(Yoda).']
"""
from .database import Database
# pylint: disable=invalid-name
train = Database()
test = Database()
train.modes = [
"friends(+Person,-Person).",
"friends(-Person,+Person).",
"smokes(+Person).",
"cancer(+Person).",
]
train.pos = ["cancer(Alice).", "cancer(Bob).", "cancer(Chuck).", "cancer(Fred)."]
train.neg = ["cancer(Dan).", "cancer(Earl)."]
train.facts = [
"friends(Alice, Bob).",
"friends(Alice, Fred).",
"friends(Chuck, Bob).",
"friends(Chuck, Fred).",
"friends(Dan, Bob).",
"friends(Earl, Bob).",
"friends(Bob, Alice).",
"friends(Fred, Alice).",
"friends(Bob, Chuck).",
"friends(Fred, Chuck).",
"friends(Bob, Dan).",
"friends(Bob, Earl).",
"smokes(Alice).",
"smokes(Chuck).",
"smokes(Bob).",
]
test.modes = [
"friends(+Person,-Person).",
"friends(-Person,+Person).",
"smokes(+Person).",
"cancer(+Person).",
]
test.pos = ["cancer(Zod).", "cancer(Xena).", "cancer(Yoda)."]
test.neg = ["cancer(Voldemort).", "cancer(Watson)."]
test.facts = [
"friends(Zod, Xena).",
"friends(Xena, Watson).",
"friends(Watson, Voldemort).",
"friends(Voldemort, Yoda).",
"friends(Yoda, Zod).",
"friends(Xena, Zod).",
"friends(Watson, Xena).",
"friends(Voldemort, Watson).",
"friends(Yoda, Voldemort).",
"friends(Zod, Yoda).",
"smokes(Zod).",
"smokes(Xena).",
"smokes(Yoda).",
]