In [1]:
# import
import graphlab as gl

In [2]:
# setting defaults
gl.canvas.set_target('ipynb')

loading the dataset


In [3]:
image_train = gl.SFrame('data/image_train_data/')
image_test = gl.SFrame('data/image_test_data/')


This non-commercial license of GraphLab Create for academic use is assigned to atul9806@yahoo.in and will expire on February 02, 2018.
[INFO] graphlab.cython.cy_server: GraphLab Create v2.1 started. Logging: C:\Users\Atul\AppData\Local\Temp\graphlab_server_1501638574.log.0

Exloring the data


In [4]:
image_train['image'].show()


Training Classifier on Raw Image


In [5]:
raw_pixel_model = gl.logistic_classifier.create(image_train, 
                                         target='label',
                                        features=['image_array'])


PROGRESS: Creating a validation set from 5 percent of training data. This may take a while.
          You can set ``validation_set=None`` to disable validation tracking.

WARNING: The number of feature dimensions in this problem is very large in comparison with the number of examples. Unless an appropriate regularization value is set, this model may not provide accurate predictions for a validation/test set.
Logistic regression:
--------------------------------------------------------
Number of examples          : 1912
Number of classes           : 4
Number of feature columns   : 1
Number of unpacked features : 3072
Number of coefficients    : 9219
Starting L-BFGS
--------------------------------------------------------
+-----------+----------+-----------+--------------+-------------------+---------------------+
| Iteration | Passes   | Step size | Elapsed Time | Training-accuracy | Validation-accuracy |
+-----------+----------+-----------+--------------+-------------------+---------------------+
| 1         | 6        | 0.000010  | 3.652787     | 0.277720          | 0.301075            |
| 2         | 9        | 5.000000  | 5.305880     | 0.418933          | 0.397849            |
| 3         | 10       | 5.000000  | 6.092412     | 0.363494          | 0.365591            |
| 4         | 12       | 1.000000  | 7.245174     | 0.424686          | 0.376344            |
| 5         | 13       | 1.000000  | 7.847084     | 0.435146          | 0.408602            |
| 6         | 14       | 1.000000  | 8.474498     | 0.458682          | 0.473118            |
| 7         | 15       | 1.000000  | 9.061397     | 0.482741          | 0.580645            |
| 8         | 16       | 1.000000  | 9.714345     | 0.446653          | 0.430108            |
| 9         | 18       | 1.000000  | 10.744543    | 0.481695          | 0.505376            |
| 10        | 19       | 1.000000  | 11.367966    | 0.400628          | 0.462366            |
+-----------+----------+-----------+--------------+-------------------+---------------------+
TERMINATED: Iteration limit reached.
This model may not be optimal. To improve it, consider increasing `max_iterations`.

Making prediction


In [6]:
image_test['image'][:6].show()



In [7]:
image_test[:6]['label']


Out[7]:
dtype: str
Rows: 6
['cat', 'automobile', 'cat', 'automobile', 'dog', 'dog']

In [8]:
raw_pixel_model.predict(image_test[:6])


Out[8]:
dtype: str
Rows: 6
['cat', 'cat', 'cat', 'automobile', 'cat', 'dog']

Evaluating the model


In [9]:
raw_pixel_model.evaluate(image_test)


Out[9]:
{'accuracy': 0.37325, 'auc': 0.6969332083333338, 'confusion_matrix': Columns:
 	target_label	str
 	predicted_label	str
 	count	int
 
 Rows: 16
 
 Data:
 +--------------+-----------------+-------+
 | target_label | predicted_label | count |
 +--------------+-----------------+-------+
 |     dog      |    automobile   |   37  |
 |  automobile  |       cat       |  569  |
 |     cat      |       cat       |  828  |
 |     cat      |       bird      |   81  |
 |  automobile  |       bird      |   43  |
 |     bird     |       bird      |  209  |
 |     bird     |       dog       |   32  |
 |  automobile  |       dog       |   21  |
 |     dog      |       bird      |   86  |
 |     cat      |    automobile   |   53  |
 +--------------+-----------------+-------+
 [16 rows x 3 columns]
 Note: Only the head of the SFrame is printed.
 You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns., 'f1_score': 0.3386488595346711, 'log_loss': 1.3392351067062547, 'precision': 0.495979030546124, 'recall': 0.37324999999999997, 'roc_curve': Columns:
 	threshold	float
 	fpr	float
 	tpr	float
 	p	int
 	n	int
 	class	int
 
 Rows: 400004
 
 Data:
 +-----------+-----+-----+------+------+-------+
 | threshold | fpr | tpr |  p   |  n   | class |
 +-----------+-----+-----+------+------+-------+
 |    0.0    | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   1e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   2e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   3e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   4e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   5e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   6e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   7e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   8e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 |   9e-05   | 1.0 | 1.0 | 1000 | 3000 |   0   |
 +-----------+-----+-----+------+------+-------+
 [400004 rows x 6 columns]
 Note: Only the head of the SFrame is printed.
 You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.}

Improve the model using Deep Features


In [10]:
len(image_train)


Out[10]:
2005

In [11]:
#deep_learning_model = gl.load_model('http://s3.amazonaws.com/GraphLab-Datasets/deeplearning/imagenet_model_iter45')
#deep_learning_model.save('imagenet_model')
#image_train['deep_features']= deep_learning_model.extract_features(image_train)

In [12]:
image_train.head(5)


Out[12]:
id image label deep_features image_array
24 Height: 32 Width: 32 bird [0.242871761322,
1.09545373917, 0.0, ...
[73.0, 77.0, 58.0, 71.0,
68.0, 50.0, 77.0, 69.0, ...
33 Height: 32 Width: 32 cat [0.525087952614, 0.0,
0.0, 0.0, 0.0, 0.0, ...
[7.0, 5.0, 8.0, 7.0, 5.0,
8.0, 5.0, 4.0, 6.0, 7.0, ...
36 Height: 32 Width: 32 cat [0.566015958786, 0.0,
0.0, 0.0, 0.0, 0.0, ...
[169.0, 122.0, 65.0,
131.0, 108.0, 75.0, ...
70 Height: 32 Width: 32 dog [1.12979578972, 0.0, 0.0,
0.778194487095, 0.0, ...
[154.0, 179.0, 152.0,
159.0, 183.0, 157.0, ...
90 Height: 32 Width: 32 bird [1.71786928177, 0.0, 0.0,
0.0, 0.0, 0.0, ...
[216.0, 195.0, 180.0,
201.0, 178.0, 160.0, ...
[5 rows x 5 columns]

Given the deep feaures, training a classifier


In [13]:
deep_feature_model = gl.logistic_classifier.create(image_train, 
                                                   features = ['deep_features'],
                                                   target = 'label')


PROGRESS: Creating a validation set from 5 percent of training data. This may take a while.
          You can set ``validation_set=None`` to disable validation tracking.

WARNING: The number of feature dimensions in this problem is very large in comparison with the number of examples. Unless an appropriate regularization value is set, this model may not provide accurate predictions for a validation/test set.
WARNING: Detected extremely low variance for feature(s) 'deep_features' because all entries are nearly the same.
Proceeding with model training using all features. If the model does not provide results of adequate quality, exclude the above mentioned feature(s) from the input dataset.
Logistic regression:
--------------------------------------------------------
Number of examples          : 1889
Number of classes           : 4
Number of feature columns   : 1
Number of unpacked features : 4096
Number of coefficients    : 12291
Starting L-BFGS
--------------------------------------------------------
+-----------+----------+-----------+--------------+-------------------+---------------------+
| Iteration | Passes   | Step size | Elapsed Time | Training-accuracy | Validation-accuracy |
+-----------+----------+-----------+--------------+-------------------+---------------------+
| 1         | 5        | 0.000132  | 3.104051     | 0.736368          | 0.629310            |
| 2         | 9        | 0.250000  | 6.161572     | 0.767602          | 0.706897            |
| 3         | 10       | 0.250000  | 7.176743     | 0.771308          | 0.706897            |
| 4         | 11       | 0.250000  | 8.226939     | 0.775543          | 0.715517            |
| 5         | 12       | 0.250000  | 9.140542     | 0.785601          | 0.724138            |
| 6         | 13       | 0.250000  | 10.053145    | 0.797247          | 0.732759            |
| 7         | 14       | 0.250000  | 10.916216    | 0.821069          | 0.732759            |
| 8         | 15       | 0.250000  | 11.910873    | 0.836951          | 0.724138            |
| 9         | 16       | 0.250000  | 12.782450    | 0.858126          | 0.724138            |
| 10        | 17       | 0.250000  | 13.683044    | 0.872949          | 0.741379            |
+-----------+----------+-----------+--------------+-------------------+---------------------+
TERMINATED: Iteration limit reached.
This model may not be optimal. To improve it, consider increasing `max_iterations`.

Predict the data


In [15]:
image_test[:6]['image'].show()



In [16]:
deep_feature_model.predict(image_test[:6])


Out[16]:
dtype: str
Rows: 6
['cat', 'automobile', 'cat', 'automobile', 'dog', 'dog']

Cumpute the test data accuracy of deep learing model


In [17]:
deep_feature_model.evaluate(image_test)


Out[17]:
{'accuracy': 0.7855, 'auc': 0.9400877083333333, 'confusion_matrix': Columns:
 	target_label	str
 	predicted_label	str
 	count	int
 
 Rows: 16
 
 Data:
 +--------------+-----------------+-------+
 | target_label | predicted_label | count |
 +--------------+-----------------+-------+
 |     cat      |       cat       |  676  |
 |     bird     |    automobile   |   31  |
 |  automobile  |    automobile   |  960  |
 |     bird     |       bird      |  773  |
 |  automobile  |       bird      |   20  |
 |     cat      |       bird      |   66  |
 |     bird     |       dog       |   64  |
 |  automobile  |       dog       |   7   |
 |     dog      |       bird      |   37  |
 |     cat      |    automobile   |   36  |
 +--------------+-----------------+-------+
 [16 rows x 3 columns]
 Note: Only the head of the SFrame is printed.
 You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns., 'f1_score': 0.7857572168601491, 'log_loss': 0.5697757768678041, 'precision': 0.7876150388981418, 'recall': 0.7855, 'roc_curve': Columns:
 	threshold	float
 	fpr	float
 	tpr	float
 	p	int
 	n	int
 	class	int
 
 Rows: 400004
 
 Data:
 +-----------+----------------+-----+------+------+-------+
 | threshold |      fpr       | tpr |  p   |  n   | class |
 +-----------+----------------+-----+------+------+-------+
 |    0.0    |      1.0       | 1.0 | 1000 | 3000 |   0   |
 |   1e-05   | 0.975333333333 | 1.0 | 1000 | 3000 |   0   |
 |   2e-05   | 0.968333333333 | 1.0 | 1000 | 3000 |   0   |
 |   3e-05   |      0.96      | 1.0 | 1000 | 3000 |   0   |
 |   4e-05   |     0.953      | 1.0 | 1000 | 3000 |   0   |
 |   5e-05   | 0.948333333333 | 1.0 | 1000 | 3000 |   0   |
 |   6e-05   | 0.943666666667 | 1.0 | 1000 | 3000 |   0   |
 |   7e-05   | 0.938333333333 | 1.0 | 1000 | 3000 |   0   |
 |   8e-05   | 0.934666666667 | 1.0 | 1000 | 3000 |   0   |
 |   9e-05   | 0.932333333333 | 1.0 | 1000 | 3000 |   0   |
 +-----------+----------------+-----+------+------+-------+
 [400004 rows x 6 columns]
 Note: Only the head of the SFrame is printed.
 You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.}

Deep Features for Image Retrieval


In [21]:
knn_model = gl.nearest_neighbors.create(image_train, 
                                                  features=['deep_features'],
                                                  label='id')


Starting brute force nearest neighbors model training.

Using this model to imgae retrieval


In [23]:
cat = image_train[18:19]
cat['image'].show()



In [24]:
knn_model.query(cat)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.0498753   | 56.041ms     |
| Done         |         | 100         | 310.724ms    |
+--------------+---------+-------------+--------------+
Out[24]:
query_label reference_label distance rank
0 384 0.0 1
0 6910 36.9403137951 2
0 39777 38.4634888975 3
0 36870 39.7559623119 4
0 41734 39.7866014148 5
[5 rows x 4 columns]


In [25]:
def get_image(query_result):
    return image_train.filter_by(query_result['reference_label'], 'id')

In [27]:
cat_neighbour = get_image(knn_model.query(cat))


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.0498753   | 18.512ms     |
| Done         |         | 100         | 252.166ms    |
+--------------+---------+-------------+--------------+

In [29]:
cat_neighbour['image'].show()



In [30]:
car = image_train[8:9]
car['image'].show()



In [31]:
get_image(knn_model.query(car))['image'].show()


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.0498753   | 14.007ms     |
| Done         |         | 100         | 241.658ms    |
+--------------+---------+-------------+--------------+

In [32]:
# A function to find NN images

show_nn = lambda inp: get_image(knn_model.query( image_train[inp:inp+1]))['image'].show()

In [33]:
show_nn(8)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.0498753   | 14.51ms      |
| Done         |         | 100         | 248.664ms    |
+--------------+---------+-------------+--------------+

In [34]:
show_nn(12)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.0498753   | 15.008ms     |
| Done         |         | 100         | 244.159ms    |
+--------------+---------+-------------+--------------+

Quiz


In [36]:
image_train['label'].sketch_summary()


Out[36]:
+------------------+-------+----------+
|       item       | value | is exact |
+------------------+-------+----------+
|      Length      |  2005 |   Yes    |
| # Missing Values |   0   |   Yes    |
| # unique values  |   4   |    No    |
+------------------+-------+----------+

Most frequent items:
+-------+------------+-----+-----+------+
| value | automobile | cat | dog | bird |
+-------+------------+-----+-----+------+
| count |    509     | 509 | 509 | 478  |
+-------+------------+-----+-----+------+

In [44]:
# filter the data into {‘dog’,’cat’,’automobile’,bird’}
animal_type=['dog','cat','automobile','bird']
#dog = image_train.filter_by(image_train['label'], 'dog')
dog = image_train[image_train['label']=='dog']
cat = image_train[image_train['label']=='cat']
automobile = image_train[image_train['label']=='automobile']
bird = image_train[image_train['label']=='bird']

In [95]:
print(len(dog), len(bird), len(automobile), len(cat))


(509, 478, 509, 509)

In [114]:
# creating models for each category
dog_model = gl.nearest_neighbors.create(dog,
                                       features=['deep_features'],
                                       label='label')
cat_model = gl.nearest_neighbors.create(cat,
                                       features=['deep_features'],
                                       label='label')
automobile_model = gl.nearest_neighbors.create(automobile,
                                       features=['deep_features'],
                                       label='label')
bird_model = gl.nearest_neighbors.create(bird,
                                       features=['deep_features'],
                                       label='label')
cat_model_id = gl.nearest_neighbors.create(cat,
                                       features=['deep_features'],
                                       label='id')
dog_model_id = gl.nearest_neighbors.create(dog,
                                       features=['deep_features'],
                                       label='id')


Starting brute force nearest neighbors model training.
Starting brute force nearest neighbors model training.
Starting brute force nearest neighbors model training.
Starting brute force nearest neighbors model training.
Starting brute force nearest neighbors model training.
Starting brute force nearest neighbors model training.

In [109]:
img = image_test[0:1]
img['image'].show()



In [48]:
cat_nn = cat_model.query(img)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 11.007ms     |
| Done         |         | 100         | 75.052ms     |
+--------------+---------+-------------+--------------+

In [113]:
get_image(cat_model_id.query(img, k=1))['image'].show()


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 11.009ms     |
| Done         |         | 100         | 74.049ms     |
+--------------+---------+-------------+--------------+

In [115]:
get_image(dog_model_id.query(img, k=1))['image'].show()


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 21.014ms     |
| Done         |         | 100         | 90.059ms     |
+--------------+---------+-------------+--------------+

In [49]:
cat_model.query(img)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 13.007ms     |
| Done         |         | 100         | 89.059ms     |
+--------------+---------+-------------+--------------+
Out[49]:
query_label reference_label distance rank
0 cat 34.623719208 1
0 cat 36.0068799284 2
0 cat 36.5200813436 3
0 cat 36.7548502521 4
0 cat 36.8731228168 5
[5 rows x 4 columns]


In [53]:
dog_nn = dog_model.query(img)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 7.005ms      |
| Done         |         | 100         | 73.049ms     |
+--------------+---------+-------------+--------------+

In [54]:
dog_model.query(img)


Starting pairwise querying.
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 0            | 1       | 0.196464    | 8.006ms      |
| Done         |         | 100         | 82.054ms     |
+--------------+---------+-------------+--------------+
Out[54]:
query_label reference_label distance rank
0 dog 37.4642628784 1
0 dog 37.5666832169 2
0 dog 37.6047267079 3
0 dog 37.7065585153 4
0 dog 38.5113254907 5
[5 rows x 4 columns]


In [55]:
cat_distance_mean = cat_nn['distance'].mean()
cat_distance_mean


Out[55]:
36.15573070978294

In [56]:
dog_distance_mean = dog_nn['distance'].mean()
dog_distance_mean


Out[56]:
37.77071136184156

In [57]:
image_test_cat = image_test[image_test['label']=='cat'] 
image_test_dog = image_test[image_test['label']=='dog'] 
image_test_bird = image_test[image_test['label']=='bird'] 
image_test_automobile = image_test[image_test['label']=='automobile']

In [58]:
dog_cat_neighbors = cat_model.query(image_test_dog, k=1)
dog_cat_neighbors


Starting blockwise querying.
max rows per data block: 4348
number of reference data blocks: 4
number of query data blocks: 1
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 1000         | 127000  | 24.9509     | 552.366ms    |
| Done         | 509000  | 100         | 575.381ms    |
+--------------+---------+-------------+--------------+
Out[58]:
query_label reference_label distance rank
0 cat 36.4196077068 1
1 cat 38.8353268874 1
2 cat 36.9763410854 1
3 cat 34.5750072914 1
4 cat 34.778824791 1
5 cat 35.1171578292 1
6 cat 40.6095830913 1
7 cat 39.9036867306 1
8 cat 38.0674700168 1
9 cat 42.7258732951 1
[1000 rows x 4 columns]
Note: Only the head of the SFrame is printed.
You can use print_rows(num_rows=m, num_columns=n) to print more rows and columns.


In [59]:
dog_dog_neighbors = dog_model.query(image_test_dog, k=1)
dog_bird_neighbors = bird_model.query(image_test_dog, k=1)
dog_auto_neighbors = automobile_model.query(image_test_dog, k=1)


Starting blockwise querying.
max rows per data block: 4348
number of reference data blocks: 4
number of query data blocks: 1
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 1000         | 127000  | 24.9509     | 626.414ms    |
| Done         | 509000  | 100         | 656.434ms    |
+--------------+---------+-------------+--------------+
Starting blockwise querying.
max rows per data block: 4348
number of reference data blocks: 4
number of query data blocks: 1
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 1000         | 120000  | 25.1046     | 525.348ms    |
| Done         | 478000  | 100         | 546.361ms    |
+--------------+---------+-------------+--------------+
Starting blockwise querying.
max rows per data block: 4348
number of reference data blocks: 4
number of query data blocks: 1
+--------------+---------+-------------+--------------+
| Query points | # Pairs | % Complete. | Elapsed Time |
+--------------+---------+-------------+--------------+
| 1000         | 127000  | 24.9509     | 554.368ms    |
| Done         | 509000  | 100         | 600.397ms    |
+--------------+---------+-------------+--------------+

In [69]:
dog_distances = gl.SFrame({'dog-automobile': dog_auto_neighbors['distance'],
                              'dog-bird': dog_bird_neighbors['distance'],
                             'dog-cat':dog_cat_neighbors['distance'],
                             'dog-dog':dog_dog_neighbors['distance']})

In [70]:
dog_distances.head()


Out[70]:
dog-automobile dog-bird dog-cat dog-dog
41.9579761457 41.7538647304 36.4196077068 33.4773590373
46.0021331807 41.3382958925 38.8353268874 32.8458495684
42.9462290692 38.6157590853 36.9763410854 35.0397073189
41.6866060048 37.0892269954 34.5750072914 33.9010327697
39.2269664935 38.272288694 34.778824791 37.4849250909
40.5845117698 39.1462089236 35.1171578292 34.945165344
45.1067352961 40.523040106 40.6095830913 39.0957278345
41.3221140974 38.1947918393 39.9036867306 37.7696131032
41.8244654995 40.1567131661 38.0674700168 35.1089144603
45.4976929401 45.5597962603 42.7258732951 43.2422832585
[10 rows x 4 columns]


In [88]:
def is_dog_correct(row):
    da = row['dog-dog'] < row['dog-automobile']
    dc = row['dog-dog'] < row['dog-cat']
    db = row['dog-dog'] < row['dog-bird']
    return 1 if ( da and dc and db ) else 0

In [89]:
is_dog_correct(dog_distances[11])


Out[89]:
0

In [90]:
dog_distances[11]


Out[90]:
{'dog-automobile': 38.66921769561575,
 'dog-bird': 35.092457233195304,
 'dog-cat': 31.6633518591745,
 'dog-dog': 33.10211296474726}

In [91]:
sum_correct_predic = dog_distances.apply(is_dog_correct).sum()

In [92]:
sum_correct_predic


Out[92]:
678L

In [117]:
dog_model.evaluate(img)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-117-3311499be0f3> in <module>()
----> 1 dog_model.evaluate(img)

C:\tools\Anaconda3\envs\gl-env\lib\site-packages\graphlab\toolkits\_model.pyc in __getattribute__(self, attr)
    633             return self.get(attr)
    634         else:
--> 635             return object.__getattribute__(self, attr)
    636 
    637 class Model(CustomModel, ProxyBasedModel):

AttributeError: 'NearestNeighborsModel' object has no attribute 'evaluate'

In [ ]: