This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def multicollinearity_by_vif(X, vif=5): | |
"""Remove columns from X whose VIF is greater than supplied 'vif' | |
Parameters: | |
X:array or dataframe containing data excluding target variable | |
vif: int or float of limiting value of VIF | |
Note: | |
This function changes X inplace | |
""" | |
import statsmodels.api as sm | |
from statsmodels.stats.outliers_influence import variance_inflation_factor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# data as pandas DataFrame | |
train = ... | |
# Variables to store out bounds by column value | |
upper_bounds = {} | |
lower_bounds = {} | |
# Best practice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"basics": { | |
"name": "Peeush Agarwal", | |
"label": "Senior ML Engineer", | |
"email": "[email protected]", | |
"phone": "+91 82377 28795", | |
"location": { | |
"city": "Pune", | |
"region": "Maharashtra", | |
"countryCode": "IN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"basics": { | |
"name": "Megha Goyal", | |
"label": "WFM Business Partner | Chief of Staff | MIS Executive", | |
"email": "[email protected]", | |
"phone": "+91-90961 69255", | |
"location": { | |
"address": "Wagholi", | |
"city": "Pune", | |
"region": "Maharashtra" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
cov_mat = np.cov(X_train_std.T) | |
eigen_vals, eigen_vecs = np.linalg.eig(cov_mat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.model_selection import train_test_split | |
from sklearn.preprocessing import StandardScaler | |
# split into training and testing sets | |
X, y = df_wine.iloc[:, 1:].values, df_wine.iloc[:, 0].values | |
X_train, X_test, y_train, y_test = train_test_split( | |
X, y, test_size=0.3, | |
stratify=y, random_state=0 | |
) | |
# standardize the features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df_wine = pd.read_csv('https://archive.ics.uci.edu/ml/' | |
'machine-learning-databases/wine/wine.data', | |
header=None) | |
df_wine.head() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Deploy to Raspberry Pi | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dockerfile | |
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
gunicorn -w 1 -b 0.0.0.0:4000 app:app |
NewerOlder