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.metrics import mean_squared_log_error | |
import numpy as np | |
rmsle = np.sqrt(mean_squared_log_error(y_actual, y_hat)) |
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.metrics import mean_squared_error | |
import numpy as np | |
rmse = np.sqrt(mean_squared_error(y_actual, y_hat)) |
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.metrics import mean_squared_error | |
mse = mean_squared_error(y_actual, y_hat) |
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
# Set number of splits | |
NO_SPLITS = fulldata.shape[0] | |
# Create KFold object with number of splits | |
kf = KFold(n_splits=NO_SPLITS) |
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 | |
from sklearn import datasets | |
from sklearn.model_selection import KFold | |
from sklearn.linear_model import LogisticRegression | |
# Import breast cancer (dataset) object from sklearn library | |
breast_cancer = datasets.load_breast_cancer() | |
# Define features need to be extracted from breast cancer (dataset) object |
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 | |
from sklearn import datasets | |
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import LogisticRegression | |
# Import breast cancer (dataset) object from sklearn library | |
breast_cancer = datasets.load_breast_cancer() | |
# Define features need to be extracted from breast cancer (dataset) object |
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 libraries | |
import numpy as np | |
import pandas as pd | |
import eli5 | |
from sklearn.ensemble import RandomForestRegressor | |
from sklearn.model_selection import train_test_split | |
from eli5.sklearn import PermutationImportance | |
# load data file |
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
# Initalize webcam. 0 starts built-in camera | |
cap = cv2.VideoCapture(0) | |
# Specify HSV range of Tennis Ball | |
ballHSVLower = np.array([25, 75, 85]) | |
ballHSVUpper = np.array([50, 220, 255]) | |
while True: | |
# Read captured webcam frame | |
_, frame = cap.read() |
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 | |
incExpDF = pd.DataFrame({'id' : [101, 102, 103, 104, 105], | |
'familyCnt' : [2, 4, 3, 3, 5], | |
'totalInc' : [68000, 72000, 34000, 44000, 52000], | |
'totalExp' : [48000, 66000, 33000, 41000, 50000]}) | |
incExpDF['incPerPerson'] = incExpDF['totalInc'] / incExpDF['familyCnt'] | |
incExpDF['expPerPerson'] = incExpDF['totalExp'] / incExpDF['familyCnt'] | |
incExpDF['savingsPerPerson'] = incExpDF['incPerPerson'] - incExpDF['expPerPerson'] |
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 | |
gadgetDF = pd.DataFrame({'gadgetId' : [101, 102, 103, 104, 105], | |
'gadgetName' : ['Apple_iPhone_6', | |
'Apple_iPad_3', | |
'Samsung_Galaxy_S8', | |
'Samsung_Galaxy_S9', | |
'Google_Pixel_3']}) | |
dummyDF = gadgetDF['gadgetName'].apply(lambda x: pd.Series(x.split('_'))) |
NewerOlder