in [ ]from sklearn metrics pairwise import euclidean_distancescosine_similarity eucdis euclidean_distances(new_vbow reshape( ,- vbow_featurescossim cosine_similarity(new_vbow reshape( ,- vbow_featuresresult_df pd dataframe({'euclideandistance'eucdis[ ]'cosinesimilarity'cossim[ ]}pd concat([dfresult_df]axis= out[ ]image cosinesimilarity euclideandistance cat dog based on the distance and similarity metricswe can see that our new image (of catis definitely closer to the cat image than the dog image try this out with bigger dataset to get better resultsautomated feature engineering with deep learning we have used lot of simple and sophisticated feature engineering techniques so far in this section building complex feature engineering systems and pipelines is time consuming and building algorithms for the same is even more tasking deep learning is novel and new approach toward automating this complex task of feature engineering by making the machine extract features automatically by learning multiple layered and complex representations of the underlying raw data convolutional neural networks or cnns are extensively used for automated feature extraction in images we have already covered the basic principles of cnns in go ahead and refresh your memory you heading to the "important conceptssub-section under the "deep learningsection in just like we mentioned beforethe idea of cnns operate on the principles of convolution and pooling besides your regular activation function layers convolutional layers typically slides or convolves learnable filters (also known as kernels or convolution matrixacross the entire width and height of the input image pixels dot products between the input pixels and the filter are computed at each position on sliding the filter two-dimensional activation maps for the filter get created and consequently the network is able to learn these filters when it activates on detecting specific features like edgescorners and so on if we take filterswe will get separate two-dimensional activation mapswhich can then be stacked along the depth dimension to get the output volume pooling is kind of aggregation or downsampling layer where typically non-linear downsampling operation is inserted between convolutional layers filters are applied here too they are slided along the convolution output matrix andfor each sliding operationalso known as strideelements in the slice of matrix covered by the pooling filter are either summed (sum poolingor averaged (mean poolingor the maximum value is selected (max poolingmore than often max pooling works really well in several realworld scenarios pooling helps in reducing feature dimensionality and control model overfitting let' now try to use deep learning for automated feature extraction on our sample images using cnns load the following dependencies necessary for building deep networks in [ ]from keras models import sequential from keras layers convolutional import conv from keras layers convolutional import maxpooling from keras import backend as using tensorflow backend