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
| comb_product = pd.merge(products, prod, on ='product_id') | |
| comb_product_review = pd.merge(comb_product,reviews, on = 'order_id') | |
| review_count = pd.DataFrame(comb_product_review.groupby('product_category_name')['review_score'].count()) | |
| review_count.sort_values('review_score', ascending=False).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
| plt.rc("font", size=15) | |
| reviews.review_score.value_counts(sort=False).plot(kind='bar') | |
| plt.title('Rating Distribution\n') | |
| plt.xlabel('Rating') | |
| plt.ylabel('Count') | |
| plt.savefig('system1.png', bbox_inches='tight') | |
| plt.show() |
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
| products = pd.read_csv('olist_products_dataset.csv', usecols=['product_id','product_category_name']) | |
| orders = pd.read_csv('olist_orders_dataset.csv',usecols = ['order_id','customer_id']) | |
| prod = pd.read_csv('olist_order_items_dataset.csv',usecols = ['product_id','order_id']) | |
| customers = pd.read_csv('olist_customers_dataset.csv',usecols = ['customer_id','customer_zip_code_prefix','customer_city']) | |
| location = pd.read_csv('location_new.csv', usecols = ['customer_zip_code_prefix']) |
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 numpy as np | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| import re |
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
| # Load the dataset from keras datasets module | |
| from keras.datasets import cifar10 | |
| import matplotlib.pyplot as plt | |
| (train_X,train_Y),(test_X,test_Y)=cifar10.load_data() | |
| #Plot some images from the dataset to visualize the dataset | |
| n=6 | |
| plt.figure(figsize=(20,10)) | |
| for i in range(n): |
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 PolynomialFeatures | |
| from sklearn import linear_model | |
| train_x = np.asanyarray(train[['ENGINESIZE']]) | |
| train_y = np.asanyarray(train[['CO2EMISSIONS']]) | |
| test_x = np.asanyarray(test[['ENGINESIZE']]) | |
| test_y = np.asanyarray(test[['CO2EMISSIONS']]) | |
| poly = PolynomialFeatures(degree=2) |
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 import linear_model | |
| regr = linear_model.LinearRegression() | |
| x = np.asanyarray(train[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB']]) | |
| y = np.asanyarray(train[['CO2EMISSIONS']]) | |
| regr.fit (x, y) | |
| # The coefficients | |
| print ('Coefficients: ', regr.coef_) |
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 matplotlib.pyplot as plt | |
| import pandas as pd | |
| import pylab as pl | |
| import numpy as np | |
| %matplotlib inline | |
| df = pd.read_csv('Fuel.csv') | |
| # take a look at the dataset |
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
| #plot graph of feature importances for better visualization | |
| feat_importances = pd.Series(model.feature_importances_, index=X.columns) | |
| feat_importances.nlargest(10).plot(kind='barh') | |
| plt.show() |
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
| #Applying feature selection technique | |
| from sklearn.ensemble import ExtraTreesClassifier | |
| model = ExtraTreesClassifier() | |
| model.fit(X,y) | |
| print(model.feature_importances_) |
NewerOlder