This file contains 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 numpy as np | |
# sigmoid function | |
def nonlin(x,deriv=False): | |
if(deriv==True): | |
return x*(1-x) | |
return 1/(1+np.exp(-x)) | |
This file contains 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
# imputing missing values | |
train['Item_Visibility'] = train['Item_Visibility'].replace(0,np.mean(train['Item_Visibility'])) | |
train['Outlet_Establishment_Year'] = 2013 - train['Outlet_Establishment_Year'] | |
train['Outlet_Size'].fillna('Small',inplace=True) | |
# creating dummy variables to convert categorical into numeric values |
This file contains 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 csv import reader | |
import numpy as np | |
from random import seed | |
from sklearn.ensemble import BaggingClassifier, RandomForestClassifier | |
from sklearn.model_selection import cross_val_score | |
## Pre-processing functions | |
# Load a CSV file | |
def load_csv(filename): | |
dataset = list() |
This file contains 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 | |
train = pd.read_csv("C:\\Users\\Gaurav_Gola\\Desktop\\project\\black friday\\train.csv") | |
test = pd.read_csv("C:\\Users\\Gaurav_Gola\\Desktop\\project\\black friday\\test.csv") | |
train.shape |
This file contains 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 seaborn as sns | |
import numpy as np | |
import matplotlib.pylab as plt | |
# for plotting graphs in notebook | |
%pylab inline |
This file contains 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
train = read.csv("C:\\Users\\Gaurav_Gola\\Desktop\\project\\loan prediction\\train.csv",na.strings = c(""," ",NA)) | |
test = read.csv("C:\\Users\\Gaurav_Gola\\Desktop\\project\\loan prediction\\test.csv",na.strings = c(""," ",NA)) | |
library(mlr) | |
summarizeColumns(train) | |
summarizeColumns(test) | |
#Data visualization | |
# for Character |
This file contains 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
library(ggplot2) | |
library(readr) | |
HREmployeeAttritionwithDefinitions <- read.csv("C:\\Users\\Gaurav_Gola\\Desktop\\project\\HR\\HR.csv",header = TRUE) | |
hr_data = HREmployeeAttritionwithDefinitions | |
#hr_data = read_csv("C:/Users/Rajat/Documents/R/HREmployeeAttritionwithDefinitions.csv") | |
summary(hr_data) | |
summary(table(hr_data$EmployeeCount)) |
This file contains 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
# House prize prediction | |
train = read.csv("train.csv",stringsAsFactors = F) | |
test = read.csv("test.csv",stringsAsFactors = F) | |
#checking the levels of variables in test and train datasets , they should be equal | |
#checking character variables | |
This file contains 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 tensorflow as tf | |
import numpy as np | |
tf.reset_default_graph() | |
sess = tf.Session() | |
x_vals = np.random.normal(loc=0.0,scale=0.1,size=100) | |
x_vals.shape |
OlderNewer