Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
xgb_best = H2OXGBoostEstimator(**params_best, | |
monotone_constraints=mono_constraints) | |
xgb_best.train(x=features, y=target, training_frame=training_frame, | |
validation_frame=validation_frame) | |
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
corr = pd.DataFrame(train[features + | |
[target]].corr(method='spearman')[target]).iloc[:-1] | |
corr.columns = ['Spearman Correlation Coefficient'] | |
values = [int(i) for i in np.sign(corr.values)] | |
mono_constraints = dict(zip(corr.index, values)) | |
mono_constraints |
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 | |
from matplotlib import pyplot as plt | |
from matplotlib.animation import FuncAnimation | |
plt.style.use('seaborn-pastel') | |
fig = plt.figure() | |
ax = plt.axes(xlim=(0, 4), ylim=(-2, 2)) | |
line, = ax.plot([], [], lw=3) |
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
iter_ = 0 | |
best_error = 0 | |
best_iter = 0 | |
best_model = None | |
col_sample_rates = [0.1, 0.5, 0.9] | |
subsamples = [0.1, 0.5, 0.9] | |
etas = [0.01, 0.001] | |
max_depths = [3, 6, 12, 15, 18] | |
reg_alphas = [0.01, 0.001] |
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
labels_dict = {0:'sadness', 1:'joy', 2:'love', 3:'anger', 4:'fear', 5:'surprise'} | |
train['description'] = train['label'].map(labels_dict ) | |
train.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
import numpy as np | |
import pandas as pd | |
import string | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set(style='whitegrid', palette='muted', font_scale=1.2) | |
colors = ["#01BEFE", "#FFDD00", "#FF7D00", "#FF006D", "#ADFF02", "#8F00FF"] | |
sns.set_palette(sns.color_palette(colors)) |
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
!wget https://www.dropbox.com/s/607ptdakxuh5i4s/merged_training.pkl | |
# Defining a helper function to load the data | |
import pickle | |
def load_from_pickle(directory): | |
return pickle.load(open(directory,"rb")) | |
# Loading the data | |
data = load_from_pickle(directory="merged_training.pkl") |
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
chart = ctc.Pie("Top 5 cities by the number of respondents") | |
chart.set_options( | |
labels=list(cities.index), | |
inner_radius=0.5, | |
colors=['#FFF1C5','#F7B7A3','#EA5F89','#9B3192','#57167E','#47B39C','#00529B'], | |
) | |
chart.add_series(list(cities['values'])) | |
# Calling the load_javascript function when rendering chart first time. |
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
chart = ctc.Bar("Cities") | |
chart.set_options( | |
labels=list(cities.index), | |
x_label='City', | |
y_label='Count', | |
colors=['#FFF1C5','#F7B7A3','#EA5F89','#9B3192','#57167E'], | |
) | |
chart.add_series('Count',list(cities['values'])) |
NewerOlder