Skip to content

Instantly share code, notes, and snippets.

View vineethm1627's full-sized avatar
🎯
Focusing

M Vineeth vineethm1627

🎯
Focusing
View GitHub Profile
images = [img, edge_roberts, edge_prewitt, edge_sobel]
names = ["input", "roberts", "prewitt", "sobel"]
fig = plt.figure(figsize = (8, 8))
for i in range(4):
fig.add_subplot(2, 2, i + 1)
plt.title(names[i])
plt.imshow(images[i], cmap = 'gray')
# Import necessary modules
from scipy.stats import randint
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import RandomizedSearchCV
# Setup the parameters and distributions to sample from: param_dist
param_dist = {"max_depth": [3, None],
"max_features": randint(1, 9),
"min_samples_leaf": randint(1, 9),
"criterion": ["gini", "entropy"]}
cols = ['EducationField']
data = pd.get_dummies(data, columns = cols, prefix = cols)
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
data[category_cols] = data[category_cols].apply(le.fit_transform)
data.head()
# gender : Female : 0, Male : 1
data['Gender'] = data['Gender'].map({'Female' : 1, 'Male' : 0})
data.head()
# lets scale the values.
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
data[numerical_cols] = scaler.fit_transform(data[numerical_cols])