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
class SimpleDialogueManager(object): | |
""" | |
This is a simple dialogue manager to test the telegram bot. | |
The main part of our bot will be written here. | |
""" | |
def __init__(self): | |
# Instantiate all the models and TFIDF Objects. | |
print("Loading resources...") | |
# Instantiate a Chatterbot for Chitchat type questions | |
from chatterbot import ChatBot |
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
# We dont Probably need the Gridlines. Do we? If yes comment this line | |
sns.set(style="ticks") | |
# Here we create a matplotlib axes object. The extra parameters we use | |
# "ci" to remove confidence interval | |
# "marker" to have a x as marker. | |
# "scatter_kws" to provide style info for the points.[s for size] | |
# "line_kws" to provide style info for the line.[lw for line width] | |
g = sns.regplot(x="tip", y="total_bill", data=tips, ci = False, |
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
# So this function creates a faceted plot. The plot is parameterized by the following: | |
# col : divides the data points into days and creates that many plots | |
# palette: deep, muted, pastel, bright, dark, and colorblind. change the colors in graph. Experiment with these | |
# col_wrap: we want 2 graphs in a row? Yes.We do | |
# scatter_kws: attributes for points | |
# hue: Colors on a particular column. | |
# size: controls the size of graph | |
g = sns.lmplot(x="tip", y="total_bill",ci=None,data=tips, col="day", |
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
sns.set(style="ticks") | |
flatui = ["#9b59b6", "#3498db", "#95a5a6", "#e74c3c", "#34495e", "#2ecc71"] | |
# This Function takes as input a custom palette | |
g = sns.barplot(x="sex", y="tip", hue="day", | |
palette=sns.color_palette(flatui),data=tips,ci=None) | |
# remove the top and right line in graph | |
sns.despine() |
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
# Create a list of 1000 Normal RVs | |
x = np.random.normal(size=1000) | |
sns.set_context("poster") | |
sns.set_style("ticks") | |
# This Function creates a normed Histogram by default. | |
# If we use the parameter kde=False and norm_hist=False then | |
# we will be using a count histogram | |
g=sns.distplot(x, |
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 scipy.stats as stats | |
a = 1.5 | |
b = 1.5 | |
x = np.arange(0.01, 1, 0.01) | |
y = stats.beta.rvs(a,b,size=10000) | |
y_act = stats.beta.pdf(x,a,b) | |
g=sns.distplot(y,kde=False,norm_hist=True, | |
kde_kws={"color":"g","lw":4,"label":"KDE Estim","alpha":0.5}, | |
hist_kws={"color":"r","alpha":0.3,"label":"Freq"}) |
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
# Create a Pairplot | |
g = sns.pairplot(iris,hue="species",palette="muted",size=5, | |
vars=["sepal_width", "sepal_length"],kind='reg',markers=['o','x','+']) | |
# To change the size of the scatterpoints in graph | |
g = g.map_offdiag(plt.scatter, s=35,alpha=0.5) | |
# remove the top and right line in graph | |
sns.despine() | |
# Additional line to adjust some appearance issue |
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 seaborn as sns | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
# We dont Probably need the Gridlines. Do we? If yes comment this line | |
sns.set(style="ticks") | |
player_df = pd.read_csv("../input/data.csv") | |
numcols = [ | |
'Overall', |
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 wage_split(x): | |
try: | |
return int(x.split("K")[0][1:]) | |
except: | |
return 0 | |
player_df['Wage'] = player_df['Wage'].apply(lambda x : wage_split(x)) | |
def value_split(x): | |
try: | |
if 'M' in x: | |
return float(x.split("M")[0][1:]) |
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 = player_df.corr() | |
g = sns.heatmap(corr, vmax=.3, center=0, | |
square=True, linewidths=.5, cbar_kws={"shrink": .5}, annot=True, fmt='.2f', cmap='coolwarm') | |
sns.despine() | |
g.figure.set_size_inches(14,10) | |
plt.show() |