Skip to content

Instantly share code, notes, and snippets.

View Monicamundada's full-sized avatar
☺️

Monicamundada Monicamundada

☺️
  • CBS
  • denmark
View GitHub Profile
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()
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'])
@Monicamundada
Monicamundada / import.py
Created May 23, 2021 09:37
Importing packages
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
import re
# 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):
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)
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_)
@Monicamundada
Monicamundada / linear.py
Created October 30, 2020 23:18
Linear_regression
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
#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()
@Monicamundada
Monicamundada / extra-tree.py
Created October 5, 2020 19:24
feature-selection
#Applying feature selection technique
from sklearn.ensemble import ExtraTreesClassifier
model = ExtraTreesClassifier()
model.fit(X,y)
print(model.feature_importances_)