Get the processor core affinity for a process ( cores on which it is allowed to run )
taskset -cp <PID>
Example,
[root@user]# taskset -cp 74515
pid 74515's current affinity list: 0-7
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Jun 07 11:11:16 2014 | |
@author: Dipanjan | |
""" | |
#import sys | |
#from lxml import html |
Get the processor core affinity for a process ( cores on which it is allowed to run )
taskset -cp <PID>
Example,
[root@user]# taskset -cp 74515
pid 74515's current affinity list: 0-7
white_wine = pd.read_csv('winequality-white.csv', sep=';') | |
red_wine = pd.read_csv('winequality-red.csv', sep=';') | |
# store wine type as an attribute | |
red_wine['wine_type'] = 'red' | |
white_wine['wine_type'] = 'white' | |
# bucket wine quality scores into qualitative quality labels | |
red_wine['quality_label'] = red_wine['quality'].apply(lambda value: 'low' | |
if value <= 5 else 'medium' |
subset_attributes = ['residual sugar', 'total sulfur dioxide', 'sulphates', | |
'alcohol', 'volatile acidity', 'quality'] | |
rs = round(red_wine[subset_attributes].describe(),2) | |
ws = round(white_wine[subset_attributes].describe(),2) | |
pd.concat([rs, ws], axis=1, keys=['Red Wine Statistics', 'White Wine Statistics']) |
wines.hist(bins=15, color='steelblue', edgecolor='black', linewidth=1.0, | |
xlabelsize=8, ylabelsize=8, grid=False) | |
plt.tight_layout(rect=(0, 0, 1.2, 1.2)) |
# Histogram | |
fig = plt.figure(figsize = (6,4)) | |
title = fig.suptitle("Sulphates Content in Wine", fontsize=14) | |
fig.subplots_adjust(top=0.85, wspace=0.3) | |
ax = fig.add_subplot(1,1, 1) | |
ax.set_xlabel("Sulphates") | |
ax.set_ylabel("Frequency") | |
ax.text(1.2, 800, r'$\mu$='+str(round(wines['sulphates'].mean(),2)), | |
fontsize=12) |
# Bar Plot | |
fig = plt.figure(figsize = (6, 4)) | |
title = fig.suptitle("Wine Quality Frequency", fontsize=14) | |
fig.subplots_adjust(top=0.85, wspace=0.3) | |
ax = fig.add_subplot(1,1, 1) | |
ax.set_xlabel("Quality") | |
ax.set_ylabel("Frequency") | |
w_q = wines['quality'].value_counts() | |
w_q = (list(w_q.index), list(w_q.values)) |
# Correlation Matrix Heatmap | |
f, ax = plt.subplots(figsize=(10, 6)) | |
corr = wines.corr() | |
hm = sns.heatmap(round(corr,2), annot=True, ax=ax, cmap="coolwarm",fmt='.2f', | |
linewidths=.05) | |
f.subplots_adjust(top=0.93) | |
t= f.suptitle('Wine Attributes Correlation Heatmap', fontsize=14) |
# Pair-wise Scatter Plots | |
cols = ['density', 'residual sugar', 'total sulfur dioxide', 'fixed acidity'] | |
pp = sns.pairplot(wines[cols], size=1.8, aspect=1.8, | |
plot_kws=dict(edgecolor="k", linewidth=0.5), | |
diag_kind="kde", diag_kws=dict(shade=True)) | |
fig = pp.fig | |
fig.subplots_adjust(top=0.93, wspace=0.3) | |
t = fig.suptitle('Wine Attributes Pairwise Plots', fontsize=14) |
# Scaling attribute values to avoid few outiers | |
cols = ['density', 'residual sugar', 'total sulfur dioxide', 'fixed acidity'] | |
subset_df = wines[cols] | |
from sklearn.preprocessing import StandardScaler | |
ss = StandardScaler() | |
scaled_df = ss.fit_transform(subset_df) | |
scaled_df = pd.DataFrame(scaled_df, columns=cols) | |
final_df = pd.concat([scaled_df, wines['wine_type']], axis=1) |