Kaggle competition: Deepfake Detection Challenge
<SOS> metric: LogLoss Kaggle data source: deepfake-detection-challenge<split>
%%capture
!pip install /kaggle/input/facenet-pytorch-vggface2/facenet_pytorch-1.0.1-py3-none-any.whl
!mkdir -p /tmp/.cache/torch/checkpoints/
!cp /kaggle/input/facenet-pytorch-vggface2/20180402-114759-vggface2-logits.pth /tmp/.cache/torch/checkpoints/vggface2_DG3kwML46X.pt
!cp /kaggle/input/facenet-pytorch-vggface2/20180402-114759-vggface2-features.pth /tmp/.cache/torch/checkpoints/vggface2_G5aNV2VSMn.pt
X_train, X_test, y_train, y_test = train_test_split(trainNorm, target, test_size=0.2, random_state=7)
 print('X_train: ', X_train.shape)
 print('X_test: ', X_test.shape)
 print('y_train: ', y_train.shape)
 print('y_test: ', y_test.shape )<compute_train_metric>
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
print(f'Running on device: {device}' )
def rmse_cv(model,X,y):
rmse = np.sqrt(-cross_val_score(model, X, y, scoring="neg_mean_squared_error", cv=5))
return rmse<define_variables>
mtcnn = MTCNN(device=device ).eval()
resnet = InceptionResnetV1(pretrained='vggface2', num_classes=2, device=device ).eval()
models = [LinearRegression() , Ridge() , Lasso() , ElasticNet() , SGDRegressor() , BayesianRidge() ,
cb.CatBoostRegressor() , RandomForestRegressor() , ]
names = ["LR", "Ridge", "Lasso", "ElasticNet", "SGD","BayesianRidge", "catboost","RandomForestRegressor"]<compute_train_metric>
bias = -0.4
weight = 0.068235746
submission = []
for filename, x_i in zip(filenames, X):
if x_i is not None and len(x_i)== 10:
prob = 1 /(1 + np.exp(-(bias +(weight * x_i ).sum())))
 else:
prob = 0.6
submission.append([os.path.basename(filename), prob] )
<compute_train_metric><EOS> 
submission = pd.DataFrame(submission, columns=['filename', 'label'])
 submission.sort_values('filename' ).to_csv('submission.csv', index=False )