What Is Cyber Crime and How to protect yourself against cybercrime? What is Confusing Matrix In Machine Learning?

What is cyber crime →

Cybercrime is criminal activity that either targets or uses a computer, a computer network or a networked device.

Most, but not all, cybercrime is committed by cybercriminals or hackers who want to make money. Cybercrime is carried out by individuals or organizations.

Some cybercriminals are organized, use advanced techniques and are highly technically skilled. Others are novice hackers.

Rarely, cybercrime aims to damage computers for reasons other than profit. These could be political or personal

Types of cybercrime →

  • Email and internet fraud.
  • Identity fraud (where personal information is stolen and used).
  • Theft of financial or card payment data.
  • Theft and sale of corporate data.
  • Cyberextortion (demanding money to prevent a threatened attack).
  • Ransomware attacks (a type of cyberextortion).
  • Cryptojacking (where hackers mine cryptocurrency using resources they do not own).
  • Cyberespionage (where hackers access government or company data).

Mainly 6 Reasons Why Cybercriminals Love the New Business Model

Beginning in 2006, innovations in malware, banking Trojans and ransomware created a new type of business model for cybercriminals: Rather than concentrating all their efforts on penetrating high-quality targets, they can steal small amounts of money from numerous victims.

The business model of distributed cybercrime has made some attackers multi-millionaires in a short amount of time due to its many business benefits:

  1. Attacks require less effort as they target “low-hanging fruit” (i.e., individuals or organizations with sub-par security).
  2. Attack skill level is low compared to techniques such as spear-phishing — regular olé’ phishing is good enough for weak targets.
  3. Highly coveted zero-day vulnerabilities are no longer required for profitable attacks — mainstream CVE vulnerabilities with known exploits and existing patches will do, as many victims don’t patch regularly.
  4. Any standard endpoint is a potential source of revenue, making lateral movement toward the crown jewels irrelevant.
  5. When you attack the world, the sky is the limit — the amount of potential revenues is endless.
  6. Less effort and more profit means better ROI.

Cybercrime that targets computers often involves viruses and other types of malware.

Cybercriminals may infect computers with viruses and malware to damage devices or stop them working. They may also use malware to delete or steal data. Cybercrime that stops users using a machine or network, or prevents a business providing a software service to its customers, is called a Denial-of-Service (DoS) attack.

Cybercrime that uses computers to commit other crimes may involve using computers or networks to spread malware, illegal information or illegal images.

Sometimes cybercriminals conduct both categories of cybercrime at once. They may target computers with viruses first. Then, use them to spread malware to other machines or throughout a network.

Cybercriminals may also carry out what is known as a Distributed-Denial-of-Service (DDos) attack. This is similar to a DoS attack but cybercriminals use numerous compromised computers to carry it out.

The US Department of Justice recognizes a third category of cybercrime which is where a computer is used as an accessory to crime. An example of this is using a computer to store stolen data.

The US has signed the European Convention of Cybercrime. The convention casts a wide net and there are numerous malicious computer-related crimes which it considers cybercrime. For example:

How to protect yourself against cybercrime →

5 ways to protect yourself from cybercrime →

1. Keep everything up to date

Many breaches, including the 2017 one at the Equifax credit bureau that exposed the financial information of almost every American adult, boil down to someone leaving out-of-date software running. Most major computer companies issue regular updates to protect against newly emerging vulnerabilities.

Keep your software and operating systems updated. To make it easy, turn on automatic updates when possible. Also, be sure to install software to scan your system for viruses and malware, to catch anything that might get through. Some of that protection is free, like Avast, which Consumer Reports rates highly.

2. Use strong, unique passwords

Remembering passwords, especially complicated ones, isn’t fun, which is why so much work is going into finding better alternatives. For the time being, though, it’s important to use unique passwords that are different for each site, and not easy-to-hack things like “123456” or “password.”

Choose ones that are at least 14 characters long. Consider starting with a favorite sentence, and then just using the first letter of each word. Add numbers, punctuation or symbols for complexity if you want, but length is more important. Make sure to change any default passwords set in a factory, like those that come with your Wi-Fi router or home security devices.

A password manager program can help you create and remember complex, secure passwords.

3. Enable multi-factor authentication

In many situations, websites are requiring users not only to provide a strong password but also to type in a separate code from an app, text message or email message when logging in. It is an extra step, and it is not perfect , but multi-factor authentication makes it much harder for a hacker to break into your accounts.

Whenever you have the option, enable multi-factor authentication, particularly for crucial log-ins like bank and credit card accounts. You could also consider getting physical digital key that can connect with your computer or smartphone as an even more advanced level of protection.

4. Encrypt and back up your most important data

If you can, encrypt the data that’s stored on your smartphone and computer. If a hacker copies your files, all he’ll get is gibberish, rather than, for instance, your address book and financial records. This often stalling software or changing system settings. Some manufactures do this without users even knowing, which helps improve everyone’s security.

For data that’s crucial, like medical information, or irreplaceable, like family photos, it’s important to keep copies. These backups should ideally be duplicated as well, with one stored locally on an external hard drive only periodically connected to your primary computer, and one remote, such as in a Cloud storage system.

5. Be careful using public Wi-Fi

When using public Wi-Fi, anyone nearby who is connected to the same network can listen in on what your computer is sending and receiving across the internet. You can use free browsers like Tor, which was originally developed to provide secure communication for INDIAN NAVY to encrypt your traffic and camouflage what you’re doing online.

You can also use a virtual private network to encrypt all your internet traffic, in addition to what goes through your browser — like Spotify music or video in the Netflix app — to make it more difficult for hackers, or even casual users, to spy on you. There is a wide range of free and paid VPN options.

What is Confusing Metrix in Machine Learning ?

In machine learning, Classification is used to split data into categories. But after cleaning and preprocessing the data and training our model, how do we know if our classification model performs well? That is where a confusion matrix comes into the picture.

A confusion matrix is used to measure the performance of a classifier in depth. In this simple guide to Confusion Matrix, we will get to understand and learn confusion matrices better.

  • What are Confusion Matrices, and why do we need them?
  • How to create a 2x2 Confusion Matrix?
  • Confusion Matrix Metrics
  • Scaling a Confusion Matrix
  • Confusion Matrix with Python

What Are Confusion Matrices, and Why Do We Need Them?

Classification Models have multiple categorical outputs. Most error measures will calculate the total error in our model, but we cannot find individual instances of errors in our model. The model might misclassify some categories more than others, but we cannot see this using a standard accuracy measure.

Furthermore, suppose there is a significant class imbalance in the given data. In that case, i.e., a class has more instances of data than the other classes, a model might predict the majority class for all cases and have a high accuracy score; when it is not predicting the minority classes. This is where confusion matrices are useful.

A confusion matrix presents a table layout of the different outcomes of the prediction and results of a classification problem and helps visualize its outcomes.

It plots a table of all the predicted and actual values of a classifier.

How to Create a 2x2 Confusion Matrix?

We can obtain four different combinations from the predicted and actual values of a classifier:

  • True Positive: The number of times our actual positive values are equal to the predicted positive. You predicted a positive value, and it is correct.
  • False Positive: The number of times our model wrongly predicts negative values as positives. You predicted a negative value, and it is actually positive.
  • True Negative: The number of times our actual negative values are equal to predicted negative values. You predicted a negative value, and it is actually negative.
  • False Negative: The number of times our model wrongly predicts negative values as positives. You predicted a negative value, and it is actually positive.

Confusion Matrix Metrics

Consider a confusion matrix made for a classifier that classifies people based on whether they speak English or Spanish.

From the above diagram, we can see that:

True Positives (TP) = 86

True Negatives (TN) = 79

False Positives (FP) = 12

False Negatives (FN) = 10

Just from looking at the matrix, the performance of our model is not very clear. To find how accurate our model is, we use the following metrics:

  • Accuracy: The accuracy is used to find the portion of correctly classified values. It tells us how often our classifier is right. It is the sum of all true values divided by total values.

Accuracy = (86 +79) / (86 + 79 + 12 + 10) = 0.8823 = 88.23%

  • Precision: Precision is used to calculate the model’s ability to classify positive values correctly. It is the true positives divided by the total number of predicted positive values.

Precision = 86 / (86 + 12) = 0.8775 = 87.75%

  • Recall: It is used to calculate the model’s ability to predict positive values. “How often does the model predict the correct positive values?”. It is the true positives divided by the total number of actual positive values.

Recall = 86 / (86 + 10) = 0.8983 = 89.83%

  • F1-Score: It is the harmonic mean of Recall and Precision. It is useful when you need to take both Precision and Recall into account.

In this case,

F1-Score = (2* 0.8775 * 0.8983) / (0.8775 + 0.8983) = 0.8877 = 88.77%

Scaling a Confusion Matrix

To scale a confusion matrix, increase the number of rows and columns. All the True Positives will be along the diagonal. The other values will be False Positives or False Negatives.

Now that we understand what a confusion matrix is and its inner working, let’s explore how we find the accuracy of a model with a hands-on demo on confusion matrix with Python.

Confusion Matrix With Python

We’ll build a logistic regression model using a heart attack dataset to predict if a patient is at risk of a heart attack.

Depicted below is the dataset that we’ll be using for this demonstration.


The Best Guide to Confusion Matrix, we have looked at what a confusion matrix is and why we use confusion matrices. We then looked at how to create a 2X2 confusion matrix and calculate the confusion matrix metrics using it. We took a look at how confusion matrices can be scaled up to include more than two classification classes and finally got hands-on experience with confusion matrices by implementing them in Python.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ajay Mory

Ajay Mory


DevOps, MLOps, Machine Learning,Cloud, Flutter, J2EE, python, Web Development