Can someone please just run this on their system and post the screenshot so I can know it works. The .csv file and program are given below, please just run it and provide the screenshot. Also, I am using 3.6 Python in Pycharm. Thanks!
Bank_Predictions.csv
use a portion of the dataset Bank_Predictions which I have provided below (it is only 10 lines because the actual file has over 1000 lines so here is a small snippet);
Number | Customer_ID | Last_Name | Cr_Score | Location | Gender | Age | History | Current_Balance | Num_Of_Products | Has_CrCard | IsActiveMember | Customer_Salary | Acc_Closed |
1 | 15634602 | Hargrave | 619 | France | Female | 42 | 2 | 0 | 1 | 1 | 1 | 101348.9 | 1 |
2 | 15647311 | Hill | 608 | Spain | Female | 41 | 1 | 83807.86 | 1 | 0 | 1 | 112542.6 | 0 |
3 | 15619304 | Onio | 502 | France | Female | 42 | 8 | 159660.8 | 3 | 1 | 0 | 113931.6 | 1 |
4 | 15701354 | Boni | 699 | France | Female | 39 | 1 | 0 | 2 | 0 | 0 | 93826.63 | 0 |
5 | 15737888 | Mitchell | 850 | Spain | Female | 43 | 2 | 125510.8 | 1 | 1 | 1 | 79084.1 | 0 |
6 | 15574012 | Chu | 645 | Spain | Male | 44 | 8 | 113755.8 | 2 | 1 | 0 | 149756.7 | 1 |
7 | 15592531 | Bartlett | 822 | France | Male | 50 | 7 | 0 | 2 | 1 | 1 | 10062.8 | 0 |
8 | 15656148 | Obinna | 376 | Germany | Female | 29 | 4 | 115046.7 | 4 | 1 | 0 | 119346.9 | 1 |
9 | 15792365 | He | 501 | France | Male | 44 | 4 | 142051.1 | 2 | 0 | 1 | 74940.5 | 0 |
10 | 15592389 | Hanah | 684 | France | Male | 27 | 2 | 134603.9 | 1 | 1 | 1 | 71725.73 | 0 |
11 | 15767821 | Bearce | 528 | France | Male | 31 | 6 | 102016.7 | 2 |
PROGRAM: import numpy as np import matplotlib as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Bank_Predictions.csv') # Splitting the attributes into independent and dependent attributes X = dataset.iloc[:, :-1].values # attributes to determine dependent variable / Class Y = dataset.iloc[:, -1].values # dependent variable / Class # ------ Part-1: Data preprocessing ---------- # Encoding categorical data from sklearn.preprocessing import LabelEncoder, OneHotEncoder labelencoder_X = LabelEncoder() X[:, 0] = labelencoder_X.fit_transform(X[:, 0]) onehotencoder = OneHotEncoder(categorical_features=[0]) X = onehotencoder.fit_transform(X).toarray() labelencoder_Y = LabelEncoder() Y = labelencoder_Y.fit_transform(Y) # Splitting the dataset into the Training and Test sets from sklearn.model_selection import train_test_split X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=0) # Feature Scaling from sklearn.preprocessing import StandardScaler sc = StandardScaler() X_train = sc.fit_transform(X_train) X_test = sc.transform(X_test) # ------- Part-2: Build the ANN -------- # import keras library and packages import keras from keras.models import Sequential from keras.layers import Dense # Initializing the ANN classifier = Sequential() # Adding the input layer and the first hidden layer classifier.add(Dense(output_dim = 6, init = 'uniform', activation = 'relu', input_dim = 11)) # Adding second hidden layer classifier.add(Dense(output_dim = 6, init = 'uniform', activation = 'relu')) # Adding output layer classifier.add(Dense(output_dim = 1, init = 'uniform', activation = 'sigmoid')) # Compiling the ANN classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy']) # Fitting the ANN to the training set classifier.fit(X_train, Y_train, batch_size = 10, nb_epoch = 100) # Predicting the Test set results y_pred = classifier.predict(X_test) y_pred = (y_pred > 0.5) print(y_pred) # Making the confusion Matrix from sklearn.metrics import confusion_matrix cm = confusion_matrix(Y_test, y_pred) print(cm) accuracy = classifier.evaluate(X, Y) print(accuracy)
Answer) I have executed the code using python 3.6. The screen shot is below:
At the end of the last photo, you can see the confusion matrix and accuracy 0.875 that is 87%.
Can someone please just run this on their system and post the screenshot so I can...
You are to build trees with varying max tree depth for the dataset provided (use maximum tree depths 2-10). For each tree of a given maximum depth, record the accuracy, precision and recall. Plot each of these metrics as a line plot (tree depth on the x axis and % on the y axis). Below is what I have attempted. In [1]: import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier from sklearn.metrics...
This is my code: import numpy as np import pandas as pd import sys from keras.models import Sequential from keras.layers import Dense from sklearn.preprocessing import StandardScaler from keras.layers.normalization import BatchNormalization from keras.layers import Dropout file_full=pd.read_csv("/Users/anwer/Desktop/copy/FULL.csv") file_bottom=pd.read_csv("/Users/anwer/Desktop/copy/bottom.csv") train=[] train_targets=[] test=[] test_targets=[] p=[] q=[] # We will generate train data using 50% of full data and 50% of bottom data. #is train target for labeling ? yes for train data train_df = file_full[:len(file_full)//2] labels=[ 0 for i in range(len(file_full)//2)] train_df=train_df.append(file_bottom[:len(file_bottom)//2]) for...
Do I get the right answers? If not, can someone please explain? (a) 2 points possible (graded, results hidden) Consider a Gaussian linear model Y = aX + e in a Bayesian view. Consider the prior (a) = 1 for all a eR. Determine whether each of the following statements is true or false. (a) is a uniform prior. O True C False n(a) is a Jeffreys prior when we consider the likelihood L (Y = y|A = a, X...
Hi All, Can someone please help me correct the selection sort method in my program. the output for the first and last sorted integers are wrong compared with the bubble and merge sort. and for the radix i have no idea. See program below import java.io.*; import java.util.ArrayList; import java.util.Scanner; public class Sort { static ArrayList<Integer> Data1 = new ArrayList<Integer>(); static ArrayList<Integer> Data2 = new ArrayList<Integer>(); static ArrayList<Integer> Data3 = new ArrayList<Integer>(); static ArrayList<Integer> Data4 = new ArrayList<Integer>(); static int...
Please Solove only (a)and (b) Please, Write so that I can recognize 4.20 Consider the system depicted in Fig. P4.20(a). The of the input signal is depicted in Fig. P4.20(b). I FT FT z(t) Z(jw) and y(t) Z(ja) and Y(jo) for the following cases: -» Y(j»). Sket (a) w(t) cos(5 mt) and h(t) sin 6 (b) w(t) cos(5mt) and h(t) sin 5 (c) w(t) depicted in Fig. P4.20(c) and h(t) sin2r cos (5 rt X(jw) z(t) x)X hit) w(t) cos...
is there anyway you can modify the code so that when i run it i can see all the song when i click the select button all the songs in the songList.txt file can be shown song.java package proj2; public class Song { private String name; private String itemCode; private String description; private String artist; private String album; private String price; Song(String name, String itemCode, String description, String artist, String album, String price) { this.name = name; this.itemCode = itemCode;...
I want to have a code that can pick whichever two planets in the solar system and find the distance of them no matter where in their orbit they are, but I keep getting errors. Can someone please help me fix it? f rom scipy import exp, pi, absolute, linspace import matplotlib. Ryplot as plt planet-I input ('Which planet do you want to pick for planet 1?") planet_2 input ('which planet do you want to pick for planet 27') distance...
Please help me out by giving me detailed answers with formulas. So I can understand fully Thank you very much A study is conducted to examine the influence of ‘screen time’ on student performance on Statistics exams. A class of 12 students is observed over a period of time, with the independent variable being the average amount of time per day each student spends on TV/internet, and the dependent variable being their subsequent Statistics exam score, in %. The data...
Hi can you please show how you get the answers using the long way just so I can see how you worked it out even if you can label which properties you've used Thank you 1. (a) (i) A student claims that if p and q are odd integers then the evaluation of the expression (p 1)(g2 - 1) will always be a multiple of 8. Give 3 numerical examples you would 2 marks) 3 marks) use to check this...