File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def plurality(xs):
2626 return k
2727
2828# This function was called ``apply_model`` in the first edition
29- def predict (features , model ):
29+ def predict (model , features ):
3030 '''Apply k-nn model'''
3131 k , train_feats , labels = model
3232 results = []
@@ -42,5 +42,5 @@ def predict(features, model):
4242
4343
4444def accuracy (features , labels , model ):
45- preds = predict (features , model )
45+ preds = predict (model , features )
4646 return np .mean (preds == labels )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def fit_model(features, labels):
4040
4141
4242# This function was called ``apply_model`` in the first edition
43- def predict (features , model ):
43+ def predict (model , features ):
4444 '''Apply a learned model'''
4545 # A model is a pair as returned by fit_model
4646 t , fi , reverse = model
@@ -51,5 +51,5 @@ def predict(features, model):
5151
5252def accuracy (features , labels , model ):
5353 '''Compute the accuracy of the model'''
54- preds = predict (features , model )
54+ preds = predict (model , features )
5555 return np .mean (preds == labels )
You can’t perform that action at this time.
0 commit comments