Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 428ca6f

Browse files
committed
Moved assignment of self.dataset into train().
1 parent 2341738 commit 428ca6f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

learning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def train(self, dataset):
160160
Count how many times each value of each attribute occurs.
161161
Store count in N[targetvalue][attr][val]. Let N[attr][None] be the
162162
sum over all vals."""
163+
self.dataset = dataset
163164
N = {}
164165
## Initialize to 0
165166
for gv in self.dataset.values[self.dataset.target]:
@@ -446,7 +447,6 @@ def train_and_test(learner, dataset, start, end):
446447
examples = dataset.examples
447448
try:
448449
dataset.examples = examples[:start] + examples[end:]
449-
learner.dataset = dataset
450450
learner.train(dataset)
451451
return test(learner, dataset, examples[start:end])
452452
finally:

0 commit comments

Comments
 (0)