Skip to content

Instantly share code, notes, and snippets.

View fe3.py
def missing_values_table(df):
mis_val = df.isnull().sum()
mis_val_percent = 100 * df.isnull().sum() / len(df)
mis_val_table = pd.concat([mis_val, mis_val_percent], axis=1)
mis_val_table_ren_columns = mis_val_table.rename(
columns = {0 : 'Missing Values', 1 : '% of Total Values'})
mis_val_table_ren_columns = mis_val_table_ren_columns[
mis_val_table_ren_columns.iloc[:,1] != 0].sort_values(
'% of Total Values', ascending=False).round(1)
print ("Your selected dataframe has " + str(df.shape[1]) + " columns.\n"
View fe2.py
train = pd.read_csv("train.csv")
test = pd.read_csv("test.csv")
View fe1.py
#importing libraries
import numpy as np
import pandas as pd
from math import *
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler, LabelEncoder
from sklearn.tree import DecisionTreeRegressor
import xgboost as xgb
import matplotlib as plt
from sklearn.metrics import mean_squared_error, r2_score
View fd6.py
# Visualize
fig, axes = plt.subplots(1, len(faces))
for face, ax in zip(faces, axes):
ax.imshow(face.permute(1, 2, 0).int().numpy())
ax.axis('off')
fig.show()
View fd4.py
mtcnn = MTCNN(margin=40,select_largest=False,keep_all=true)
View fd3.py
# Load a single image and display
frame = cv2.imread("1.jpg")
# mtcnn process the image in RGB and opencv reads in BGR. So converting that.
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
# generating image from array
frame = Image.fromarray(frame)
plt.figure(figsize=(12, 8))
plt.imshow(frame)
plt.axis('off')
View fd2.py
from facenet_pytorch import MTCNN
import cv2
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
from tqdm.notebook import tqdm
View fd1.py
pip install facenet-pytorch
View 2C++15.cpp
centroids.print("Centroids:");