@@ -75,6 +75,10 @@ def __init__(self, examples=None, attrs=None, attrnames=None, target=-1,
75
75
self .source = source
76
76
self .values = values
77
77
self .distance = distance
78
+ if values is None :
79
+ self .got_values_flag = False
80
+ else :
81
+ self .got_values_flag = True
78
82
79
83
# Initialize .examples from string or list or data directory
80
84
if isinstance (examples , str ):
@@ -85,7 +89,7 @@ def __init__(self, examples=None, attrs=None, attrnames=None, target=-1,
85
89
self .examples = examples
86
90
# Attrs are the indices of examples, unless otherwise stated.
87
91
if attrs is None and self .examples is not None :
88
- attrs = list (range (len (self .examples [0 ])))
92
+ attrs = list (range (len (self .examples [0 ])))
89
93
self .attrs = attrs
90
94
# Initialize .attrnames from string, list, or by default
91
95
if isinstance (attrnames , str ):
@@ -117,7 +121,9 @@ def check_me(self):
117
121
assert self .target in self .attrs
118
122
assert self .target not in self .inputs
119
123
assert set (self .inputs ).issubset (set (self .attrs ))
120
- list (map (self .check_example , self .examples ))
124
+ if self .got_values_flag :
125
+ # no need to check if values aren't provided while initializing DataSet
126
+ list (map (self .check_example , self .examples ))
121
127
122
128
def add_example (self , example ):
123
129
"Add an example to the list of examples, checking it first."
0 commit comments