text_html_output_1.png
from sklearn.metrics import cohen_kappa_score

import numpy as np # linear algebra

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import pandas as pd
Accepted = [540, 602, 643, 783, 979, 1300]
Submitted = [1807, 2123, 2145, 2620, 3303, 5160]
Year = [2014, 2015, 2016, 2017, 2018, 2019]
list_of_tuples = list(zip(Year, Accepted, Submitted))
df = pd.DataFrame(list_of_tuples, columns=['Year', 'Accepted', 'Submitted'])
df

train = pd.read_csv('../input/petfinder-adoption-prediction/train/train.csv')
train.AdoptionSpeed.value_counts(normalize=True)

from sklearn.metrics import cohen_kappa_score
from itertools import repeat
import random
distribution = list(reversed(list(train.AdoptionSpeed.value_counts(normalize=True))))
y_true = train['AdoptionSpeed'].tolist()
y_pred = list(np.random.choice([0, 1, 2, 3, 4], p=distribution, size=len(y_true)))
cohen_kappa_score(y_true, y_pred, weights='quadratic')

train = pd.read_csv('../input/petfinder-adoption-prediction/train/train.csv')
test = pd.read_csv('../input/petfinder-adoption-prediction/test/test.csv')
train['has_photo'] = train['PhotoAmt'].apply(lambda x: True if x > 0 else False)
test['has_photo'] = test['PhotoAmt'].apply(lambda x: True if x > 0 else False)

print('Missing photos in train set: %d' % train.has_photo.value_counts()[0])
print('Missing photos in test set: %d' % test.has_photo.value_counts()[0])
print('Percent missing in test set: %.2f' % (test.has_photo.value_counts()[0] / test.shape[0] * 100))