コード例 #1
0
def data_plot(customers):
    customers.head()
    customers.describe()
    customers.info()

    sns.set_palette("GnBu_d")
    sns.set_style('whitegrid')

    sns.jointplot(x='Time on Website', y='Yearly Amount Spent', data=customers)
    sns.show()

    sns.jointplot(x='Time on App', y='Yearly Amount Spent', data=customers)
    sns.show()

    sns.jointplot(x='Time on App',
                  y='Length of Membership',
                  kind='hex',
                  data=customers)
    sns.show()

    sns.pairplot(customers)
    sns.show()

    sns.lmplot(x='Length of Membership',
               y='Yearly Amount Spent',
               data=customers)
    sns.show()
コード例 #2
0
def data_plot(df):
    sns.set_style('whitegrid')
    sns.lmplot('Room.Board',
               'Grad.Rate',
               data=df,
               hue='Private',
               palette='coolwarm',
               size=6,
               aspect=1,
               fit_reg=False)
    sns.show()

    sns.set_style('whitegrid')
    sns.lmplot('Outstate',
               'F.Undergrad',
               data=df,
               hue='Private',
               palette='coolwarm',
               size=6,
               aspect=1,
               fit_reg=False)
    sns.show()

    sns.set_style('darkgrid')
    g = sns.FacetGrid(df, hue="Private", palette='coolwarm', size=6, aspect=2)
    g = g.map(plt.hist, 'Outstate', bins=20, alpha=0.7)
    sns.show()

    sns.set_style('darkgrid')
    g = sns.FacetGrid(df, hue="Private", palette='coolwarm', size=6, aspect=2)
    g = g.map(plt.hist, 'Grad.Rate', bins=20, alpha=0.7)
    sns.show()
コード例 #3
0
def data_plot(ad_data):
	sns.set_style('whitegrid')
	ad_data['Age'].hist(bins=30)
	plt.xlabel('Age')

	sns.jointplot(x='Age',y='Area Income',data=ad_data)
	sns.show()

	sns.jointplot(x='Age',y='Daily Time Spent on Site',data=ad_data,color='red',kind='kde');
	sns.show()

	sns.jointplot(x='Daily Time Spent on Site',y='Daily Internet Usage',data=ad_data,color='green')
	sns.show()

	sns.pairplot(ad_data,hue='Clicked on Ad',palette='bwr')
	sns.show()
コード例 #4
0
def plot_data(yelp):
	sns.set_style('white')
	get_ipython().run_line_magic('matplotlib', 'inline')
	sns.show()

	g = sns.FacetGrid(yelp,col='stars')
	g.map(plt.hist,'text length')
	sns.show()

	sns.boxplot(x='stars',y='text length',data=yelp,palette='rainbow')
	sns.show()

	sns.countplot(x='stars',data=yelp,palette='rainbow')
	sns.show()

	stars = yelp.groupby('stars').mean()
	stars.corr().show()

	sns.heatmap(stars.corr(),cmap='coolwarm',annot=True).show()
コード例 #5
0
merged_model.save("whole_model.h5")

f = open("binarizer.pkl", "wb")
f.write(pickle.dumps(lb))
f.close()

print("Saved model to disk")

predicted_classes = merged_model.predict_classes(test_imgs)

cm = confusion_matrix([np.where(r == 1)[0][0]
                       for r in labels_test], predicted_classes)
plt.figure(figsize=(14, 10))
sns.heatmap(cm, annot=True)
sns.show()
sns.savefig("confusion_matrix.png")

plt.style.use("ggplot")
plt.figure(figsize=(14, 10))
N = EPOCHS
plt.plot(np.arange(0, N), train.history["loss"], label="train_loss")
plt.plot(np.arange(0, N), train.history["val_loss"], label="val_loss")
plt.plot(np.arange(0, N), train.history["acc"], label="acc")
plt.plot(np.arange(0, N), train.history["val_acc"], label="acc")

plt.title("Training Loss and Accuracy")
plt.xlabel("Epoch #")
plt.ylabel("Loss/Accuracy")
plt.legend(loc="upper left")
plt.show()
コード例 #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 09:57:49 2019

@author: chance
"""

import matplotlib.pyplot as plt
import seaborn as sns

# data prepare
iris = sns.load_dataset("iris")
# use seaborn
sns.pairplot(iris)
sns.show(s)