Trending March 2024 # A Beginner’s Guide To Building Your Own Pc # Suggested April 2024 # Top 7 Popular

You are reading the article A Beginner’s Guide To Building Your Own Pc updated in March 2024 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested April 2024 A Beginner’s Guide To Building Your Own Pc

Building your own PC from scratch gives you the freedom to choose the exact specifications you want, and it often saves money as well. However, the idea can be daunting. You have to source the components, stick them all together, troubleshoot problems, ensure everything works, and install an operating system—all of which requires a lot more work than just buying a computer.

Still, once you get started, the process isn’t all that difficult. With the right guidance, anyone can build a custom PC. So we collected everything you’ll need to know. Go ahead, put together your own computer piece by piece.

The building blocks of a computer

Before you start buying components, you need to decide which ones will work best for your needs. Any PC requires a case to hold everything, a motherboard to act as the nervous system of the new machine, a processor and RAM to slot into the motherboard, a power supply unit (PSU) to regulate electricity, a hard drive to store files, and a monitor to interact with your machine.

Choosing a case is as simple as deciding what you want your new PC to look like and how much stuff you want to cram in it. The latter feature will affect the potential size of your other components. For example, more powerful graphics cards need more room, and robust processors require more cooling space, so if you want a seriously fast machine for gaming or video editing, then go big. On the other hand, if you plan to just stream Netflix, you can get away with a smaller case (without a separate graphics card).

On to the motherboard. This part attaches to one of the case’s interior sides, and other pieces (such as the processor) slot into it. Because of that, you’ll need to pick this component’s size based on the case—most cases will list the types of motherboards they can accommodate. You’ll find that the configuration specification called Advanced Technology EXtended (ATX) is the most common choice, while Micro ATX acts as a popular smaller option.

The other consideration: What do you want to slot into the motherboard? Specific models will house specific central processing units (also called CPUs or processors). Because this is a key spec, every motherboard prominently displays the types of CPU it can accommodate. You do have some leeway—a motherboard will support a particular line or family, rather than just a single one. Once you plug your chosen CPU into the large square slot near the center of the motherboard, you’ll need to dissipate heat by slapping a heatsink or sometimes a cooling fan on top of that (the faster the processor, the bigger the cooling setup). Luckily, most CPUs come with standard heatsinks, so you should find everything you need in the box.

In addition to the CPU, you’ll have to plug in some random access memory (RAM), which gives the computer room to think and handles open applications. Plug in more RAM, and you can work on more files simultaneously, access applications more quickly, run games at higher resolutions, and keep more browser tabs open at once—all without slowing your computer to a crawl. Again, you’ll need to buy the right RAM for your chosen motherboard, but you don’t need to be as particular about this component as you were about the CPU. Just make sure your motherboard has enough RAM slots for your needs. Look for two or four long slots in the motherboard—the manual will tell you the precise location.

You can also give the motherboard a graphics card. As we’ve explained in our separate guide, this component is optional. Today’s CPUs come with what’s known as integrated graphics, enough to power your PC’s display. A separate card only proves its worth when you’re trying to put a lot of fast-moving pixels on your computer’s screen for top-end gaming or you have your machine make graphics-related calculations for video editing. It slots into one of the PCI Express slots on your motherboard, which are usually on the other side of the CPU socket.

A graphics card can improve your gaming, as well as image and video editing. Gigabyte

The most powerful graphics cards need an extra power connection to the power supply unit, which brings us back to the PSU. The key spec you should pay attention to here is the wattage, how much power it can provide to the system. Most PSUs on the market will cover a basic setup of CPU, RAM, and hard drive—but if you’re installing a separate graphics card or an extra hard drive, then you might need more. Cooler Master has a very useful PSU calculator you should use to work out the wattage you’ll need.

Speaking of the hard drive, you’ll need this long-term digital storage to hold your files and applications. The physical component sits in a separate cage inside the case. Then you connect it via cables to the motherboard (for data) and the PSU (for power). When you’re shopping, you can opt for an older hard disk drive (HDD), which gives you more capacity for a cheaper price, or a newer Solid State Drive (SSD), which is much faster but more expensive. You can also choose a hard drive with a greater or lesser storage capacity.

Your new PC will also need a monitor, so pick one based on the amount of screen space you want. Just be aware that the larger the monitor’s size, the more you’ll have to pay. Almost all of the products you’ll find on the market will use HDMI as the connection standard. This lets you plug the video output from your motherboard or graphics card into the monitor’s input.

One component we haven’t mentioned is a DVD or Blu-ray drive. By all means buy one if you think you’re going to use it. But if you do, make sure to purchase a case that has an optical disc drive bay. Once you do, the internal connections are the same as for the hard drive: one to the PSU for power, and one to the motherboard for transmitting data.

Shopping for components

There’s no exact formula for working out the components you’ll need, and there are almost an infinite number of combinations to choose, but don’t panic. As you start to browse around, you’ll soon get comfortable using the common terms and brand names.

You should start with your processor. In this case, you’ve got a choice between two brands: Intel (usually best for performance) and AMD (usually best for value-for-money). Intel offers several generations of i3, i5, and i7 processors, rising in power and price as you go up that list. The newest versions of these processors are the 8th-generation chips, but if you want to go for more affordable option and don’t mind a slight performance trade-off, look for older-generation CPUs still on sale. As for AMD, the second-generation Ryzen processors are the newest on the market, and like Intel, it has a rising scale of performance and price: Ryzen 3, 5, and 7. We don’t have room to give you a complete buying guide here, but benchmarking and comparison tools like CPU Benchmarks can help.

Broadly speaking, an Intel Core i5 processor (or the AMD equivalent, Ryzen 5) and 8GB of RAM will give you a decent mid-range machine. If you want to save money and don’t mind budget-level performance, then downgrade an Intel Core i3 chip and 4GB of RAM. For the fastest, most powerful machine, you’ll want to bump up to an Intel Core i7 chip and 16GB (or more) of RAM.

Picking hard drive storage is a little easier than sifting through the dozens of graphics cards on the market: 1TB is a good size for a capable PC. Get more if you’ll be installing a lot of games or working with a lot of 4K videos; get less if you’ll be mostly working on the web and storing a lot of your data in the cloud.

Once you’ve decided on CPU and RAM, these will guide your choice of motherboard and case. The PSU and hard drive are more independent because most models of these components will fit most motherboards. Still, you should double-check the specs sheet to make sure that they’ll function well together. If you can’t immediately figure out the compatibility, a quick web search or a chat with a customer service representative should help you.

NewEgg is one of the best-known PC component retailers. David Nield

After you double-check your choices, you’re ready to buy. Dedicated electronics retailers such as NewEgg, OutletPC, and Micro Center are good places to start your search. These sites are easy to navigate—computer parts are clearly categorized, so you can jump straight to the type of motherboard or RAM that you require. You’ll also find plenty of PC components on Amazon, but the retail giant doesn’t have the same variety that the dedicated retailers do.

Put together the build

You’ve picked your components, checked their compatibility, and ordered them. Now you’re ready to actually build your computer. You can easily do this within a couple hours—though you should avoid rushing the process if you’ve never put together your own PC before. And if you can enlist the help of a reasonably tech-savvy friend, all the better.

First, set up in a good environment. A hard, flat table is the perfect place for assembly. Avoid carpets, which are uneven and tend to generate static electricity that can damage the components.

Speaking of static electricity, before you touch any components, ground yourself by touching a metal part of the computer case, or by wearing an anti-static wrist strap. As for other tools, a lot of modern cases let you slot in components without them. Still, we’d recommend keeping a Phillips screwdriver on hand, just in case. That’s just about the only equipment you’ll need.

The PC parts you buy should ship with just about everything you need—for example, the PSU will come with its own power cable. Handle all of these components carefully by the edges. When you’re not using them, place them on top of the anti-static bags they came in.

Now you’re ready for assembly. First, fit the PSU into the case, then screw in the motherboard. Next, add the CPU, RAM, hard drive, and graphics card (if you’ve bought one).

Unsure about where to put everything? The instructions supplied with the motherboard and other components should tell you. If they’re confusing or incomplete, an online search should help—make sure your search terms include the exact model names and numbers of your components, or you won’t get the right results.

An Intel CPU inside a motherboard socket. Alexandru-Bogdan Ghita via Unsplash

The processor has perhaps the most involved installation process, but it should also come with step-by-step instructions to help. When you drop it into the motherboard slot, you should see some form of clip or bracket you can use to fix it in place. Apply a thin layer of thermal paste, if it doesn’t come pre-applied on the cooler, then fix the heatsink and cooling fan on top. These typically screw straight into the motherboard.

Once you’ve installed all these pieces, the last hardware requirement is to connect the power cable and actually switch on the machine. You do this via a button on the PSU or the case. When you hit it, you should hear the reassuring sounds of the motherboard and storage drive starting up…that is, if you’ve connected everything successfully. If not, don’t panic. Switch the power back off, double-check all the connections and slots, and then try again.

Troubleshooting problems is a whole new article in itself, but one way to work out what’s going on is if the motherboard emits a beep or two. To translate those noises, Computer Hope offers a comprehensive beep code list. In fact, your motherboard’s manual might include its own decoder. For example, on a Dell machine, two beeps indicates that the motherboard can’t detect any installed RAM. If the motherboard doesn’t offer any tell-tale noises, you’ll have to go methodically through each component, one by one, making sure they’re all correctly seated and connected. Are data and power cables hooked up to the hard drive? Is the CPU heatsink firmly attached on top of the processor? The connections must be solid for the system to work.

Install the operating system

When the hardware warms up, your computer will need an operating system, either Windows or Linux. The best option is to use a different computer to set up a USB drive that holds the necessary installation files. Microsoft has instructions for doing this with Windows, and you can follow these instructions to do the same thing for Ubuntu Linux.

Although Linux is free, Windows 10 isn’t: You’ll need to pay $139 for the direct download, and then you can transfer it to your new PC via USB.

To get your new machine to recognize the USB stick and the software on it, you may need to adjust the way the hardware boots up. Watch the screen for a message about entering the BIOS, which stands for Basic Input/Output System. This is the software on the motherboard, which handles communications between all the different parts of the computer. The motherboard user manual should come with a shortcut key to help you get into the BIOS. You should see a boot order option somewhere, where you can tell the BIOS to load from the USB drive rather than the hard drive or the optical drive. While you’re here, you can check that the motherboard is correctly recognizing the drives, RAM, processor, and all the other components.

After you install your operating system, you should be ready to go! The whole process may take some time, but it’s also a lot of fun. And in the end, you’ll have a PC tailored to your exact specifications.

You're reading A Beginner’s Guide To Building Your Own Pc

A Guide To Building An End

This article was published as a part of the Data Science Blogathon.

Knock! Knock!

Who’s there?

It’s Natural Language Processing!

Today we will implement a multi-class text classification model on an open-source dataset and explore more about the steps and procedure. Let’s begin.

Table of Contents


Loading the data

Feature Engineering

Text processing

Exploring Multi-classification Models

Compare Model performance



Dataset for Text Classification

The dataset consists of real-world complaints received from the customers regarding financial products and services. The complaints are labeled to a specific product. Hence, we can conclude that this is a supervised problem statement, where we have the input and the target output for that. We will play with different machine learning algorithms and check which algorithm works better.

Our aim is to classify the complaints of the consumer into predefined categories using a suitable classification algorithm. For now, we will be using the following classification algorithms.

Linear Support Vector Machine (LinearSVM)

Random Forest

Multinomial Naive Bayes

Logistic Regression.

Loading the Data

Download the dataset from the link given in the above section. Since I am using Google Colab, if you want to use the same you can use the Google drive link given here and import the dataset from your google drive. The below code will mount the drive and unzip the data to the current working directory in colab.

from google.colab import drive drive.mount('/content/drive') !unzip /content/drive/MyDrive/

First, we will install the required modules.

Pip install numpy

Pip install pandas

Pip install seaborn

Pip install scikit-learn

Pip install scipy

Ones everything successfully installed, we will import required libraries.

import os import pandas as pd import numpy as np from scipy.stats import randint import seaborn as sns # used for plot interactive graph. import matplotlib.pyplot as plt import seaborn as sns from io import StringIO from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_selection import chi2 from IPython.display import display from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfTransformer from sklearn.naive_bayes import MultinomialNB from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from chúng tôi import LinearSVC from sklearn.model_selection import cross_val_score from sklearn.metrics import confusion_matrix from sklearn import metrics

Now after this let us load the dataset and see the shape of the loaded dataset.

# loading data df = pd.read_csv('/content/rows.csv') print(df.shape)

From the output of the above code, we can say that the dataset is very huge and it has 18 columns. Let us see how the data looks like. Execute the below code.


Now, for our multi-class text classification task, we will be using only two of these columns out of 18, that is the column with the name ‘Product’ and the column ‘Consumer complaint narrative’. Now let us create a new DataFrame to store only these two columns and since we have enough rows, we will remove all the missing (NaN) values. To make it easier to understand we will rename the second column of the new DataFrame as ‘consumer_complaints’.

# Create a new dataframe with two columns df1 = df[['Product', 'Consumer complaint narrative']].copy() # Remove missing values (NaN) df1 = df1[pd.notnull(df1['Consumer complaint narrative'])] # Renaming second column for a simpler name df1.columns = ['Product', 'Consumer_complaint'] print(df1.shape) df1.head(3).T

We can see that after discarding all the missing values, we have around 383k rows and 2 columns, this will be our data for training. Now let us check how many unique products are there.


There are 18 categories in products. To make the training process easier, we will do some changes in the names of the category.

# Because the computation is time consuming (in terms of CPU), the data was sampled df2 = df1.sample(10000, random_state=1).copy() # Renaming categories df2.replace({'Product': {'Credit reporting, credit repair services, or other personal consumer reports': 'Credit reporting, repair, or other', 'Credit reporting': 'Credit reporting, repair, or other', 'Credit card': 'Credit card or prepaid card', 'Prepaid card': 'Credit card or prepaid card', 'Payday loan': 'Payday loan, title loan, or personal loan', 'Money transfer': 'Money transfer, virtual currency, or money service', 'Virtual currency': 'Money transfer, virtual currency, or money service'}}, inplace= True) pd.DataFrame(df2.Product.unique())

The 18 categories are now reduced to 13, we have combined ‘Credit Card’ and ‘Prepaid card’ to a single class and so on.

Now, we will map each of these categories to a number, so that our model can understand it in a better way and we will save this in a new column named ‘category_id’. Where each of the 12 categories is represented in numerical.

# Create a new column 'category_id' with encoded categories df2['category_id'] = df2['Product'].factorize()[0] category_id_df = df2[['Product', 'category_id']].drop_duplicates() # Dictionaries for future use category_to_id = dict(category_id_df.values) id_to_category = dict(category_id_df[['category_id', 'Product']].values) # New dataframe df2.head()

Let us visualize the data, and see how many numbers of complaints are there per category. We will use Bar chart here.

fig = plt.figure(figsize=(8,6)) colors = ['grey','grey','grey','grey','grey','grey','grey','grey','grey', 'grey','darkblue','darkblue','darkblue'] df2.groupby('Product').Consumer_complaint.count().sort_values().plot.barh( ylim=0, color=colors, title= 'NUMBER OF COMPLAINTS IN EACH PRODUCT CATEGORYn') plt.xlabel('Number of ocurrences', fontsize = 10);

Above graph shows that most of the customers complained regarding:

Credit reporting, repair, or other

Debt collection


Text processing

The text needs to be preprocessed so that we can feed it to the classification algorithm. Here we will transform the texts into vectors using Term Frequency-Inverse Document Frequency (TFIDF) and evaluate how important a particular word is in the collection of words. For this we need to remove punctuations and do lower casing, then the word importance is determined in terms of frequency.

We will be using TfidfVectorizer function with the below parameters:

min_df: remove the words which has occurred in less than ‘min_df’ number of files.

Sublinear_tf: if True, then scale the frequency in logarithmic scale.

Stop_words: it removes stop words which are predefined in ‘english’.

tfidf = TfidfVectorizer(sublinear_tf=True, min_df=5, ngram_range=(1, 2), stop_words='english') # We transform each complaint into a vector features = tfidf.fit_transform(df2.Consumer_complaint).toarray() labels = df2.category_id print("Each of the %d complaints is represented by %d features (TF-IDF score of unigrams and bigrams)" %(features.shape))

Now, we will find the most correlated terms with each of the defined product categories. Here we are finding only three most correlated terms.

# Finding the three most correlated terms with each of the product categories N = 3 for Product, category_id in sorted(category_to_id.items()): features_chi2 = chi2(features, labels == category_id) indices = np.argsort(features_chi2[0]) feature_names = np.array(tfidf.get_feature_names())[indices] unigrams = [v for v in feature_names if len(v.split(' ')) == 1] bigrams = [v for v in feature_names if len(v.split(' ')) == 2] print(" * Most Correlated Unigrams are: %s" %(', '.join(unigrams[-N:]))) print(" * Most Correlated Bigrams are: %s" %(', '.join(bigrams[-N:])))

* Most Correlated Unigrams are: overdraft, bank, scottrade * Most Correlated Bigrams are: citigold checking, debit card, checking account * Most Correlated Unigrams are: checking, branch, overdraft * Most Correlated Bigrams are: 00 bonus, overdraft fees, checking account * Most Correlated Unigrams are: dealership, vehicle, car * Most Correlated Bigrams are: car loan, vehicle loan, regional acceptance * Most Correlated Unigrams are: express, citi, card * Most Correlated Bigrams are: balance transfer, american express, credit card * Most Correlated Unigrams are: report, experian, equifax * Most Correlated Bigrams are: credit file, equifax xxxx, credit report * Most Correlated Unigrams are: collect, collection, debt * Most Correlated Bigrams are: debt collector, collect debt, collection agency * Most Correlated Unigrams are: ethereum, bitcoin, coinbase * Most Correlated Bigrams are: account coinbase, coinbase xxxx, coinbase account * Most Correlated Unigrams are: paypal, moneygram, gram * Most Correlated Bigrams are: sending money, western union, money gram * Most Correlated Unigrams are: escrow, modification, mortgage * Most Correlated Bigrams are: short sale, mortgage company, loan modification * Most Correlated Unigrams are: meetings, productive, vast * Most Correlated Bigrams are: insurance check, check payable, face face * Most Correlated Unigrams are: astra, ace, payday * Most Correlated Bigrams are: 00 loan, applied payday, payday loan * Most Correlated Unigrams are: student, loans, navient * Most Correlated Bigrams are: income based, student loan, student loans * Most Correlated Unigrams are: honda, car, vehicle * Most Correlated Bigrams are: used vehicle, total loss, honda financial

Exploring Multi-classification Models

The classification models which we are using:

Random Forest

Linear Support Vector Machine

Multinomial Naive Bayes

Logistic Regression.

For more information regarding each model, you can refer to their official guide.

Now, we will split the data into train and test sets. We will use 75% of the data for training and the rest for testing. Column ‘consumer_complaint’ will be our X or the input and the product is out Y or the output.

X = df2['Consumer_complaint'] # Collection of documents y = df2['Product'] # Target or the labels we want to predict (i.e., the 13 different complaints of products) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state = 0)

We will keep all the using models in a list and loop through the list for each model to get a mean accuracy and standard deviation so that we can calculate and compare the performance for each of these models. Then we can decide with which model we can move further.

models = [ RandomForestClassifier(n_estimators=100, max_depth=5, random_state=0), LinearSVC(), MultinomialNB(), LogisticRegression(random_state=0), ] # 5 Cross-validation CV = 5 cv_df = pd.DataFrame(index=range(CV * len(models))) entries = [] for model in models: model_name = model.__class__.__name__ accuracies = cross_val_score(model, features, labels, scoring='accuracy', cv=CV) for fold_idx, accuracy in enumerate(accuracies): entries.append((model_name, fold_idx, accuracy)) cv_df = pd.DataFrame(entries, columns=['model_name', 'fold_idx', 'accuracy'])

The above code will take sometime to complete its execution.

Compare Text Classification Model performance

Here, we will compare the ‘Mean Accuracy’ and ‘Standard Deviation’ for each of the four classification algorithms.

mean_accuracy = cv_df.groupby('model_name').accuracy.mean() std_accuracy = cv_df.groupby('model_name').accuracy.std() acc = pd.concat([mean_accuracy, std_accuracy], axis= 1, ignore_index=True) acc.columns = ['Mean Accuracy', 'Standard deviation'] acc

From the above table, we can clearly say that ‘Linear Support Vector Machine’ outperforms all the other classification algorithms. So, we will use LinearSVC to train model multi-class text classification tasks.

plt.figure(figsize=(8,5)) sns.boxplot(x='model_name', y='accuracy', data=cv_df, color='lightblue', showmeans=True) plt.title("MEAN ACCURACY (cv = 5)n", size=14);

Evaluation of Text Classification Model

Now, let us train our model using ‘Linear Support Vector Machine’, so that we can evaluate and check it performance on unseen data.

X_train, X_test, y_train, y_test,indices_train,indices_test = train_test_split(features, labels, df2.index, test_size=0.25, random_state=1) model = LinearSVC(), y_train) y_pred = model.predict(X_test)

We will generate claasifiaction report, to get more insights on model performance.

# Classification report print('ttttCLASSIFICATIION METRICSn') print(metrics.classification_report(y_test, y_pred, target_names= df2['Product'].unique()))

From the above classification report, we can observe that the classes which have a greater number of occurrences tend to have a good f1-score compared to other classes. The categories which yield better classification results are ‘Student loan’, ‘Mortgage’ and ‘Credit reporting, repair, or other’. The classes like ‘Debt collection’ and ‘credit card or prepaid card’ can also give good results. Now let us plot the confusion matrix to check the miss classified predictions.

conf_mat = confusion_matrix(y_test, y_pred) fig, ax = plt.subplots(figsize=(8,8)) sns.heatmap(conf_mat, annot=True, cmap="Blues", fmt='d', xticklabels=category_id_df.Product.values, yticklabels=category_id_df.Product.values) plt.ylabel('Actual') plt.xlabel('Predicted') plt.title("CONFUSION MATRIX - LinearSVCn", size=16);

From the above confusion matrix, we can say that the model is doing a pretty decent job. It has classified most of the categories accurately.


Let us make some prediction on the unseen data and check the model performance.

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state = 0) tfidf = TfidfVectorizer(sublinear_tf=True, min_df=5, ngram_range=(1, 2), stop_words='english') fitted_vectorizer = tfidf_vectorizer_vectors = fitted_vectorizer.transform(X_train) model = LinearSVC().fit(tfidf_vectorizer_vectors, y_train)

Now run the prediction.

complaint = """I have received over 27 emails from XXXX XXXX who is a representative from Midland Funding LLC. From XX/XX/XXXX I received approximately 6 emails. From XX/XX/XXXX I received approximately 6 emails. From XX/XX/XXXX I received approximately 9 emails. From XX/XX/XXXX I received approximately 6 emails. All emails came from the same individual, XXXX XXXX. It is becoming a nonstop issue of harassment.""" print(model.predict(fitted_vectorizer.transform([complaint]))) complaint = """Respected Sir/ Madam, I am exploring the possibilities for financing my daughter 's XXXX education with private loan from bank. I am in the XXXX on XXXX visa. My daughter is on XXXX dependent visa. As a result, she is considered as international student. I am waiting in the Green Card ( Permanent Residency ) line for last several years. I checked with Discover, XXXX XXXX websites. While they allow international students to apply for loan, they need cosigners who are either US citizens or Permanent Residents. I feel that this is unfair. I had been given mortgage and car loans in the past which I closed successfully. I have good financial history. print(model.predict(fitted_vectorizer.transform([complaint]))) complaint = """They make me look like if I was behind on my Mortgage on the month of XX/XX/2024 & XX/XX/XXXX when I was not and never was, when I was even giving extra money to the Principal. The Money Source Web site and the managers started a problem, when my wife was trying to increase the payment, so more money went to the Principal and two payments came out that month and because I reverse one of them thru my Bank as Fraud they took revenge and committed slander against me by reporting me late at the Credit Bureaus, for 45 and 60 days, when it was not thru. Told them to correct that and the accounting department or the company revert that letter from going to the Credit Bureaus to correct their injustice. The manager by the name XXXX requested this for the second time and nothing yet. I am a Senior of XXXX years old and a Retired XXXX Veteran and is a disgraced that Americans treat us that way and do not want to admit their injustice and lies to the Credit Bureau.""" print(model.predict(fitted_vectorizer.transform([complaint])))

The model is not perfect, yet it is performing very good.

The notebook is available here.


We have implemented a basic multi-class text classification model, you can play with other models like Xgboost, or you can try to compare multiple model performance on this dataset using a machine learning framework called AutoML. This is not yet, still there are complex problems associated within the multi-class text classification tasks, you can always explore more and acquire new concepts and ideas about this topic. That’s It!!

Thank you!

All images are created by the author.

My LinkedIn

The media shown in this article is not owned by Analytics Vidhya and are used at the Author’s discretion


Beginner’s Guide To Become A Web3 Developer

Beginner’s guide to becoming a web3 developer: A primer on backend and the frontend web3 development

Web3 development has several components. As with Web2, the primary components are the front-end and back-end. Furthermore, because smart contracts are an important component of dApps, they merit their own category. Of course, there is the establishment and growth of new programmable blockchains.

This involves understanding which tools to use and which languages to acquire for Web3 development. Furthermore, you should concentrate on providing tangible results that you can demonstrate to your colleagues, prospective clients, or investors. As a result, you must discover how to build an excellent dApp UI, an interface that is clearly critical. On the other hand, you can’t implement good functionalities without a suitable backend and smart contracts.

Blockchain Fundamentals: Blockchain is the first concept you must grasp in order to become a web3 coder. This will allow you to quickly design and optimize smart contracts. Let’s go over what blockchain is and how it functions.

Blockchains are installed on computers called nodes all over the globe. As a result, you’ll need to reach the majority of computers and repeat the procedure. It’s nearly impossible for a machine to do all of this quickly enough for the network to detect and kick the fraudster off the blockchain.

Decentralized Applications: DApps, or Decentralized Applications, are blockchain-based applications.

Frontend: JavaScript frameworks like React, Vue, Angular

Backend: Rust and Solana or Solidity and Ethereum

Frontend Site Programming Fundamentals: The backbone of DApps may be powered by blockchain technology, but the interface is written in chúng tôi — Common HTML tags.

The front end is written in JavaScript

CSS — Basic Properties, Flex, Grid

CSS Frameworks [Optional] — Bootstrap, Semantic UI, Tailwind, etc

JavaScript — Variables, Functions, Classes, ES6, etc.

JavaScript Frameworks

Backend web2, as a backup in case web3 fails. Here is what you should know about the backend:

NodeJS — Event loop, I/O

API Architecture — Express

 Databases — MongoDB, SQL, PostgreSQL

Ethereum Fundamentals: Ethereum is a network that is used to execute smart contracts. In 2023, Ethereum will be by far the most common blockchain for making smart contracts. Solidity is the language used to create smart contracts.

smart contracts: Smart contracts are arrangements that are executed by immutable code on the network. Smart contracts are comparable to JS classes. DApps are powered by these. Solidity is a high-level, object-oriented computer language designed especially for creating smart contracts. Because solidity is so novel, there are few tools for learning it. The best method to learn is to create projects and solve issues by consulting documentation. Consider some resources that follow a comparable strategy.

Build space: Build space is a cohort-based learning tool that is an excellent resource for studying Web3. Solana, Polygon, and Ethereum can be used to create DApps, NFT collections, NFT web games, DAOs, and much more.

LearnWeb3DAO: Web3 DAO is yet another fantastic Web3 utility. It has four distinct tracks for developers of varying ability levels: Freshman, Sophomore, Junior, and Senior. You will learn how to create DApps, NFT collections, ICO coins, DAOs, DeFi networks, and many other things.

Crypto Zombies: CrytoZombies is a gamified programming training in which you use smart contracts to construct an undead factory.

Nader Dabit: Nader Dabit about

1. React





Connect Your Smart Contract with Your Frontend: Now that you understand how to create smart contracts, you must put them to use. There are two primary tools for doing this: chúng tôi and chúng tôi Let’s look at why chúng tôi is superior to web3.

Much smaller size

Less buggy

Better documentation

More Popular

Easier for beginners

Extra Features

Alchemy: Alchemy is a set of developer tools for prototyping, debugging, and shipping products more quickly. Alchemy uses a variety of networks, including Ethereum, Polygon, Stark net, Flow, and others. It has an excellent NFT API that enables you to quickly get your NFT collection up and going. It also has a supercharged cryptocurrency API and supports web 3.0 push alerts.

Remix: Remix is a browser-based Editor designed especially for creating Ethereum smart contracts with Solidity. There is no need for preparation; you can begin writing code right away. It generates your code and allows you to quickly test it. Not only that but your smart contract can be simply deployed.

Hardhat: Hardhat makes it simple to publish contracts, perform tests, and debug Solidity code. You can launch your contract on a variety of networks, including Ropsten, Rinkeby, and Mainnet. Yes, and it supports TypeScript as well.

Truffle: Truffle is my preferred smart contract creation tool. It allows you to quickly build and use smart contracts in your front-end code. Ganache also includes Truffle, which mimics a blockchain and adds test accounts, among other things. It’s extremely beneficial to prevent jargon.

How To Use Kodi – A Beginner’s Guide

Kodi is a popular media server application that can not only help you manage your offline media library but also stream online content. What’s surprising to me is that despite being so useful, apart from its dedicated core users, no one seems to know what it does. I mean people who use Kodi sing paeans about it and those who don’t use it know nothing about it. We want to change that perception with this article. Kodi is a free and open-source tool that can organize local media files into a single, cohesive interface. Among many things, Kodi has a powerful media player that can stream a wide range of media formats. And in this article, we are going to tell you everything about it and help you get started with this awesome app.

A Definitive Guide to Kodi (Updated July 2023)

Before we move to the article, I want to outline all the topics that I have covered in this explainer. You can easily move back and forth from the links below.

What Exactly is Kodi?

About 10 years back when internet speed was abysmal and online streaming platforms were close to naught, there was a culture of owning physical copies of movies, music, etc. Users preferred to download media content over the internet instead of streaming it because the internet speed sucked.

This meant that they had to maintain a large media collection and organizing and maintaining large libraries of media content like movies, music or images in separate directories was a tiresome exercise.

You had to run through hoops to find the content you wanted to play. Sometimes, the native media player wouldn’t even play it because it didn’t support the media format. Kodi came as a solution to all these problems. It streamlined every single thing and brought the entire media-consumption experience under one roof.

You could just open Kodi and all your local media files were right there, ready to be played in a sleek and accessible interface.  So, Kodi basically is a media server application which can not only help you organize and manage your media but also access and play it from any device on your home network.

The State of Kodi in 2023

Kodi has become a powerful media center app. Kodi has gone through many iterations of development and by now, it has amassed many useful features including the ability to stream content, support for different add-ons and repositories, themes support, and more.

Of course, you can still connect your local media library to Kodi and it will organize everything with proper categorization, album art, metadata, synopsis, etc. Further, you can enable subtitles, track your movie, and show progress with Trakt, record Live TV, and much more.

Kodi is an open-source app with huge community support. It’s available on all major platforms including Windows, macOS, Android, Linux, iOS, and host of other devices. There is so much more about Kodi that I can’t fit it in a single paragraph here.

Anyway, if you want to use Kodi then you will have to start with the installation first and that is where we will begin.

Install Kodi

How to Use Kodi

Now that you have gone through Kodi’s installation process, let us proceed with some basic level stuff on how to use Kodi. In this section, I will start with the interface and then go deep into settings and add-ons to explain Kodi’s useful features.

Understanding the Kodi User Interface

To use Kodi, you will have to understand its user interface first. Thankfully, the default Kodi interface is pretty basic and clean. The latest Kodi version is 18.2 (codenamed Leia) and the below screenshots are grabbed from the same version. You have multiple menus on the left side which are categorized based on the type of content.

There is a search button on the top which lets you search your local content, add-ons, and directly into streaming services like YouTube.

The power button on the left side lets you exit Kodi, reboot and offers other similar functions.

To make your Kodi home screen visually pleasing, you can add weather information or you can use different Kodi skins which basically overhaul Kodi’s UI.

Plunging into the World of Kodi Add-ons

Kodi has something called Kodi Add-ons which are basically apps built for Kodi. They are very similar to Android or iOS apps which can be installed on top of Kodi to bring extra functionality, content, and features. Just like App Store or Play Store, Kodi has an in-built, official repository that hosts thousands of add-ons.

There are also third-party add-ons that are massively popular among the Kodi community. If you want to install third-party Kodi add-ons, you can check our list of latest Kodi add-ons. Further, if you want add-ons specifically to stream movies, you can check our recommended movie add-ons here.

If you are not satisfied with the official repo, you can also install third-party repositories as well. You can check our list of best third-party repository available for Kodi. The linked article also mentions the steps to install a repository so you don’t have to worry about that.

Warning: Some of the websites hosting the Kodi addons contain tracking pixels. If you don’t want to give away your personal information like IP address, you should use VPNs. Remember to check out our article on the best free VPNs for the same.

How to Install Addons on Kodi

3. Upon selecting the repository, choose “All repositories” and then move to “Video add-ons“ if you want to watch movies and TV shows. You can also go through other categories.

4. Here, you will find all the video add-ons available on Kodi’s server.

How to Use Kodi Addons to Watch Movies, Shows, Live TV, and More

You just need to follow the steps that we have mentioned above on how to install video addons. From there, you can find many addons for watching movies, TV shows, streaming live TV and more. That said, my personal recommendation would be the Exodus addon as it’s a complete package and brings all kinds of content, be it movies, TV shows, or live TV channels.

You can follow our guide and learn how to install Exodus on Kodi. Apart from that, if you want more Kodi addons for video content then you can head over to our dedicated list of best Kodi addons. Here, you can find top Kodi addons for anime, cartoons, music, sports, and much more.

What is Kodi Build?

Unlike the default Kodi which is just barebone, Kodi Build is a total package. After you install a Build, you will not have to individually look for addons or other tools. Everything is there for your need. Some of the popular Kodi Builds are Xanax and Titanium, but my favorite remains Xanax for its amazing UI and library of content. You can find more information from our list of the best Kodi Builds.

How to Use a Kodi Build?

1. First off, you need to download the ZIP file of your favorite Kodi Build.

6. Now you will be offered multiple versions of the build. Choose the latest one and proceed ahead.

9. After the installation is complete, force-close Kodi to make the core changes.

How to Add Addons to a Build?

The process to install an addon on a Build is pretty similar to the one on the default Kodi setup. You just have to move to the “Add-on” tab and from there, you can either choose the ZIP file or download the addon from an online source. Despite being on a third-party build, you will still have access to official Kodi addons so that is great.

Keep in mind, every Kodi Build has a different user interface so the location of menus may change from one skin to another. That said, you will always find the option to install addons under the “Add-ons” tab.

Going Deep into Settings


While I have mentioned the major features of Kodi, there are still a few useful hacks you should know about. Talking about usefulness, keyboard shortcuts make things a hell lot easier on Kodi.

Beginner’s Guide To Sed


The general command for sed is something like:










Sed will perform the operations that you want him to do on the text file and display the result in the standard output. If you want the result in a text file, you can either redirect it via the habitual method:











Now let’s begin working on the script. The most obvious first step is the null script:



chúng tôi just display the text in test.txt.

A good usage of sed is deletion. Let’s practice through examples.


'2,4 d'

chúng tôi delete the lines 2 to 4 of test.txt.

You can guess that the syntax for the script is:


'[first line to delete] [last line to delete] d'

chúng tôi the fancy part comes when you use regular expressions, or regex, as delimiter for the deletion. For example,

The general syntax is


'/regex/ d'

chúng tôi deleting the line containing the regex.


'/regex1/,/regex2/ d'

chúng tôi deleting the interval from the line containing regex1 to the line containing regex2.

The special character “^” that I used in the first example is to indicate the beginning of the line.

Then, the second basic usage that I can think of is substitution. The general syntax is:

A good example is:


If you want to delete the empty lines of a file, you can use the command



'/^$/ {N; D}'

chúng tôi meta-character “$” means the end of the line, so “^$” designs an empty line. Then, “{N;D}” is a rather complex syntax for saying delete that line.

If you want to delete every tag in a html file, this is the command for you:


You are now ready to study more deeply sed, or just use it for simple modifications. It is a command that I find particularly useful in scripts in general, but it took me some time to understand its syntax. I hope it will be much faster for you.


Adrien is a young but passionate Linux aficionado. Command line, encryption, obscure distributions... you name it, he tried it. Always improving his system, he encountered multiple tricks and hacks and is ready to share them. Best things in the world? Math, computers and peanut butter!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.

By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.

A Beginner’s Guide To Focal Loss In Object Detection!


Object detection is one of the most widely studied topics in the computer vision community. It’s has been breaking into various industries with use cases from image security, surveillance, automated vehicle systems to machine inspection.

Currently, deep learning-based object detection can be majorly classified into two groups:-

Two-stage detectors, such as Region-based CNN (R-CNN) and its successors.

and, One-stage detectors, such as the YOLO family of detectors and SSD

One-stage detectors that are applied over a regular, dense sampling of anchor boxes (possible object locations) have the potential to be faster and simpler but have trailed the accuracy of two-stage detectors because of extreme class imbalance encountered during training.

FAIR has released a paper in 2023, in which they introduced the concept of Focal loss to handle this class imbalance problem with their one stage detector called RetinaNet.

Before we deep dive into the nitty-gritty of Focal loss, let’s First, understand what is this class imbalance problem and the possible problems caused by it.

Why Focal Loss Needed

What is Focal Loss

Cross-Entropy Loss

Problem with Cross-Entropy


Balanced Cross-Entropy

Problem with Balanced Cross-Entropy


Focal loss explanation


Cross-Entropy vs Focal Loss

Easily correctly classified records

Misclassified records

Very easily classified records

Final Thoughts

Why Focal Loss Needed?

This imbalance causes two problems –

Training is inefficient as most locations are easy negatives (meaning that they can be easily classified by the detector as background) that contribute no useful learning.

Since easy negatives (detections with high probabilities) account for a large portion of inputs. Although they result in small loss values individually but collectively, they can overwhelm the loss & computed gradients and can lead to degenerated models.

What is Focal Loss?

In simple words, Focal Loss (FL) is an improved version of Cross-Entropy Loss (CE)  that tries to handle the class imbalance problem by assigning more weights to hard or easily misclassified examples  (i.e. background with noisy texture or partial object or the object of our interest ) and to down-weight easy examples (i.e. Background objects).

So Focal Loss reduces the loss contribution from easy examples and increases the importance of correcting misclassified examples.)

So, let’s first understand what Cross-Entropy loss for binary classification.

The idea behind Cross-Entropy loss is to penalize the wrong predictions more than to reward the right predictions.

Cross entropy loss for binary classification is written as follows-

Where –

Yact = Actual Value of Y

Ypred =  Predicted Value of Y

For Notational convenience, let’s write Ypred  as p & Yact as Y.

Y ∈ {0,1}, It’s the ground truth class

p ∈ [0,1], is the model’s estimated probability for the class with Y=1.

For notational convenience, we can rewrite the above equation as –

pt = {-ln(p)         , when Y=1 -ln(1-p)    ,when Y=}

CE (p, y) = CE (pt)=-ln⁡(pt)

Fig: – The focal loss down weights easy examples with a factor of  (1-  pt)γ

Let’s understand it using an example below-

Examples: –

CE(FG) = -ln (0.95) =0.05

CE(BG)=-ln (1- 0.05) =0.05

A common approach to addressing such a class imbalance problem is to introduce a weighting factor ∝∈[0,1] for class 1 & 1- for class -1.

For notational convenience, we can define ∝t in loss function as follows-

CE (pt )= -∝tln ln( pt )

As you can see, this is just an extension to Cross-Entropy.

Problem with Balanced Cross-Entropy: –

As our experiments will show, the large class imbalance encountered during the training of dense detectors overwhelms the cross-entropy loss.

Easily classified negatives comprise the majority of the loss and dominate the gradient. While balances the importance of positive/negative examples, it does not differentiate between easy/hard examples.

Let’s understand this with an example-

Examples: –

CE(FG) = -0.25*ln (0.95) =0.0128

CE(BG)=-(1-0.25) * ln (1- 0.05) =0.038

While it does a good job differentiating positive & negative classes correctly but still does not differentiate between easy/hard examples.

And that’s where Focal loss (extension to cross-entropy) comes to rescue.

Focal loss explanation

Focal loss is just an extension of the cross-entropy loss function that would down-weight easy examples and focus training on hard negatives.

(1-  pt)γ  to the cross-entropy loss, with a tunable focusing parameter γ≥0.

RetinaNet object detection method uses an α-balanced variant of the focal loss, where α=0.25, γ=2 works the best.

So focal loss can be defined as –

FL (pt) = -αt(1-  pt)γ log  log(pt).

The focal loss is visualized for several values of γ∈[0,5], refer Figure 1.

We shall note the following properties of the focal loss-

When an example is misclassified and pt is small, the modulating factor is near 1 and the loss is unaffected.

pt→  1, the factor goes to 0 and the loss for well-classified examples is down weighed.

γ smoothly adjusts the rate at which easy examples are down-weighted.

As is increased, the effect of modulating factor is likewise increased. (After a lot of experiments and trials, researchers have found γ = 2 to work best)

Note:- when γ =0, FL is equivalent to CE. Shown blue curve in Fig

Intuitively, the modulating factor reduces the loss contribution from easy examples and extends the range in which an example receives the low loss.

Let’s understand the above properties of focal loss using an example-

Examples: –

When record (either foreground or background) is correctly classified-

Modulating factor (BG)= (1-(1-0.01))2 = 0.0001As you can see, the modulating factor is close to 0, in turn, the loss would be down-weighted.

Modulating factor (BG)= (1-(1-0.99))2 =0.9801As you can see, the modulating factor is close to 1, in turn, the loss is unaffected.

Now let’s compare Cross-Entropy and Focal loss using a few examples and see the impact of focal loss in the training process.

Let’s see the comparison by considering a few scenarios below-

FL(BG)=-0.75 * (1-(1-0.05))2 *ln (1-0.05) =9.61E-5

FL(BG)= -0.75 * (1-(1-0.95))2 *ln (1-0.95) =2.027736282661858  

FL(BG)= -0.75 * (1-(1-0.01))2 *ln (1-0.01) =7.5377518901261E-7

scenario-3: 0.01/0.00000025 = 40,000 times smaller number.

These three cases clearly explain how Focal loss adds down weights the well-classified records and on the other hand, assigns large weight to misclassified or hard classified records.

After a lot of trials and experiments, researchers have found ∝=0.25 & γ=2 to work best.

If you enjoyed this article, leave a few claps, it will encourage me to explore more machine learning techniques & pen them down 🙂

Happy learning. Cheers!!

References: – About the Author

Praveen Kumar Anwla

I’ve been working as a Data Scientist with product-based and Big 4 Audit firms for almost 5 years now. I have been working on various NLP, Machine learning & cutting edge deep learning frameworks to solve business problems. Please feel free to check out my personal blog, where I cover topics from Machine learning – AI, Chatbots to Visualization tools ( Tableau, QlikView, etc.) & various cloud platforms like Azure, IBM & AWS cloud.


Update the detailed information about A Beginner’s Guide To Building Your Own Pc on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!