New York City Taxi Fare Prediction – Analysis and Prediction

Tinkering with multiple machine learning algorithms and methods to predict Google’s New York City Taxi Fare Prediction challenge.

In this article,i will be using different machine learning techniques to predict fare_amount.

you can learn more about this dataset on Kaggle. 😇

Note: RMSE(Sq. root(mean_squared_error)) will be used to measure score for our model(s).

Continue reading “New York City Taxi Fare Prediction – Analysis and Prediction”

Face Feature(s) Detection with OpenCV

import cv2

face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
eye_cascade = cv2.CascadeClassifier("haarcascade_eye.xml")
smile_cascade = cv2.CascadeClassifier("haarcascade_smile.xml")

cap = cv2.VideoCapture(0)

while True:
    ret, img =
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x, y, w, h) in faces:
        cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
        roi_gray = gray[y:y+h, x:x+w]
        roi_color = img[y:y+h, x:x+w]

        smile = smile_cascade.detectMultiScale(
            minSize=(25, 25),

        for (x, y, w, h) in smile:
            print("Smile Detected")
            cv2.rectangle(roi_color, (x, y), (x + w, y + h), (255, 255, 0), 2)

        eyes = eye_cascade.detectMultiScale(roi_gray)
        for (ex, ey, ew, eh) in eyes:
            cv2.rectangle(roi_color, (ex, ey), (ex + ew, ey + eh), (0, 255, 0), 2)

    cv2.imshow('img', img)
    k = cv2.waitKey(30) & 0xff
    if k == 27:


^ The above script detects facial features such as face,eyes and smile.There are tons of pre-trained haarcascades available for OpenCV that you can use to detect objects such as Moving cars, traffic signs etc.