Question: write a function called task 1 ( data , filter _ value, type _ of _ card ) , wheredata contains all records from the
write a function called taskdata filtervalue, typeofcard wheredata contains all records from the dataset and filtervalue is an area name and typeofcard is the
name of the card provider. The function should return a list containing values from the following questions.
Return all results rounded to two decimal points.
Input:
cosdist, var, median, corr, pca taskdata 'Port Lincoln 'ANZ
output:
i cosdist: Calculate cosine distance between normal and malicious transactions based on
IPvalidityscore.
Formula:
Output:
printcosdist
ii var: Filter transactions based on certain geographical area eg Port Lincoln and calculate and display
the variance of transaction amount for a specific area. Note: use the Actual area column from the
dataset. Use sample variance formula for calculation.
Output:
printvar
iii. median: Filter data based on Typeofcard and then calculate the median of
Authenticationscore value for transactions that are in the lower th inclusive and upper
th inclusive percentile.
Output:
printmedian
iv corr: Filter malicious transactions where Actual and Origin places are different. Calculate
elementwise product between Authenticationscore and IPvalidationscore and then
perform correlation between the resultant vector and Amount column.
Output:
printcorr
v pca: Create a N x matrix where N is number of rows in the dataset and is the number of
columns, we will call these features Transactiontype, Entrymode, Amount,
Authenticationscore, and IPvalidityscorebefore that you need to convert all
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
