This file contains hidden or 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
Act as a project manager for a data science team in a tech company. | |
We will be using a special notation now to indicate the flow of a data science project. | |
I will provide you that notation, | |
your task is to give a detailed plan for each step in the project as identified by the notation. | |
Let's take an example: | |
Project Name: Churn Analytics for a Telecom Company | |
Dataset: Database with over 20000 customers data, has features including | |
contract, payment method, paperless billing, monthly charges, total charges, gender, age range and of course churn (yes \ no) |
This file contains hidden or 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
items_popularity = pd.read_csv('datasets/item_popularity.csv', | |
encoding='utf-8') | |
items_popularity['popularity_scale_10'] = np.array( | |
np.round((items_popularity['pop_percent'] * 10)), | |
dtype='int') | |
items_popularity['popularity_scale_100'] = np.array( | |
np.round((items_popularity['pop_percent'] * 100)), | |
dtype='int') | |
items_popularity |
This file contains hidden or 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
from sklearn.preprocessing import Binarizer | |
bn = Binarizer(threshold=0.9) | |
pd_watched = bn.transform([popsong_df['listen_count']])[0] | |
popsong_df['pd_watched'] = pd_watched | |
popsong_df.head(11) |
This file contains hidden or 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
watched = np.array(popsong_df['listen_count']) | |
watched[watched >= 1] = 1 | |
popsong_df['watched'] = watched |
This file contains hidden or 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
popsong_df = pd.read_csv('datasets/song_views.csv', encoding='utf-8') | |
popsong_df.head(10) |
This file contains hidden or 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
poke_df[['HP', 'Attack', 'Defense']].describe() |
This file contains hidden or 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
poke_df[['HP', 'Attack', 'Defense']].head() |
This file contains hidden or 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
poke_df = pd.read_csv('datasets/Pokemon.csv', encoding='utf-8') | |
poke_df.head() |
This file contains hidden or 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 pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as spstats | |
%matplotlib inline |
This file contains hidden or 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
%%time | |
responses = [] | |
for i in tqdm(range(10000)): | |
API_URL = 'http://0.0.0.0:5000/apparel_classifier/api/v1/model2_predict' | |
# sending post request and saving response as response object | |
r = requests.post(url=API_URL, data=data) | |
responses.append(r.json()) | |
len(responses) | |
print('Inference time per image: {} ms'.format((326 / 10000) * 1000)) |
NewerOlder