Tech Tutorials

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Beginners Tutorial on XGBoost and Parameter Tuning in R

Introduction

Last week, we learned about Random Forest Algorithm. Now we know it helps us reduce a model's variance by building models on resampled data and thereby increases its generalization capability. Good!

Now, you might be wondering, what to do next for increasing a model's prediction accuracy ? After all, an ideal model is one which is good at both generalization and prediction accuracy. This brings us to Boosting Algorithms.

Developed in 1989, the family of boosting algorithms has been improved over the years. In this article, we'll learn about XGBoost algorithm.

XGBoost is the most popular machine learning algorithm these days. Regardless of the data type (regression or classification), it is well known to provide better solutions than other ML algorithms. In fact, since its inception (early 2014), it has become the "true love" of kaggle users to deal with structured data. So, if you are planning to compete on Kaggle, xgboost is one algorithm you need to master.

In this article, you'll learn about core concepts of the XGBoost algorithm. In addition, we'll look into its practical side, i.e., improving the xgboost model using parameter tuning in R.

On 5th March 2017: How to win Machine Learning Competitions ?

Table of Contents

  1. What is XGBoost? Why is it so good?
  2. How does XGBoost work?
  3. Understanding XGBoost Tuning Parameters
  4. Practical - Tuning XGBoost using R

Machine learning challenge, ML challenge

What is XGBoost ? Why is it so good ?

XGBoost (Extreme Gradient Boosting) is an optimized distributed gradient boosting library. Yes, it uses gradient boosting (GBM) framework at core. Yet, does better than GBM framework alone. XGBoost was created by Tianqi Chen, PhD Student, University of Washington. It is used for supervised ML problems. Let's look at what makes it so good:

  1. Parallel Computing: It is enabled with parallel processing (using OpenMP); i.e., when you run xgboost, by default, it would use all the cores of your laptop/machine.
  2. Regularization: I believe this is the biggest advantage of xgboost. GBM has no provision for regularization. Regularization is a technique used to avoid overfitting in linear and tree-based models.
  3. Enabled Cross Validation: In R, we usually use external packages such as caret and mlr to obtain CV results. But, xgboost is enabled with internal CV function (we'll see below).
  4. Missing Values: XGBoost is designed to handle missing values internally. The missing values are treated in such a manner that if there exists any trend in missing values, it is captured by the model.
  5. Flexibility: In addition to regression, classification, and ranking problems, it supports user-defined objective functions also. An objective function is used to measure the performance of the model given a certain set of parameters. Furthermore, it supports user defined evaluation metrics as well.
  6. Availability: Currently, it is available for programming languages such as R, Python, Java, Julia, and Scala.
  7. Save and Reload: XGBoost gives us a feature to save our data matrix and model and reload it later. Suppose, we have a large data set, we can simply save the model and use it in future instead of wasting time redoing the computation.
  8. Tree Pruning: Unlike GBM, where tree pruning stops once a negative loss is encountered, XGBoost grows the tree upto max_depth and then prune backward until the improvement in loss function is below a threshold.

I'm sure now you are excited to master this algorithm. But remember, with great power comes great difficulties too. You might learn to use this algorithm in a few minutes, but optimizing it is a challenge. Don't worry, we shall look into it in following sections.

How does XGBoost work ?

XGBoost belongs to a family of boosting algorithms that convert weak learners into strong learners. A weak learner is one which is slightly better than random guessing. Let's understand boosting first (in general).

Boosting is a sequential process; i.e., trees are grown using the information from a previously grown tree one after the other. This process slowly learns from data and tries to improve its prediction in subsequent iterations. Let's look at a classic classification example:

explain boosting

Four classifiers (in 4 boxes), shown above, are trying hard to classify + and - classes as homogeneously as possible. Let's understand this picture well.

  1. Box 1: The first classifier creates a vertical line (split) at D1. It says anything to the left of D1 is + and anything to the right of D1 is -. However, this classifier misclassifies three + points.
  2. Box 2: The next classifier says don't worry I will correct your mistakes. Therefore, it gives more weight to the three + misclassified points (see bigger size of +) and creates a vertical line at D2. Again it says, anything to right of D2 is - and left is +. Still, it makes mistakes by incorrectly classifying three - points.
  3. Box 3: The next classifier continues to bestow support. Again, it gives more weight to the three - misclassified points and creates a horizontal line at D3. Still, this classifier fails to classify the points (in circle) correctly.
  4. Remember that each of these classifiers has a misclassification error associated with them.
  5. Boxes 1,2, and 3 are weak classifiers. These classifiers will now be used to create a strong classifier Box 4.
  6. Box 4: It is a weighted combination of the weak classifiers. As you can see, it does good job at classifying all the points correctly.

That's the basic idea behind boosting algorithms. The very next model capitalizes on the misclassification/error of previous model and tries to reduce it. Now, let's come to XGBoost.

As we know, XGBoost can used to solve both regression and classification problems. It is enabled with separate methods to solve respective problems. Let's see:

Classification Problems: To solve such problems, it uses booster = gbtree parameter; i.e., a tree is grown one after other and attempts to reduce misclassification rate in subsequent iterations. In this, the next tree is built by giving a higher weight to misclassified points by the previous tree (as explained above).

Regression Problems: To solve such problems, we have two methods: booster = gbtree and booster = gblinear. You already know gbtree. In gblinear, it builds generalized linear model and optimizes it using regularization (L1,L2) and gradient descent. In this, the subsequent models are built on residuals (actual - predicted) generated by previous iterations. Are you wondering what is gradient descent? Understanding gradient descent requires math, however, let me try and explain it in simple words:

  • Gradient Descent: It is a method which comprises a vector of weights (or coefficients) where we calculate their partial derivative with respective to zero. The motive behind calculating their partial derivative is to find the local minima of the loss function (RSS), which is convex in nature. In simple words, gradient descent tries to optimize the loss function by tuning different values of coefficients to minimize the error.
gradient descent convex function

Hopefully, up till now, you have developed a basic intuition around how boosting and xgboost works. Let's proceed to understand its parameters. After all, using xgboost without parameter tuning is like driving a car without changing its gears; you can never up your speed.

Note: In R, xgboost package uses a matrix of input data instead of a data frame.

Understanding XGBoost Tuning Parameters

Every parameter has a significant role to play in the model's performance. Before hypertuning, let's first understand about these parameters and their importance. In this article, I've only explained the most frequently used and tunable parameters. To look at all the parameters, you can refer to its official documentation.

XGBoost parameters can be divided into three categories (as suggested by its authors):
  • General Parameters: Controls the booster type in the model which eventually drives overall functioning
  • Booster Parameters: Controls the performance of the selected booster
  • Learning Task Parameters: Sets and evaluates the learning process of the booster from the given data

  1. General Parameters
    1. Booster[default=gbtree]
      • Sets the booster type (gbtree, gblinear or dart) to use. For classification problems, you can use gbtree, dart. For regression, you can use any.
    2. nthread[default=maximum cores available]
      • Activates parallel computation. Generally, people don't change it as using maximum cores leads to the fastest computation.
    3. silent[default=0]
      • If you set it to 1, your R console will get flooded with running messages. Better not to change it.

  2. Booster Parameters
  3. As mentioned above, parameters for tree and linear boosters are different. Let's understand each one of them:

    Parameters for Tree Booster

    1. nrounds[default=100]
      • It controls the maximum number of iterations. For classification, it is similar to the number of trees to grow.
      • Should be tuned using CV
    2. eta[default=0.3][range: (0,1)]
      • It controls the learning rate, i.e., the rate at which our model learns patterns in data. After every round, it shrinks the feature weights to reach the best optimum.
      • Lower eta leads to slower computation. It must be supported by increase in nrounds.
      • Typically, it lies between 0.01 - 0.3
    3. gamma[default=0][range: (0,Inf)]
      • It controls regularization (or prevents overfitting). The optimal value of gamma depends on the data set and other parameter values.
      • Higher the value, higher the regularization. Regularization means penalizing large coefficients which don't improve the model's performance. default = 0 means no regularization.
      • Tune trick: Start with 0 and check CV error rate. If you see train error >>> test error, bring gamma into action. Higher the gamma, lower the difference in train and test CV. If you have no clue what value to use, use gamma=5 and see the performance. Remember that gamma brings improvement when you want to use shallow (low max_depth) trees.
    4. max_depth[default=6][range: (0,Inf)]
      • It controls the depth of the tree.
      • Larger the depth, more complex the model; higher chances of overfitting. There is no standard value for max_depth. Larger data sets require deep trees to learn the rules from data.
      • Should be tuned using CV
    5. min_child_weight[default=1][range:(0,Inf)]
      • In regression, it refers to the minimum number of instances required in a child node. In classification, if the leaf node has a minimum sum of instance weight (calculated by second order partial derivative) lower than min_child_weight, the tree splitting stops.
      • In simple words, it blocks the potential feature interactions to prevent overfitting. Should be tuned using CV.
    6. subsample[default=1][range: (0,1)]
      • It controls the number of samples (observations) supplied to a tree.
      • Typically, its values lie between (0.5-0.8)
    7. colsample_bytree[default=1][range: (0,1)]
      • It control the number of features (variables) supplied to a tree
      • Typically, its values lie between (0.5,0.9)
    8. lambda[default=0]
      • It controls L2 regularization (equivalent to Ridge regression) on weights. It is used to avoid overfitting.
    9. alpha[default=1]
      • It controls L1 regularization (equivalent to Lasso regression) on weights. In addition to shrinkage, enabling alpha also results in feature selection. Hence, it's more useful on high dimensional data sets.

    Parameters for Linear Booster

    Using linear booster has relatively lesser parameters to tune, hence it computes much faster than gbtree booster.
    1. nrounds[default=100]
      • It controls the maximum number of iterations (steps) required for gradient descent to converge.
      • Should be tuned using CV
    2. lambda[default=0]
      • It enables Ridge Regression. Same as above
    3. alpha[default=1]
      • It enables Lasso Regression. Same as above

  4. Learning Task Parameters
  5. These parameters specify methods for the loss function and model evaluation. In addition to the parameters listed below, you are free to use a customized objective / evaluation function.

    1. Objective[default=reg:linear]
      • reg:linear - for linear regression
      • binary:logistic - logistic regression for binary classification. It returns class probabilities
      • multi:softmax - multiclassification using softmax objective. It returns predicted class labels. It requires setting num_class parameter denoting number of unique prediction classes.
      • multi:softprob - multiclassification using softmax objective. It returns predicted class probabilities.
    2. eval_metric [no default, depends on objective selected]
      • These metrics are used to evaluate a model's accuracy on validation data. For regression, default metric is RMSE. For classification, default metric is error.
      • Available error functions are as follows:
        • mae - Mean Absolute Error (used in regression)
        • Logloss - Negative loglikelihood (used in classification)
        • AUC - Area under curve (used in classification)
        • RMSE - Root mean square error (used in regression)
        • error - Binary classification error rate [#wrong cases/#all cases]
        • mlogloss - multiclass logloss (used in classification)

We've looked at how xgboost works, the significance of each of its tuning parameter, and how it affects the model's performance. Let's bolster our newly acquired knowledge by solving a practical problem in R.

Practical - Tuning XGBoost in R

In this practical section, we'll learn to tune xgboost in two ways: using the xgboost package and MLR package. I don't see the xgboost R package having any inbuilt feature for doing grid/random search. To overcome this bottleneck, we'll use MLR to perform the extensive parametric search and try to obtain optimal accuracy.

I'll use the adult data set from my previous random forest tutorial. This data set poses a classification problem where our job is to predict if the given user will have a salary <=50K or >50K.

Using random forest, we achieved an accuracy of 85.8%. Theoretically, xgboost should be able to surpass random forest's accuracy. Let's see if we can do it. I'll follow the most common but effective steps in parameter tuning:

  1. First, you build the xgboost model using default parameters. You might be surprised to see that default parameters sometimes give impressive accuracy.
  2. If you get a depressing model accuracy, do this: fix eta = 0.1, leave the rest of the parameters at default value, using xgb.cv function get best n_rounds. Now, build a model with these parameters and check the accuracy.
  3. Otherwise, you can perform a grid search on rest of the parameters (max_depth, gamma, subsample, colsample_bytree etc) by fixing eta and nrounds. Note: If using gbtree, don't introduce gamma until you see a significant difference in your train and test error.
  4. Using the best parameters from grid search, tune the regularization parameters(alpha,lambda) if required.
  5. At last, increase/decrease eta and follow the procedure. But remember, excessively lower eta values would allow the model to learn deep interactions in the data and in this process, it might capture noise. So be careful!

This process might sound a bit complicated, but it's quite easy to code in R. Don't worry, I've demonstrated all the steps below. Let's get into actions now and quickly prepare our data for modeling (if you don't understand any line of code, ask me in comments):

# set working directory
path <- "~/December 2016/XGBoost_Tutorial"
setwd(path)

# load libraries
library(data.table)
library(mlr)

# set variable names
setcol <- c("age",
            "workclass",
            "fnlwgt",
            "education",
            "education-num",
            "marital-status",
            "occupation",
            "relationship",
            "race",
            "sex",
            "capital-gain",
            "capital-loss",
            "hours-per-week",
            "native-country",
            "target")

# load data
train <- read.table("adultdata.txt", header = FALSE, sep = ",",
                    col.names = setcol, na.strings = c(" ?"),
                    stringsAsFactors = FALSE)
test <- read.table("adulttest.txt", header = FALSE, sep = ",",
                   col.names = setcol, skip = 1,
                   na.strings = c(" ?"), stringsAsFactors = FALSE)

# convert data frame to data table
setDT(train)
setDT(test)

# check missing values
table(is.na(train))
sapply(train, function(x) sum(is.na(x)) / length(x)) * 100
table(is.na(test))
sapply(test, function(x) sum(is.na(x)) / length(x)) * 100

# quick data cleaning
# remove extra character from target variable
library(stringr)
test[, target := substr(target, start = 1, stop = nchar(target) - 1)]

# remove leading whitespaces
char_col <- colnames(train)[sapply(test, is.character)]
for (i in char_col) set(train, j = i, value = str_trim(train[[i]], side = "left"))
for (i in char_col) set(test, j = i, value = str_trim(test[[i]], side = "left"))

# set all missing value as "Missing"
train[is.na(train)] <- "Missing"
test[is.na(test)] <- "Missing"

Up to this point, we dealt with basic data cleaning and data inconsistencies. To use xgboost package, keep these things in mind:

  1. Convert the categorical variables into numeric using one hot encoding
  2. For classification, if the dependent variable belongs to class factor, convert it to numeric

R's base function model.matrix is quick enough to implement one hot encoding. In the code below, ~.+0 leads to encoding of all categorical variables without producing an intercept. Alternatively, you can use the dummies package to accomplish the same task. Since xgboost package accepts target variable separately, we'll do the encoding keeping this in mind:

# using one hot encoding
>labels <- train$target
>ts_label <- test$target
>new_tr <- model.matrix(~.+0, data = train[,-c("target"), with = FALSE])
>new_ts <- model.matrix(~.+0, data = test[,-c("target"), with = FALSE])

# convert factor to numeric
>labels <- as.numeric(labels) - 1
>ts_label <- as.numeric(ts_label) - 1

For xgboost, we'll use xgb.DMatrix to convert data table into a matrix (most recommended):

# preparing matrix
>dtrain <- xgb.DMatrix(data = new_tr, label = labels)
&t;dtest <- xgb.DMatrix(data = new_ts, label = ts_label)

As mentioned above, we'll first build our model using default parameters, keeping random forest's accuracy 85.8% in mind. I'll capture the default parameters from above (written against every parameter):

# default parameters
params <- list(
    booster = "gbtree",
    objective = "binary:logistic",
    eta = 0.3,
    gamma = 0,
    max_depth = 6,
    min_child_weight = 1,
    subsample = 1,
    colsample_bytree = 1
)

Using the inbuilt xgb.cv function, let's calculate the best nround for this model. In addition, this function also returns CV error, which is an estimate of test error.

xgbcv <- xgb.cv(
    params = params,
    data = dtrain,
    nrounds = 100,
    nfold = 5,
    showsd = TRUE,
    stratified = TRUE,
    print.every.n = 10,
    early.stop.round = 20,
    maximize = FALSE
)
# best iteration = 79

The model returned lowest error at the 79th (nround) iteration. Also, if you noticed the running messages in your console, you would have understood that train and test error are following each other. We'll use this insight in the following code. Now, we'll see our CV error:

min(xgbcv$test.error.mean)
# 0.1263

As compared to my previous random forest model, this CV accuracy (100-12.63)=87.37% looks better already. However, I believe cross-validation accuracy is usually more optimistic than true test accuracy. Let's calculate our test set accuracy and determine if this default model makes sense:

# first default - model training
xgb1 <- xgb.train(
    params = params,
    data = dtrain,
    nrounds = 79,
    watchlist = list(val = dtest, train = dtrain),
    print.every.n = 10,
    early.stop.round = 10,
    maximize = FALSE,
    eval_metric = "error"
)

# model prediction
xgbpred <- predict(xgb1, dtest)
xgbpred <- ifelse(xgbpred > 0.5, 1, 0)

The objective function binary:logistic returns output predictions rather than labels. To convert it, we need to manually use a cutoff value. As seen above, I've used 0.5 as my cutoff value for predictions. We can calculate our model's accuracy using confusionMatrix() function from caret package.

# confusion matrix
library(caret)
confusionMatrix(xgbpred, ts_label)
# Accuracy - 86.54%

# view variable importance plot
mat <- xgb.importance(feature_names = colnames(new_tr), model = xgb1)
xgb.plot.importance(importance_matrix = mat[1:20])  # first 20 variables

xgboost variable importance plot

As you can see, we've achieved better accuracy than a random forest model using default parameters in xgboost. Can we still improve it? Let's proceed to the random / grid search procedure and attempt to find better accuracy. From here on, we'll be using the MLR package for model building. A quick reminder, the MLR package creates its own frame of data, learner as shown below. Also, keep in mind that task functions in mlr doesn't accept character variables. Hence, we need to convert them to factors before creating task:

# convert characters to factors
fact_col <- colnames(train)[sapply(train, is.character)]
for (i in fact_col) set(train, j = i, value = factor(train[[i]]))
for (i in fact_col) set(test, j = i, value = factor(test[[i]]))

# create tasks
traintask <- makeClassifTask(data = train, target = "target")
testtask <- makeClassifTask(data = test, target = "target")

# do one hot encoding
traintask <- createDummyFeatures(obj = traintask, target = "target")
testtask <- createDummyFeatures(obj = testtask, target = "target")

Now, we'll set the learner and fix the number of rounds and eta as discussed above.


#create learner
# create learner
lrn <- makeLearner("classif.xgboost", predict.type = "response")
lrn$par.vals <- list(
    objective = "binary:logistic",
    eval_metric = "error",
    nrounds = 100L,
    eta = 0.1
)

# set parameter space
params <- makeParamSet(
    makeDiscreteParam("booster", values = c("gbtree", "gblinear")),
    makeIntegerParam("max_depth", lower = 3L, upper = 10L),
    makeNumericParam("min_child_weight", lower = 1L, upper = 10L),
    makeNumericParam("subsample", lower = 0.5, upper = 1),
    makeNumericParam("colsample_bytree", lower = 0.5, upper = 1)
)

# set resampling strategy
rdesc <- makeResampleDesc("CV", stratify = TRUE, iters = 5L)

With stratify=T, we'll ensure that distribution of target class is maintained in the resampled data sets. If you've noticed above, in the parameter set, I didn't consider gamma for tuning. Simply because during cross validation, we saw that train and test error are in sync with each other. Had either one of them been dragging or rushing, we could have brought this parameter into action.

Now, we'll set the search optimization strategy. Though, xgboost is fast, instead of grid search, we'll use random search to find the best parameters.

How Fukushima nuclear disaster powered smart farming in Japan

On March 11, 2011, the most intense earthquake in Japanese history hit its north east coast — magnitude 9.0. The earthquake was so powerful that it severely damaged buildings, road, and rail infrastructure in Tokyo, which was 373 km away from the epicenter. This was an undersea megathrust earthquake.

Fifty minutes after the earthquake, tsunami waves as high as 13 meters hit the eastern part of Japan, leaving more than 15,500 dead, 6,000 injured, and 2,500 people missing. The tsunami struck so hard that it resulted in a Level-7 nuclear disaster in Fukushima (in Japanese, Fukushima means Fortune Island); it is the second nuclear disaster in the history of mankind which was given level-7 criticality after the Chernobyl disaster in 1986.

Fukushima had six separate boiling water reactors maintained by Tokyo Electric Power Company (TEPCO). Due to the powerful earthquake and tsunami, the nuclear power plant in Fukushima was subjected to serious structural damage. This resulted in hydrogen-air explosion on top of each nuclear reactor, releasing huge amounts of radioactive particles including Iodine-131, Caesium-134/137, Tellurium-129m, and Strontium 90 into the atmosphere. These radioactive particles contaminated air, soil, and water in and around Fukushima.

Unfortunately, Fukushima was one of the most agriculturally important regions in Japan. There are close to two million farmers in Japan, of which 70,000 are in Fukushima. The farmers of Fukushima had to deal with radioactive contamination of their soil, crops, livestock, and the marine ecosystem in addition to the tragedy caused by the tsunami. Due to radioactive contamination everywhere, the government of Japan imposed restrictions on the growing and selling of crops, dairy products, and seafood.

Now, Japan needed to increase its production to make up for the agricultural loss in Fukushima and, very importantly, it needed food products without radioactive contaminants. If this is not achieved, Japan would head toward a food crisis.

In Kameoka (a satellite town to the west of the Japanese city of Kyoto), the Japanese agriculture technology company SPREAD had started working on a smart farming system on barren land. SPREAD built a vegetable factory in a 2868.22 m2-area.

Inside the doors of this warehouse-like agriculture complex, SPREAD uses vertical farming system.

SPREAD vegetable factory grew lettuce in a soil-less and sunless ecosystem.

SPREAD vertical farming system.
Inside SPREAD vegetable factory

In an interview with CNN on September 19, 2016, Shinji Inada, the president of SPREAD, said, "The turning point was the incident in 2011 at the Fukushima nuclear facility. After what happened there, people became more aware of the importance of safe food and it kind of turned the tables for us."

Here a sophisticated form of hydroculture known as the Hydroponics method is used, where plants are grown in an aqueous solution of mineral nutrients with water as a solvent. In this method, terrestrial plants are grown with roots exposed to a mineral nutrient solution.

Hydroponics method of farming
Hydroponics method of farming

Since this is an indoor farm, LED lights on top of each shelf provide adequate light for photosynthesis and the growth of lettuce.

indoor farm with LED lights on top
Indoor vertical farm with LED lights on top

At this vegetable factory, human involvement is restricted to sowing the seeds; later, everything till the harvest is taken care of by robots and sensors.

With the help of modern sensor technology, the following factors are measured:

  • Lighting
  • Level of nutrients in the mineral solvent
  • Humidity level inside the setup
  • Temperature level inside the setup
  • Level of CO2

To maintain these factors at the optimal level, robots are installed which take corrective measures.

The lettuce is grown in a highly controlled environment at this facility. As a result of not using any fertilizer, the lettuce grown at this agriculture facility is richer in beta-carotene (an antioxidant) than farm-grown lettuce.

The setup has stacker cranes which carry the stacks to the robots for harvesting after they have reached maturity. It takes 40 days for a lettuce head to be ready for harvest, whereas it takes two months for farm-grown lettuce. After the harvest, the lettuces are moved to the packaging section without any outside intervention. There are either retail or packaging boxes wholesale used for that purpose. The SPREAD’s facility at Kameoka has an output capacity of 21,000 lettuces per day.

This innovative move by SPREAD is not only providing vegetables free from radioactive contamination but also contributing to the ecology to a great extent. Here is how:

Water Recycling

Water used for cultivation of lettuce in the vegetable factory is reused after filtration and purification. At this facility, 98% of water is recycled, and it significantly reduces the water consumption—a mere 0.83 liters is used to grow one head of lettuce.

Water recycling in SPREAD vegetable factory
Water recycling system at SPREAD vegetable factory

Zero damage due to pesticides

Since this vegetable factory uses the hydroponics method to cultivate lettuce, pesticides are not required during the cultivation lifecycle. Hence, soil and water contamination is prevented and the balance of microbes and insects in ecosystem is preserved.

Reduction in energy consumption

SPREAD has developed specialized LED lights and an air conditioning system to be used at their vegetable factory, reducing the energy consumption by 30%.

SPREAD is currently working on a second vegetable factory at Keihanna, with an output capacity of 30,000 heads of lettuce per day with 86.7% reduction in water usage.

Getting Started with Python and Redis

This is a small tutorial to start using Redis with Python. We will look at the steps that tell you how to install Redis in your local ubuntu machine. As we are compiling from source this should also represent how to install in any linux distribution. Then, we can look at some basic commands in Redis and get a feel of the Redis commands. Finally, we will install the Redis-py module and see how we can interface with the Redis module from Python.

Before going through this tutorial, please go through our Redis infographic to get an overview of the Redis module and how to approach it. We also have a webinar on developing a Redis module. I am using an ubuntu machine. Let us start with the installation of Redis.
sudo apt-get update
Install build essentials which have C and C++ compilers and other GNU C libraries which will help us in the installation later.
sudo apt-get install build-essential
Tcl is also needed to run Redis.
sudo apt-get install tcl8.5
Download the Redis source and untar it.
wget http://download.redis.io/releases/redis-stable.tar.gz

tar xzf redis-stable.tar.gz
cd redis-stable
We will need to now compile from source.
make 

make test
make install
Once this is done, there will be a set of scripts that will be created in the utils folder which can be used to install the service.
?  utils sudo ./install_server.sh

Welcome to the redis service installer
This script will help you easily set up a running redis server.


Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Adding system startup for /etc/init.d/redis_6379 ...
/etc/rc0.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc1.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc6.d/K20redis_6379 -> ../init.d/redis_6379
/etc/rc2.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc3.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc4.d/S20redis_6379 -> ../init.d/redis_6379
/etc/rc5.d/S20redis_6379 -> ../init.d/redis_6379
Success!
Starting Redis server...
Installation successful!
To access Redis, we will need the redis-cli.
?  utils redis-cli

127.0.0.1:6379> exit
We can set and get key values using the “SET” and “GET” keywords.
127.0.0.1:6379> SET users:GeorgeWashington "lang: python, born:1990"

OK
127.0.0.1:6379> GET users:GeorgeWashington
"lang: python, born:1990"
127.0.0.1:6379> exit
Let's now install the Python module and try to see if we can access the Redis server from Python. Let's test the Redis server with the Python.
?  redis_tutorial virtualenv venv -p python3.5

Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in venv/bin/python3.5
Also creating executable in venv/bin/python
Installing setuptools, pip...done.
? redis_tutorial source venv/bin/activate
(venv)? redis_tutorial
(venv)? redis_tutorial
(venv)? redis_tutorial pip install redis
Downloading/unpacking redis
Downloading redis-2.10.5-py2.py3-none-any.whl (60kB): 60kB downloaded
Installing collected packages: redis
Successfully installed redis
Cleaning up...
(venv)? redis_tutorial python
Python 3.5.2 (default, Jul 17 2016, 00:00:00)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> r = redis.StrictRedis()
>>> r.get("mykey")
>>> r.get("mykey")
>>> r.get("users:GeorgeWashington")
b'lang: python, born:1990'

This was a basic tutorial about using Python with Redis. Next, we will lay a frontend for making a twitter client using Flask as the middleware and Redis in the backend.

References:

agiliq, getting started with redis and python
digitalocean, how to install and use redis

Getting started: Python Decorators

This post will help you get started with Python decorators through some real life examples. Some familiarity with the Python programming language is expected.

Before directly jumping into decorators, let’s take a step back and start with Python functions. This will help you understand the concepts better.

Functions

A function in Python can be defined as follows:
def introduce(name):

return 'My name is %s' % name

This function takes name as input and returns a string, where:
  • def is the keyword used to define a function.
  • introduce is the name of the function.
  • the variable inside parentheses (name) is the required argument for the function.
  • next line is the body or definition of the function.

Function Properties

In Python, functions are treated as first-class objects. This means that Python treats functions as values. We can assign a function to a variable, pass it as an argument to another function, or return it as a value from another function.

def print_hello_world():

print('Hello World!')
We have defined a function 'print_hello_world’. Now we can assign it to a variable.
>>> modified_world = print_hello_world

(Here >>> is denoting the python interactive shell)

Now we can call modified_world just like the function print_hello_world.
>>> modified_world()

Hello World!
We can also pass a function to another function as an argument.
def execute(func):

print('Before execution')
func()
print('After execution')

So now when we pass print_hello_world function to execute function, the output will be as follows:
>>> execute(print_hello_world)

Before execution
Hello World!
After execution

Python also supports the nesting of functions. It means we can define another function in the body or definition of some other function. Example:

def foo(x):

def bar(y):
return x+y
return bar

In the example above, we have used two concepts described earlier.

1. Returning a function (bar) as a return value of the function foo

2. Nesting function bar in the definition of the function foo

Let’s see this code in action.

>>> v1 = foo(2)

Here v1 stores the return value of the function foo,which is another function bar. Now what will happen if we call v1 with some parameter?

>>>print(v1(5))

7

When a function is handled as data (in our case, return as a value from another function), it implicitly carries information required to execute the function. This is called closures in Python. We can check the closure of the function using __closure__ attribute of the function. This will return a tuple containing all the closures of the function. If we want to see any content of the closure, we can do something like v1.__closure__[0].cell_contents.

>>> v1.__closure__

(<cell at 0x7f4368e6c590: int object at 0xa41140>,)
>>> v1.__closure__[0].cell_contents
2

So, now that we looked at both function properties, let's see how we can use these properties in real scenarios.

Going Ahead

Suppose we want to perform some generic functionality before or/and after function execution. It can be like printing the execution time of the function.

One way to do this is by writing whatever we want to do before and after execution as initial and final statements, respectively. Example:

def print_hello_world():

print('Before Execution')
print('Hello World!')
print('After Execution')

Is this a good way. I leave it to you. What will happen if we have several functions and need to perform the same task for all other functions too?

Another way could be to write a function that will take any other function as an argument and return the function along with performing the task before and after function execution. Example:

def print_hello_world():

print('Hello World')

def dec(func):
def nest_func(*args, **kwargs):
print('Before Execution')
r = func(*args, **kwargs)
print('After Execution')
return r
return nest_func

The function print_hello_world just prints ‘Hello World’. Function dec takes a function as an argument and creates another function nest_func in its definition. nest_func prints some statements before and after the execution of the function is passed as an argument to function dec.

Let’s pass the function print_hello_world to dec.

>>> new_print_hello_world = dec(print_hello_world)

new_print_function is another function returned by the function dec. What will be the output on calling new_print_hello_world function? Let’s check it.

>>> new_print_hello_world()

Before Execution
Hello World
After Execution

What if we assign the new function returned by the dec function to print_hello_world function again?
>>> print_hello_world = dec(print_hello_world)

Let’s call print_hello_world function now.
>>> print_hello_world()

Before Execution
Hello World!
After Execution

We have changed the functionality of the function print_hello_world without changing the source code of the function itself.

So what next? If everything is clear till this point, then we have already learned about decorators. Let me explain.

Decorators

A decorator is a function which gives us the freedom to enhance or change the functionality of any function dynamically, without making changes in the code of the function.

In our case, function dec provides us with this functionality (as it changes the functionality of the function print_hello_world). So dec is called decorator. Instead of passing print_hello_world explicitly to function dec, we can use its shorthand syntax:

@dec

def print_hello_world():
print('Hello World')

I hope by now you understand what decorators are. You might be wondering why we need to return a function from the dec function? Just call the function in dec itself in which we can print statements along with executing the function passed as an argument. Example:

def dec1(func):

print('Before Execution')
func()
print('After Execution')
I have a few questions for you in answer. Suppose, I agree with you and decide to do it as suggested.
>>> print_hello_world = dec1(print_hello_world)
  1. What value does print_hello_world store right now? Can you call it now? (It is storing None which is the return value of the function dec1. So you can’t call print_hello_world now)
  2. What if we want to enhance a function having some arguments? One suggestion could be like this:
def dec2(func, arg1, arg2):

print('Before Execution')
func(arg1, arg2)
print('After Execution')

But the problem is this: how do you get the value of arg1 and arg2 at the time of passing any function to dec2?
>>> print_hello_world = dec2(print_hello_world, arg1, arg2)

Here, we will not be able to get the value of arg1 and arg2.

I hope these two points clearly explain why decorators are required to return a function.

Decorator Examples

  • It can be used to compute the execution time of any function.
    def compute_execution_time(func):
    
    def nest_func(*args, **kwargs):
    start = time.time()
    response = func(*args, **kwargs)
    end = time.time()
    print(end-start)
    return response
    return nest_func

  • In web applications, it can be used to check if the user is logged in or not.
    def login_required(func):
    
    def nest_function(request, *args, **kwargs):
    if request.user.is_authenticated():
    return func(request, *args, **kwargs)
    else
    return redirect('/login')
    return nest_function

I hope this article gives you a basic idea about Python decorators and some of their use cases. If you have any queries or feedback, you can reach me at udr.ritesh@gmail.com.

Beginners Guide to Regression Analysis and Plot Interpretations

Introduction

"The road to machine learning starts with Regression. Are you ready?"

If you are aspiring to become a data scientist, regression is the first algorithm you need to learn master. Not just to clear job interviews, but to solve real-world problems. Many consultancy firms continue to use regression techniques on a large scale to help their clients. While it's one of the easiest algorithms to learn, it requires persistent effort to master.

Running a regression model is simple. A basic model <- y ~ x does the job. But optimizing it for better accuracy is the real challenge. If your model gives adjusted R² = 0.678, how will you improve it?

This article introduces key regression concepts with practical applications in R. You’ll learn to build, improve, and optimize regression models. The focus here is on linear and multiple regression.

Note: Best suited for readers new to machine learning who have some knowledge of statistics. R should be installed.

Table of Contents

  1. What is Regression? How does it work?
  2. What are the assumptions made in Regression?
  3. How do I know if these assumptions are violated in my data?
  4. How can I improve the accuracy of a Regression Model?
  5. How can I assess the fit of a Regression Model?
  6. Practice Time – Solving a Regression Problem

Collections and Defaultdict in Python

NSA whistleblower in exile, Edward Snowden, talks about how FBI could have reviewed 650K emails in less than 8 days!

@jeffjarvis Drop non-responsive To:/CC:/BCC:, hash both sets, then subtract those that match. Old laptops could do it in minutes-to-hours.

— Edward Snowden (@Snowden) November 7, 2016

snowden_tweet

Snowden says the FBI could have used hashing to identify emails that were not copies of ones they had already seen. Few things capture people’s interest like alleged conspiracies and political intrigue, yes? I’m no different. But what interests more is hashing. Touted by many as the “greatest idea in programming,” hashing, which involves the hash function, helps you find, say A, stored somewhere, say B. For example, the organizing and accessing of names and numbers in your “can’t bear to be parted from" smartphone.

Hashing is a technique where a data-structure called the “hash map” is implemented. This structure is an associative array where specific keys are mapped to specific values. A hash function is then used to compute an index into an array of buckets or slots from which the desired value can be found. The result is that (key, value) lookups are extremely fast and more efficient than searches based on popular trees like BST. To get in-depth knowledge about hashing, I recommend that you can go through our “Basics of Hash Tables” in our practice section.



Almost all modern languages have hashing implemented at the language level. In Python, hashing is implemented using the dictionary data structure, which is one of the basic data structures a beginner in Python learns. If you have only been using the dict module implementation in your code, I suggest you look at other implementations like defaultdicts and ordereddicts and use them more frequently in your code. Here, we will look more closely into the defaultdict module.

Defaultdicts come in the Collections internal library. Collections contains alternatives to the general purpose Python containers like dict, set, list, and tuple. Kind of like the Dark Knight is the more interesting “implementation” of Bruce Wayne.

burger

Defaultdict is subclassed from the built-in dict module. You may have encountered the following common uses cases for which you have been using the default container.

Building nested dicts or JSON type constructs:

JSON is a very popular data structure. One of the major use cases for a JSON is creating web APIs. JSON also neatly corresponds to our dict object. A sample JSON object could look like this.
{"menu":

{"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]}
}}

Source:http://json.org/example.html.

We cannot create a json file by using the following command; it will throw a KeyError.
some_dict = {}

some_dict["menu"]["popup"]["value"] = "New"

So, we will have to write complicated error handling code to handle this KeyError.

This way of writing is considered un-Pythonic. In its place, try out the following construct.
import collections

tree = lambda: collections.defaultdict(tree)
some_dict = tree()
# below will create non existent keys
some_dict["menu"]["popup"]["value"] = "New"

A defaultdict is initialized with a function (“default factory”) that takes no arguments and provides the default value for a non-existent key. A defaultdict will never raise a KeyError. Any key that does not exist gets the value returned by the default factory.

Please ensure that you pass function objects to defaultdict. Do not call the function, that is, defaultdict(func), not defaultdict(func()).

Let’s check out how it works.
ice_cream = collections.defaultdict(lambda: 'Vanilla')

ice_cream['Sarah'] = 'Chunky Monkey'
ice_cream['Abdul'] = 'Butter Pecan'
print(ice_cream['Sarah']) # out: 'Chunky Monkey'
print(ice_cream['Joe']) # out: 'Vanilla

Having cool default values:

Another fast and flexible use case is to use itertools.repeat() which can supply any constant value.
import itertools

def constant_factory(value):
return itertools.repeat(value).next
d = collections.defaultdict(constant_factory(''))
d.update(name='John', action='ran')
print('%(name)s %(action)s to %(object)s' % d)

This should print out “John ran to.” As you can observe, the “object” variable gracefully defaulted to an empty string.

Performance:

Like you see in this stackoverflow post, we tried to do a similar benchmarking only between dicts(setdefault) and defaultdict. You can see it here: https://github.com/infinite-Joy/hacks/blob/master/defaultdict_benchmarking.ipynb
from collections import defaultdict


try:
t=unichr(100)
except NameError:
unichr=chr

def f1(li):
'''defaultdict'''
d = defaultdict(list)
for k, v in li:
d[k].append(v)
return d.items()

def f2(li):
'''setdefault'''
d={}
for k, v in li:
d.setdefault(k, []).append(v)
return d.items()


if __name__ == '__main__':
import timeit
import sys
print(sys.version)
few=[('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]
fmt='{:>12}: {:10.2f} micro sec/call ({:,} elements, {:,} keys)'
for tag, m, n in [('small',5,10000), ('medium',20,1000), ('bigger',1000,100), ('large',5000,10)]:
for f in [f1,f2]:
s = few*m
res=timeit.timeit("{}(s)".format(f.__name__), setup="from __main__ import {}, s".format(f.__name__), number=n)
st=fmt.format(f.__doc__, res/n*1000000, len(s), len(f(s)))
print(st)
s = [(unichr(i%0x10000),i) for i in range(1,len(s)+1)]
res=timeit.timeit("{}(s)".format(f.__name__), setup="from __main__ import {}, s".format(f.__name__), number=n)
st=fmt.format(f.__doc__, res/n*1000000, len(s), len(f(s)))
print(st)
print()
Below is the output that I got on my machine using Anaconda.
3.5.2 |Anaconda 4.1.1 (32-bit)| (default, Jul  5 2016, 11:45:57) [MSC v.1900 32 bit (Intel)]

defaultdict: 5.48 micro sec/call (25 elements, 3 keys)
defaultdict: 11.20 micro sec/call (25 elements, 25 keys)
setdefault: 7.80 micro sec/call (25 elements, 3 keys)
setdefault: 8.97 micro sec/call (25 elements, 25 keys)

defaultdict: 14.66 micro sec/call (100 elements, 3 keys)
defaultdict: 42.19 micro sec/call (100 elements, 100 keys)
setdefault: 26.71 micro sec/call (100 elements, 3 keys)
setdefault: 34.78 micro sec/call (100 elements, 100 keys)

defaultdict: 623.21 micro sec/call (5,000 elements, 3 keys)
defaultdict: 2207.91 micro sec/call (5,000 elements, 5,000 keys)
setdefault: 1329.99 micro sec/call (5,000 elements, 3 keys)
setdefault: 3076.57 micro sec/call (5,000 elements, 5,000 keys)

defaultdict: 4625.00 micro sec/call (25,000 elements, 3 keys)
defaultdict: 15950.98 micro sec/call (25,000 elements, 25,000 keys)
setdefault: 6907.47 micro sec/call (25,000 elements, 3 keys)
setdefault: 17605.08 micro sec/call (25,000 elements, 25,000 keys)

Following are the broad inferences that can be made from the data:

1. defaultdict is faster and simpler with small data sets.
2. defaultdict is faster for larger data sets with more homogenous key sets.
3. setdefault has an advantage over defaultdict if we consider more heterogeneous key sets.

Note: The results have been taken by running it on my machine with Python 3.5 implementation of Anaconda. I strongly recommend you to not follow these blindly. Do your own benchmarking tests with your own data before implementing your algorithm.

Now that we have discussed the DefaultDict module, I hope that you are already thinking of using it more and also refactoring your code base to implement this module more. Next, I’ll be coming up with a detailed discussion on the Counter module.

References:
stackoverflow, How are Python's Built In Dictionaries Implemented
stackoverflow, Is a Python dictionary an example of a hash table?e
python.org, Dictionary in Python
python.org, Python3 docs, collections — Container datatypes
python.org, Python2 docs, collections — Container datatypes
accelebrate, Using defaultdict in Python
In the Spotlight

Technical Screening Guide: All You Need To Know

Read this guide and learn how you can establish a less frustrating developer hiring workflow for both hiring teams and candidates.
Read More
Top Products

Explore HackerEarth’s top products for Hiring & Innovation

Discover powerful tools designed to streamline hiring, assess talent efficiently, and run seamless hackathons. Explore HackerEarth’s top products that help businesses innovate and grow.
Frame
Hackathons
Engage global developers through innovation
Arrow
Frame 2
Assessments
AI-driven advanced coding assessments
Arrow
Frame 3
FaceCode
Real-time code editor for effective coding interviews
Arrow
Frame 4
L & D
Tailored learning paths for continuous assessments
Arrow
Authors

Meet our Authors

Get to know the experts behind our content. From industry leaders to tech enthusiasts, our authors share valuable insights, trends, and expertise to keep you informed and inspired.
Ruehie Jaiya Karri
Kumari Trishya

Forecasting Tech Hiring Trends For 2023 With 6 Experts

2023 is here, and it is time to look ahead. Start planning your tech hiring needs as per your business requirements, revamp your recruiting processes, and come up with creative ways to land that perfect “unicorn candidate”!

Right? Well, jumping in blindly without heeding what this year holds for you can be a mistake. So before you put together your plans, ask yourselves this—What are the most important 2023 recruiting trends in tech hiring that you should be prepared for? What are the predictions that will shape this year?

We went around and posed three important questions to industry experts that were on our minds. And what they had to say certainly gave us some food for thought!

Before we dive in, allow me to introduce you to our expert panel of six, who had so much to say from personal experience!

Meet the Expert Panel

Radoslav Stankov

Radoslav Stankov has more than 20 years of experience working in tech. He is currently Head of Engineering at Product Hunt. Enjoys blogging, conference speaking, and solving problems.

Mike Cohen

Mike “Batman” Cohen is the Founder of Wayne Technologies, a Sourcing-as-a-Service company providing recruitment data and candidate outreach services to enhance the talent acquisition journey.

Pamela Ilieva

Pamela Ilieva is the Director of International Recruitment at Shortlister, a platform that connects employers to wellness, benefits, and HR tech vendors.

Brian H. Hough

Brian H. Hough is a Web2 and Web3 software engineer, AWS Community Builder, host of the Tech Stack Playbook™ YouTube channel/podcast, 5-time global hackathon winner, and tech content creator with 10k+ followers.

Steve O'Brien

Steve O'Brien is Senior Vice President, Talent Acquisition at Syneos Health, leading a global team of top recruiters across 30+ countries in 24+ languages, with nearly 20 years of diverse recruitment experience.

Patricia (Sonja Sky) Gatlin

Patricia (Sonja Sky) Gatlin is a New York Times featured activist, DEI Specialist, EdTechie, and Founder of Newbies in Tech. With 10+ years in Higher Education and 3+ in Tech, she now works part-time as a Diversity Lead recruiting STEM professionals to teach gifted students.

Overview of the upcoming tech industry landscape in 2024

Continued emphasis on remote work and flexibility: As we move into 2024, the tech industry is expected to continue embracing remote work and flexible schedules. This trend, accelerated by the COVID-19 pandemic, has proven to be more than a temporary shift. Companies are finding that remote work can lead to increased productivity, a broader talent pool, and better work-life balance for employees. As a result, recruiting strategies will likely focus on leveraging remote work capabilities to attract top talent globally.

Rising demand for AI and Machine Learning Skills: Artificial Intelligence (AI) and Machine Learning (ML) continue to be at the forefront of technological advancement. In 2024, these technologies are expected to become even more integrated into various business processes, driving demand for professionals skilled in AI and ML. Companies will likely prioritize candidates with expertise in these areas, and there may be an increased emphasis on upskilling existing employees to meet this demand.

Increased focus on cybersecurity: With the digital transformation of businesses, cybersecurity remains a critical concern. The tech industry in 2024 is anticipated to see a surge in the need for cybersecurity professionals. Companies will be on the lookout for talent capable of protecting against evolving cyber threats and ensuring data privacy.

Growth in cloud computing and edge computing: Cloud computing continues to grow, but there is also an increasing shift towards edge computing – processing data closer to where it is generated. This shift will likely create new job opportunities and skill requirements, influencing recruiting trends in the tech industry.

Sustainable technology and green computing: The global emphasis on sustainability is pushing the tech industry towards green computing and environmentally friendly technologies. In 2024, companies may seek professionals who can contribute to sustainable technology initiatives, adding a new dimension to tech recruiting.

Emphasis on soft skills: While technical skills remain paramount, soft skills like adaptability, communication, and problem-solving are becoming increasingly important. Companies are recognizing the value of these skills in fostering innovation and teamwork, especially in a remote or hybrid work environment.

Diversity, Equity, and Inclusion (DEI): There is an ongoing push towards more diverse and inclusive workplaces. In 2024, tech companies will likely continue to strengthen their DEI initiatives, affecting how they recruit and retain talent.

6 industry experts predict the 2023 recruiting trends

#1 We've seen many important moments in the tech industry this year...

Rado: In my opinion, a lot of those will carry over. I felt this was a preparation year for what was to come...

Mike: I wish I had the crystal ball for this, but I hope that when the market starts picking up again...

Pamela: Quiet quitting has been here way before 2022, and it is here to stay if organizations and companies...

Pamela Ilieva, Director of International Recruitment, Shortlister

Also, read: What Tech Companies Need To Know About Quiet Quitting


Brian: Yes, absolutely. In the 2022 Edelman Trust Barometer report...

Steve: Quiet quitting in the tech space will naturally face pressure as there is a redistribution of tech talent...

Patricia: Quiet quitting has been around for generations—people doing the bare minimum because they are no longer incentivized...

Patricia Gatlin, DEI Specialist and Curator, #blacklinkedin

#2 What is your pro tip for HR professionals/engineering managers...

Rado: Engineering managers should be able to do "more-with-less" in the coming year.

Radoslav Stankov, Head of Engineering, Product Hunt

Mike: Well first, (shameless plug), be in touch with me/Wayne Technologies as a stop-gap for when the time comes.

Mike “Batman” Cohen, Founder of Wayne Technologies

It's in the decrease and increase where companies find the hardest challenges...

Pamela: Remain calm – no need to “add fuel to the fire”!...

Brian: We have to build during the bear markets to thrive in the bull markets.

Companies can create internal hackathons to exercise creativity...


Also, read: Internal Hackathons - Drive Innovation And Increase Engagement In Tech Teams


Steve: HR professionals facing a hiring freeze will do well to “upgrade” processes, talent, and technology aggressively during downtime...

Steve O'Brien, Senior Vice President, Talent Acquisition at Syneos Health

Patricia: Talk to hiring managers in all your departments. Ask, what are the top 3-5 roles they are hiring for in the new year?...


Also, watch: 5 Recruiting Tips To Navigate The Hiring Freeze With Shalini Chandra, Senior TA, HackerEarth


#3 What top 3 skills would you like HR professionals/engineering managers to add to their repertoire in 2023 to deal with upcoming challenges?

6 industry experts predict the 2023 recruiting trends

Rado: Prioritization, team time, and environment management.

I think "prioritization" and "team time" management are obvious. But what do I mean by "environment management"?

A productive environment is one of the key ingredients for a productive team. Look at where your team wastes most time, which can be automated. For example, end-to-end writing tests take time because our tools are cumbersome and undocumented. So let's improve this.

Mike: Setting better metrics/KPIs, moving away from LinkedIn, and sharing more knowledge.

  1. Metrics/KPIs: Become better at setting measurable KPIs and accountable metrics. They are not the same thing—it's like the Square and Rectangle. One fits into the other but they're not the same. Hold people accountable to metrics, not KPIs. Make sure your metrics are aligned with company goals and values, and that they push employees toward excellence, not mediocrity.
  2. Freedom from LinkedIn: This is every year, and will probably continue to be. LinkedIn is a great database, but it is NOT the only way to find candidates, and oftentimes, not even the most effective/efficient. Explore other tools and methodologies!
  3. Join the conversation: I'd love to see new names of people presenting at conferences and webinars. And also, see new authors on the popular TA content websites. Everyone has things they can share—be a part of the community, not just a user of. Join FB groups, write and post articles, and comment on other people's posts with more than 'Great article'. It's a great community, but it's only great because of the people who contribute to it—be one of those people.

Pamela: Resilience, leveraging data, and self-awareness.

  1. Resilience: A “must-have” skill for the 21st century due to constant changes in the tech industry. Face and adapt to challenges. Overcome them and handle disappointments. Never give up. This will keep HR people alive in 2023.
  2. Data skills: Get some data analyst skills. The capacity to transfer numbers into data can help you be a better HR professional, prepared to improve the employee experience and show your leadership team how HR is leveraging data to drive business results.
  3. Self-awareness: Allows you to react better to upsetting situations and workplace challenges. It is a healthy skill to cultivate – especially as an HR professional.

Also, read: Diving Deep Into The World Of Data Science With Ashutosh Kumar


Brian: Agility, resourcefulness, and empathy.

  1. Agility: Allows professionals to move with market conditions. Always be as prepared as possible for any situation to come. Be flexible based on what does or does not happen.
  2. Resourcefulness: Allows professionals to do more with less. It also helps them focus on how to amplify, lift, and empower the current teams to be the best they can be.
  3. Empathy: Allows professionals to take a more proactive approach to listening and understanding where all workers are coming from. Amid stressful situations, companies need empathetic team members and leaders alike who can meet each other wherever they are and be a support.

Steve: Negotiation, data management, and talent development.

  1. Negotiation: Wage transparency laws will fundamentally change the compensation conversation. We must ensure we are still discussing compensation early in the process. And not just “assume” everyone’s on the same page because “the range is published”.
  2. Data management and predictive analytics: Looking at your organization's talent needs as a casserole of indistinguishable components and demands will not be good enough. We must upgrade the accuracy and consistency of our data and the predictions we can make from it.

Also, read: The Role of Talent Intelligence in Optimizing Recruitment


  1. Talent development: We’ve been exploring the interplay between TA and TM for years. Now is the time to integrate your internal and external talent marketplaces. To provide career experiences to people within your organization and not just those joining your organization.

Patricia: Technology, research, and relationship building.

  1. Technology: Get better at understanding the technology that’s out there. To help you speed up the process, track candidate experience, but also eliminate bias. Metrics are becoming big in HR.
  2. Research: Honestly, read more books. Many great thought leaders put out content about the “future of work”, understanding “Gen Z”, or “quiet quitting.” Dedicate work hours to understanding your ever-changing field.
  3. Relationship Building: Especially in your immediate communities. Most people don’t know who you are or what exactly it is that you do. Build your personal brand and what you are doing at your company to impact those closest to you. Create a referral funnel to get a pipeline going. When people want a job you and your company ought to be top of mind. Also, tell the stories of the people that work there.

7 Tech Recruiting Trends To Watch Out For In 2024

The last couple of years transformed how the world works and the tech industry is no exception. Remote work, a candidate-driven market, and automation are some of the tech recruiting trends born out of the pandemic.

While accepting the new reality and adapting to it is the first step, keeping up with continuously changing hiring trends in technology is the bigger challenge right now.

What does 2024 hold for recruiters across the globe? What hiring practices would work best in this post-pandemic world? How do you stay on top of the changes in this industry?

The answers to these questions will paint a clearer picture of how to set up for success while recruiting tech talent this year.

7 tech recruiting trends for 2024

6 Tech Recruiting Trends To Watch Out For In 2022

Recruiters, we’ve got you covered. Here are the tech recruiting trends that will change the way you build tech teams in 2024.

Trend #1—Leverage data-driven recruiting

Data-driven recruiting strategies are the answer to effective talent sourcing and a streamlined hiring process.

Talent acquisition leaders need to use real-time analytics like pipeline growth metrics, offer acceptance rates, quality and cost of new hires, and candidate feedback scores to reduce manual work, improve processes, and hire the best talent.

The key to capitalizing on talent market trends in 2024 is data. It enables you to analyze what’s working and what needs refinement, leaving room for experimentation.

Trend #2—Have impactful employer branding

98% of recruiters believe promoting company culture helps sourcing efforts as seen in our 2021 State Of Developer Recruitment report.

Having a strong employer brand that supports a clear Employer Value Proposition (EVP) is crucial to influencing a candidate’s decision to work with your company. Perks like upskilling opportunities, remote work, and flexible hours are top EVPs that attract qualified candidates.

A clear EVP builds a culture of balance, mental health awareness, and flexibility—strengthening your employer brand with candidate-first policies.

Trend #3—Focus on candidate-driven market

The pandemic drastically increased the skills gap, making tech recruitment more challenging. With the severe shortage of tech talent, candidates now hold more power and can afford to be selective.

Competitive pay is no longer enough. Use data to understand what candidates want—work-life balance, remote options, learning opportunities—and adapt accordingly.

Recruiters need to think creatively to attract and retain top talent.


Recommended read: What NOT To Do When Recruiting Fresh Talent


Trend #4—Have a diversity and inclusion oriented company culture

Diversity and inclusion have become central to modern recruitment. While urgent hiring can delay D&I efforts, long-term success depends on inclusive teams. Our survey shows that 25.6% of HR professionals believe a diverse leadership team helps build stronger pipelines and reduces bias.

McKinsey’s Diversity Wins report confirms this: top-quartile gender-diverse companies see 25% higher profitability, and ethnically diverse teams show 36% higher returns.

It's refreshing to see the importance of an inclusive culture increasing across all job-seeking communities, especially in tech. This reiterates that D&I is a must-have, not just a good-to-have.

—Swetha Harikrishnan, Sr. HR Director, HackerEarth

Recommended read: Diversity And Inclusion in 2022 - 5 Essential Rules To Follow


Trend #5—Embed automation and AI into your recruitment systems

With the rise of AI tools like ChatGPT, automation is being adopted across every business function—including recruiting.

Manual communication with large candidate pools is inefficient. In 2024, recruitment automation and AI-powered platforms will automate candidate nurturing and communication, providing a more personalized experience while saving time.

Trend #6—Conduct remote interviews

With 32.5% of companies planning to stay remote, remote interviewing is here to stay.

Remote interviews expand access to global talent, reduce overhead costs, and increase flexibility—making the hiring process more efficient for both recruiters and candidates.

Trend #7—Be proactive in candidate engagement

Delayed responses or lack of updates can frustrate candidates and impact your brand. Proactive communication and engagement with both active and passive candidates are key to successful recruiting.

As recruitment evolves, proactive candidate engagement will become central to attracting and retaining talent. In 2023 and beyond, companies must engage both active and passive candidates through innovative strategies and technologies like chatbots and AI-powered systems. Building pipelines and nurturing relationships will enhance employer branding and ensure long-term hiring success.

—Narayani Gurunathan, CEO, PlaceNet Consultants

Recruiting Tech Talent Just Got Easier With HackerEarth

Recruiting qualified tech talent is tough—but we’re here to help. HackerEarth for Enterprises offers an all-in-one suite that simplifies sourcing, assessing, and interviewing developers.

Our tech recruiting platform enables you to:

  • Tap into a 6 million-strong developer community
  • Host custom hackathons to engage talent and boost your employer brand
  • Create online assessments to evaluate 80+ tech skills
  • Use dev-friendly IDEs and proctoring for reliable evaluations
  • Benchmark candidates against a global community
  • Conduct live coding interviews with FaceCode, our collaborative coding interview tool
  • Guide upskilling journeys via our Learning and Development platform
  • Integrate seamlessly with all leading ATS systems
  • Access 24/7 support with a 95% satisfaction score

Recommended read: The A-Zs Of Tech Recruiting - A Guide


Staying ahead of tech recruiting trends, improving hiring processes, and adapting to change is the way forward in 2024. Take note of the tips in this article and use them to build a future-ready hiring strategy.

Ready to streamline your tech recruiting? Try HackerEarth for Enterprises today.

Code In Progress - The Life And Times Of Developers In 2021

Developers. Are they as mysterious as everyone makes them out to be? Is coding the only thing they do all day? Good coders work around the clock, right?

While developers are some of the most coveted talent out there, they also have the most myths being circulated. Most of us forget that developers too are just like us. And no, they do not code all day long.

We wanted to bust a lot of these myths and shed light on how the programming world looks through a developer’s lens in 2021—especially in the wake of a global pandemic. This year’s edition of the annual HackerEarth Developer Survey is packed with developers’ wants and needs when choosing jobs, major gripes with the WFH scenario, and the latest market trends to watch out for, among others.

Our 2021 report is bigger and better, with responses from 25,431 developers across 171 countries. Let’s find out what makes a developer tick, shall we?

Developer Survey

“Good coders work around the clock.” No, they don’t.

Busting the myth that developers spend the better part of their day coding, 52% of student developers said that they prefer to code for a maximum of 3 hours per day.

When not coding, devs swear by their walks as a way to unwind. When we asked devs the same question last year, they said they liked to indulge in indoor games like foosball. In 2021, going for walks has become the most popular method of de-stressing. We’re chalking it up to working from home and not having a chance to stretch their legs.

Staying ahead of the skills game

Following the same trend as last year, students (39%) and working professionals (44%) voted for Go as one of the most popular programming languages that they want to learn. The other programming languages that devs are interested in learning are Rust, Kotlin, and Erlang.

Programming languages that students are most skilled at are HTML/CSS, C++, and Python. Senior developers are more comfortable working with HTML/CSS, SQL, and Java.

How happy are developers

Employees from middle market organizations had the highest 'happiness index' of 7.2. Experienced developers who work at enterprises are marginally less happy in comparison to people who work at smaller companies.

However, happiness is not a binding factor for where developers work. Despite scoring the least on the happiness scale, working professionals would still like to work at enterprise companies and growth-stage startups.

What works when looking for work

Student devs (63%), who are just starting in the tech world, said a good career growth curve is a must-have. Working professionals can be wooed by offers of a good career path (69%) and compensation (68%).

One trend that has changed since last year is that at least 50% of students and working professionals alike care a lot more about ESOPs and positive Glassdoor reviews now than they did in 2020.


To know more about what developers want, download your copy of the report now!


We went a step further and organized an event with our CEO, Sachin Gupta, Radoslav Stankov, Head of Engineering at Product Hunt, and Steve O’Brien, President of Talent Solutions at Job.com to further dissect the findings of our survey.

Tips straight from the horse’s mouth

Steve highlighted how the information collated from the developer survey affects the recruiting community and how they can leverage this data to hire better and faster.

  • The insight where developer happiness is correlated to work hours didn’t find a significant difference between the cohorts. Devs working for less than 40 hours seemed marginally happier than those that clocked in more than 60 hours a week.
“This is an interesting data point, which shows that devs are passionate about what they do. You can increase their workload by 50% and still not affect their happiness. From a work perspective, as a recruiter, you have to get your hiring manager to understand that while devs never say no to more work, HMs shouldn’t overload the devs. Devs are difficult to source and burnout only leads to killing your talent pool, which is something that you do not want,” says Steve.
  • Roughly 45% of both student and professional developers learned how to code in college was another insight that was open to interpretation.
“Let’s look at it differently. Less than half of the surveyed developers learned how to code in college. There’s a major segment of the market today that is not necessarily following the ‘college degree to getting a job’ path. Developers are beginning to look at their skillsets differently and using various platforms to upskill themselves. Development is not about pedigree, it’s more about the potential to demonstrate skills. This is an interesting shift in the way we approach testing and evaluating devs in 2021.”

Rado contextualized the data from the survey to see what it means for the developer community and what trends to watch out for in 2021.

  • Node.js and AngularJS are the most popular frameworks among students and professionals.
“I was surprised by how many young students wanted to learn AngularJS, given that it’s more of an enterprise framework. Another thing that stood out to me was that the younger generation wants to learn technologies that are not necessarily cool like ExtJS (35%). This is good because people are picking technologies that they enjoy working with instead of just going along with what everyone else is doing. This also builds a more diverse technology pool.” — Rado
  • 22% of devs say ‘Zoom Fatigue’ is real and directly affects productivity.
“Especially for younger people who still haven’t figured out a routine to develop their skills, there is something I’d like you to try out. Start using noise-canceling headphones. They help keep distractions to a minimum. I find clutter-free working spaces to be an interesting concept as well.”

The last year and a half have been a doozy for developers everywhere, with a lot of things changing, and some things staying the same. With our developer survey, we wanted to shine the spotlight on skill-based hiring and market trends in 2021—plus highlight the fact that developers too have their gripes and happy hours.

Uncover many more developer trends for 2021 with Steve and Rado below:

View all

Best Pre-Employment Assessments: Optimizing Your Hiring Process for 2024

In today's competitive talent market, attracting and retaining top performers is crucial for any organization's success. However, traditional hiring methods like relying solely on resumes and interviews may not always provide a comprehensive picture of a candidate's skills and potential. This is where pre-employment assessments come into play.

What is Pre-Employement Assessment?

Pre-employment assessments are standardized tests and evaluations administered to candidates before they are hired. These assessments can help you objectively measure a candidate's knowledge, skills, abilities, and personality traits, allowing you to make data-driven hiring decisions.

By exploring and evaluating the best pre-employment assessment tools and tests available, you can:

  • Improve the accuracy and efficiency of your hiring process.
  • Identify top talent with the right skills and cultural fit.
  • Reduce the risk of bad hires.
  • Enhance the candidate experience by providing a clear and objective evaluation process.

This guide will provide you with valuable insights into the different types of pre-employment assessments available and highlight some of the best tools, to help you optimize your hiring process for 2024.

Why pre-employment assessments are key in hiring

While resumes and interviews offer valuable insights, they can be subjective and susceptible to bias. Pre-employment assessments provide a standardized and objective way to evaluate candidates, offering several key benefits:

  • Improved decision-making:

    By measuring specific skills and knowledge, assessments help you identify candidates who possess the qualifications necessary for the job.

  • Reduced bias:

    Standardized assessments mitigate the risks of unconscious bias that can creep into traditional interview processes.

  • Increased efficiency:

    Assessments can streamline the initial screening process, allowing you to focus on the most promising candidates.

  • Enhanced candidate experience:

    When used effectively, assessments can provide candidates with a clear understanding of the required skills and a fair chance to showcase their abilities.

Types of pre-employment assessments

There are various types of pre-employment assessments available, each catering to different needs and objectives. Here's an overview of some common types:

1. Skill Assessments:

  • Technical Skills: These assessments evaluate specific technical skills and knowledge relevant to the job role, such as programming languages, software proficiency, or industry-specific expertise. HackerEarth offers a wide range of validated technical skill assessments covering various programming languages, frameworks, and technologies.
  • Soft Skills: These employment assessments measure non-technical skills like communication, problem-solving, teamwork, and critical thinking, crucial for success in any role.

2. Personality Assessments:

These employment assessments can provide insights into a candidate's personality traits, work style, and cultural fit within your organization.

3. Cognitive Ability Tests:

These tests measure a candidate's general mental abilities, such as reasoning, problem-solving, and learning potential.

4. Integrity Assessments:

These employment assessments aim to identify potential risks associated with a candidate's honesty, work ethic, and compliance with company policies.

By understanding the different types of assessments and their applications, you can choose the ones that best align with your specific hiring needs and ensure you hire the most qualified and suitable candidates for your organization.

Leading employment assessment tools and tests in 2024

Choosing the right pre-employment assessment tool depends on your specific needs and budget. Here's a curated list of some of the top pre-employment assessment tools and tests available in 2024, with brief overviews:

  • HackerEarth:

    A comprehensive platform offering a wide range of validated skill assessments in various programming languages, frameworks, and technologies. It also allows for the creation of custom assessments and integrates seamlessly with various recruitment platforms.

  • SHL:

    Provides a broad selection of assessments, including skill tests, personality assessments, and cognitive ability tests. They offer customizable solutions and cater to various industries.

  • Pymetrics:

    Utilizes gamified assessments to evaluate cognitive skills, personality traits, and cultural fit. They offer a data-driven approach and emphasize candidate experience.

  • Wonderlic:

    Offers a variety of assessments, including the Wonderlic Personnel Test, which measures general cognitive ability. They also provide aptitude and personality assessments.

  • Harver:

    An assessment platform focusing on candidate experience with video interviews, gamified assessments, and skills tests. They offer pre-built assessments and customization options.

Remember: This list is not exhaustive, and further research is crucial to identify the tool that aligns best with your specific needs and budget. Consider factors like the types of assessments offered, pricing models, integrations with your existing HR systems, and user experience when making your decision.

Choosing the right pre-employment assessment tool

Instead of full individual tool reviews, consider focusing on 2–3 key platforms. For each platform, explore:

  • Target audience: Who are their assessments best suited for (e.g., technical roles, specific industries)?
  • Types of assessments offered: Briefly list the available assessment categories (e.g., technical skills, soft skills, personality).
  • Key features: Highlight unique functionalities like gamification, custom assessment creation, or seamless integrations.
  • Effectiveness: Briefly mention the platform's approach to assessment validation and reliability.
  • User experience: Consider including user reviews or ratings where available.

Comparative analysis of assessment options

Instead of a comprehensive comparison, consider focusing on specific use cases:

  • Technical skills assessment:

    Compare HackerEarth and Wonderlic based on their technical skill assessment options, focusing on the variety of languages/technologies covered and assessment formats.

  • Soft skills and personality assessment:

    Compare SHL and Pymetrics based on their approaches to evaluating soft skills and personality traits, highlighting any unique features like gamification or data-driven insights.

  • Candidate experience:

    Compare Harver and Wonderlic based on their focus on candidate experience, mentioning features like video interviews or gamified assessments.

Additional tips:

  • Encourage readers to visit the platforms' official websites for detailed features and pricing information.
  • Include links to reputable third-party review sites where users share their experiences with various tools.

Best practices for using pre-employment assessment tools

Integrating pre-employment assessments effectively requires careful planning and execution. Here are some best practices to follow:

  • Define your assessment goals:

    Clearly identify what you aim to achieve with assessments. Are you targeting specific skills, personality traits, or cultural fit?

  • Choose the right assessments:

    Select tools that align with your defined goals and the specific requirements of the open position.

  • Set clear expectations:

    Communicate the purpose and format of the assessments to candidates in advance, ensuring transparency and building trust.

  • Integrate seamlessly:

    Ensure your chosen assessment tool integrates smoothly with your existing HR systems and recruitment workflow.

  • Train your team:

    Equip your hiring managers and HR team with the knowledge and skills to interpret assessment results effectively.

Interpreting assessment results accurately

Assessment results offer valuable data points, but interpreting them accurately is crucial for making informed hiring decisions. Here are some key considerations:

  • Use results as one data point:

    Consider assessment results alongside other information, such as resumes, interviews, and references, for a holistic view of the candidate.

  • Understand score limitations:

    Don't solely rely on raw scores. Understand the assessment's validity and reliability and the potential for cultural bias or individual test anxiety.

  • Look for patterns and trends:

    Analyze results across different assessments and identify consistent patterns that align with your desired candidate profile.

  • Focus on potential, not guarantees:

    Assessments indicate potential, not guarantees of success. Use them alongside other evaluation methods to make well-rounded hiring decisions.

Choosing the right pre-employment assessment tools

Selecting the most suitable pre-employment assessment tool requires careful consideration of your organization's specific needs. Here are some key factors to guide your decision:

  • Industry and role requirements:

    Different industries and roles demand varying skill sets and qualities. Choose assessments that target the specific skills and knowledge relevant to your open positions.

  • Company culture and values:

    Align your assessments with your company culture and values. For example, if collaboration is crucial, look for assessments that evaluate teamwork and communication skills.

  • Candidate experience:

    Prioritize tools that provide a positive and smooth experience for candidates. This can enhance your employer brand and attract top talent.

Budget and accessibility considerations

Budget and accessibility are essential factors when choosing pre-employment assessments:

  • Budget:

    Assessment tools come with varying pricing models (subscriptions, pay-per-use, etc.). Choose a tool that aligns with your budget and offers the functionalities you need.

  • Accessibility:

    Ensure the chosen assessment is accessible to all candidates, considering factors like language options, disability accommodations, and internet access requirements.

Additional Tips:

  • Free trials and demos: Utilize free trials or demos offered by assessment platforms to experience their functionalities firsthand.
  • Consult with HR professionals: Seek guidance from HR professionals or recruitment specialists with expertise in pre-employment assessments.
  • Read user reviews and comparisons: Gain insights from other employers who use various assessment tools.

By carefully considering these factors, you can select the pre-employment assessment tool that best aligns with your organizational needs, budget, and commitment to an inclusive hiring process.

Remember, pre-employment assessments are valuable tools, but they should not be the sole factor in your hiring decisions. Use them alongside other evaluation methods and prioritize building a fair and inclusive hiring process that attracts and retains top talent.

Future trends in pre-employment assessments

The pre-employment assessment landscape is constantly evolving, with innovative technologies and practices emerging. Here are some potential future trends to watch:

  • Artificial intelligence (AI):

    AI-powered assessments can analyze candidate responses, written work, and even resumes, using natural language processing to extract relevant insights and identify potential candidates.

  • Adaptive testing:

    These assessments adjust the difficulty level of questions based on the candidate's performance, providing a more efficient and personalized evaluation.

  • Micro-assessments:

    Short, focused assessments delivered through mobile devices can assess specific skills or knowledge on-the-go, streamlining the screening process.

  • Gamification:

    Engaging and interactive game-based elements can make the assessment experience more engaging and assess skills in a realistic and dynamic way.

Conclusion

Pre-employment assessments, when used thoughtfully and ethically, can be a powerful tool to optimize your hiring process, identify top talent, and build a successful workforce for your organization. By understanding the different types of assessments available, exploring top-rated tools like HackerEarth, and staying informed about emerging trends, you can make informed decisions that enhance your ability to attract, evaluate, and hire the best candidates for the future.

Tech Layoffs: What To Expect In 2024

Layoffs in the IT industry are becoming more widespread as companies fight to remain competitive in a fast-changing market; many turn to layoffs as a cost-cutting measure. Last year, 1,000 companies including big tech giants and startups, laid off over two lakhs of employees. But first, what are layoffs in the tech business, and how do they impact the industry?

Tech layoffs are the termination of employment for some employees by a technology company. It might happen for various reasons, including financial challenges, market conditions, firm reorganization, or the after-effects of a pandemic. While layoffs are not unique to the IT industry, they are becoming more common as companies look for methods to cut costs while remaining competitive.

The consequences of layoffs in technology may be catastrophic for employees who lose their jobs and the firms forced to make these difficult decisions. Layoffs can result in the loss of skill and expertise and a drop in employee morale and productivity. However, they may be required for businesses to stay afloat in a fast-changing market.

This article will examine the reasons for layoffs in the technology industry, their influence on the industry, and what may be done to reduce their negative impacts. We will also look at the various methods for tracking tech layoffs.

What are tech layoffs?

The term "tech layoff" describes the termination of employees by an organization in the technology industry. A company might do this as part of a restructuring during hard economic times.

In recent times, the tech industry has witnessed a wave of significant layoffs, affecting some of the world’s leading technology companies, including Amazon, Microsoft, Meta (formerly Facebook), Apple, Cisco, SAP, and Sony. These layoffs are a reflection of the broader economic challenges and market adjustments facing the sector, including factors like slowing revenue growth, global economic uncertainties, and the need to streamline operations for efficiency.

Each of these tech giants has announced job cuts for various reasons, though common themes include restructuring efforts to stay competitive and agile, responding to over-hiring during the pandemic when demand for tech services surged, and preparing for a potentially tough economic climate ahead. Despite their dominant positions in the market, these companies are not immune to the economic cycles and technological shifts that influence operational and strategic decisions, including workforce adjustments.

This trend of layoffs in the tech industry underscores the volatile nature of the tech sector, which is often at the mercy of rapid changes in technology, consumer preferences, and the global economy. It also highlights the importance of adaptability and resilience for companies and employees alike in navigating the uncertainties of the tech landscape.

Causes for layoffs in the tech industry

Why are tech employees suffering so much?

Yes, the market is always uncertain, but why resort to tech layoffs?

Various factors cause tech layoffs, including company strategy changes, market shifts, or financial difficulties. Companies may lay off employees if they need help to generate revenue, shift their focus to new products or services, or automate certain jobs.

In addition, some common reasons could be:

Financial struggles

Currently, the state of the global market is uncertain due to economic recession, ongoing war, and other related phenomena. If a company is experiencing financial difficulties, only sticking to pay cuts may not be helpful—it may need to reduce its workforce to cut costs.


Also, read: 6 Steps To Create A Detailed Recruiting Budget (Template Included)


Changes in demand

The tech industry is constantly evolving, and companies would have to adjust their workforce to meet changing market conditions. For instance, companies are adopting remote work culture, which surely affects on-premises activity, and companies could do away with some number of tech employees at the backend.

Restructuring

Companies may also lay off employees as part of a greater restructuring effort, such as spinning off a division or consolidating operations.

Automation

With the advancement in technology and automation, some jobs previously done by human labor may be replaced by machines, resulting in layoffs.

Mergers and acquisitions

When two companies merge, there is often overlap in their operations, leading to layoffs as the new company looks to streamline its workforce.

But it's worth noting that layoffs are not exclusive to the tech industry and can happen in any industry due to uncertainty in the market.

Will layoffs increase in 2024?

It is challenging to estimate the rise or fall of layoffs. The overall state of the economy, the health of certain industries, and the performance of individual companies will play a role in deciding the degree of layoffs in any given year.

But it is also seen that, in the first 15 days of this year, 91 organizations laid off over 24,000 tech workers, and over 1,000 corporations cut down more than 150,000 workers in 2022, according to an Economic Times article.

The COVID-19 pandemic caused a huge economic slowdown and forced several businesses to downsize their employees. However, some businesses rehired or expanded their personnel when the world began to recover.

So, given the current level of economic uncertainty, predicting how the situation will unfold is difficult.


Also, read: 4 Images That Show What Developers Think Of Layoffs In Tech


What types of companies are prone to tech layoffs?

2023 Round Up Of Layoffs In Big Tech

Tech layoffs can occur in organizations of all sizes and various areas.

Following are some examples of companies that have experienced tech layoffs in the past:

Large tech firms

Companies such as IBM, Microsoft, Twitter, Better.com, Alibaba, and HP have all experienced layoffs in recent years as part of restructuring initiatives or cost-cutting measures.

Market scenarios are still being determined after Elon Musk's decision to lay off employees. Along with tech giants, some smaller companies and startups have also been affected by layoffs.

Startups

Because they frequently work with limited resources, startups may be forced to lay off staff if they cannot get further funding or need to pivot due to market downfall.

Small and medium-sized businesses

Small and medium-sized businesses face layoffs due to high competition or if the products/services they offer are no longer in demand.

Companies in certain industries

Some sectors of the technological industry, such as the semiconductor industry or automotive industry, may be more prone to layoffs than others.

Companies that lean on government funding

Companies that rely significantly on government contracts may face layoffs if the government cuts technology spending or contracts are not renewed.

How to track tech layoffs?

You can’t stop tech company layoffs, but you should be keeping track of them. We, HR professionals and recruiters, can also lend a helping hand in these tough times by circulating “layoff lists” across social media sites like LinkedIn and Twitter to help people land jobs quicker. Firefish Software put together a master list of sources to find fresh talent during the layoff period.

Because not all layoffs are publicly disclosed, tracking tech industry layoffs can be challenging, and some may go undetected. There are several ways to keep track of tech industry layoffs:

Use tech layoffs tracker

Layoff trackers like thelayoff.com and layoffs.fyi provide up-to-date information on layoffs.

In addition, they aid in identifying trends in layoffs within the tech industry. It can reveal which industries are seeing the most layoffs and which companies are the most affected.

Companies can use layoff trackers as an early warning system and compare their performance to that of other companies in their field.

News articles

Because many news sites cover tech layoffs as they happen, keeping a watch on technology sector stories can provide insight into which organizations are laying off employees and how many individuals have been affected.

Social media

Organizations and employees frequently publish information about layoffs in tech on social media platforms; thus, monitoring companies' social media accounts or following key hashtags can provide real-time updates regarding layoffs.

Online forums and communities

There are online forums and communities dedicated to discussing tech industry news, and they can be an excellent source of layoff information.

Government reports

Government agencies such as the Bureau of Labor Statistics (BLS) publish data on layoffs and unemployment, which can provide a more comprehensive picture of the technology industry's status.

How do companies reduce tech layoffs?

Layoffs in tech are hard – for the employee who is losing their job, the recruiter or HR professional who is tasked with informing them, and the company itself. So, how can we aim to avoid layoffs? Here are some ways to minimize resorting to letting people go:

Salary reductions

Instead of laying off employees, businesses can lower the salaries or wages of all employees. It can be accomplished by instituting compensation cuts or salary freezes.

Implementing a hiring freeze

Businesses can halt employing new personnel to cut costs. It can be a short-term solution until the company's financial situation improves.


Also, read: What Recruiters Can Focus On During A Tech Hiring Freeze


Non-essential expense reduction

Businesses might search for ways to cut or remove non-essential expenses such as travel, training, and office expenses.

Reducing working hours

Companies can reduce employee working hours to save money, such as implementing a four-day workweek or a shorter workday.

These options may not always be viable and may have their problems, but before laying off, a company owes it to its people to consider every other alternative, and formulate the best solution.

Tech layoffs to bleed into this year

While we do not know whether this trend will continue or subside during 2023, we do know one thing. We have to be prepared for a wave of layoffs that is still yet to hit. As of last month, Layoffs.fyi had already tracked 170+ companies conducting 55,970 layoffs in 2023.

So recruiters, let’s join arms, distribute those layoff lists like there’s no tomorrow, and help all those in need of a job! :)

What is Headhunting In Recruitment?: Types &amp; How Does It Work?

In today’s fast-paced world, recruiting talent has become increasingly complicated. Technological advancements, high workforce expectations and a highly competitive market have pushed recruitment agencies to adopt innovative strategies for recruiting various types of talent. This article aims to explore one such recruitment strategy – headhunting.

What is Headhunting in recruitment?

In headhunting, companies or recruitment agencies identify, engage and hire highly skilled professionals to fill top positions in the respective companies. It is different from the traditional process in which candidates looking for job opportunities approach companies or recruitment agencies. In headhunting, executive headhunters, as recruiters are referred to, approach prospective candidates with the hiring company’s requirements and wait for them to respond. Executive headhunters generally look for passive candidates, those who work at crucial positions and are not on the lookout for new work opportunities. Besides, executive headhunters focus on filling critical, senior-level positions indispensable to companies. Depending on the nature of the operation, headhunting has three types. They are described later in this article. Before we move on to understand the types of headhunting, here is how the traditional recruitment process and headhunting are different.

How do headhunting and traditional recruitment differ from each other?

Headhunting is a type of recruitment process in which top-level managers and executives in similar positions are hired. Since these professionals are not on the lookout for jobs, headhunters have to thoroughly understand the hiring companies’ requirements and study the work profiles of potential candidates before creating a list.

In the traditional approach, there is a long list of candidates applying for jobs online and offline. Candidates approach recruiters for jobs. Apart from this primary difference, there are other factors that define the difference between these two schools of recruitment.

AspectHeadhuntingTraditional RecruitmentCandidate TypePrimarily passive candidateActive job seekersApproachFocused on specific high-level rolesBroader; includes various levelsScopeproactive outreachReactive: candidates applyCostGenerally more expensive due to expertise requiredTypically lower costsControlManaged by headhuntersManaged internally by HR teams

All the above parameters will help you to understand how headhunting differs from traditional recruitment methods, better.

Types of headhunting in recruitment

Direct headhunting: In direct recruitment, hiring teams reach out to potential candidates through personal communication. Companies conduct direct headhunting in-house, without outsourcing the process to hiring recruitment agencies. Very few businesses conduct this type of recruitment for top jobs as it involves extensive screening across networks outside the company’s expanse.

Indirect headhunting: This method involves recruiters getting in touch with their prospective candidates through indirect modes of communication such as email and phone calls. Indirect headhunting is less intrusive and allows candidates to respond at their convenience.Third-party recruitment: Companies approach external recruitment agencies or executive headhunters to recruit highly skilled professionals for top positions. This method often leverages the company’s extensive contact network and expertise in niche industries.

How does headhunting work?

Finding highly skilled professionals to fill critical positions can be tricky if there is no system for it. Expert executive headhunters employ recruitment software to conduct headhunting efficiently as it facilitates a seamless recruitment process for executive headhunters. Most software is AI-powered and expedites processes like candidate sourcing, interactions with prospective professionals and upkeep of communication history. This makes the process of executive search in recruitment a little bit easier. Apart from using software to recruit executives, here are the various stages of finding high-calibre executives through headhunting.

Identifying the role

Once there is a vacancy for a top job, one of the top executives like a CEO, director or the head of the company, reach out to the concerned personnel with their requirements. Depending on how large a company is, they may choose to headhunt with the help of an external recruiting agency or conduct it in-house. Generally, the task is assigned to external recruitment agencies specializing in headhunting. Executive headhunters possess a database of highly qualified professionals who work in crucial positions in some of the best companies. This makes them the top choice of conglomerates looking to hire some of the best talents in the industry.

Defining the job

Once an executive headhunter or a recruiting agency is finalized, companies conduct meetings to discuss the nature of the role, how the company works, the management hierarchy among other important aspects of the job. Headhunters are expected to understand these points thoroughly and establish a clear understanding of their expectations and goals.

Candidate identification and sourcing

Headhunters analyse and understand the requirements of their clients and begin creating a pool of suitable candidates from their database. The professionals are shortlisted after conducting extensive research of job profiles, number of years of industry experience, professional networks and online platforms.

Approaching candidates

Once the potential candidates have been identified and shortlisted, headhunters move on to get in touch with them discreetly through various communication channels. As such candidates are already working at top level positions at other companies, executive headhunters have to be low-key while doing so.

Assessment and Evaluation

In this next step, extensive screening and evaluation of candidates is conducted to determine their suitability for the advertised position.

Interviews and negotiations

Compensation is a major topic of discussion among recruiters and prospective candidates. A lot of deliberation and negotiation goes on between the hiring organization and the selected executives which is facilitated by the headhunters.

Finalizing the hire

Things come to a close once the suitable candidates accept the job offer. On accepting the offer letter, headhunters help finalize the hiring process to ensure a smooth transition.

The steps listed above form the blueprint for a typical headhunting process. Headhunting has been crucial in helping companies hire the right people for crucial positions that come with great responsibility. However, all systems have a set of challenges no matter how perfect their working algorithm is. Here are a few challenges that talent acquisition agencies face while headhunting.

Common challenges in headhunting

Despite its advantages, headhunting also presents certain challenges:

Cost Implications: Engaging headhunters can be more expensive than traditional recruitment methods due to their specialized skills and services.

Time-Consuming Process: While headhunting can be efficient, finding the right candidate for senior positions may still take time due to thorough evaluation processes.

Market Competition: The competition for top talent is fierce; organizations must present compelling offers to attract passive candidates away from their current roles.

Although the above mentioned factors can pose challenges in the headhunting process, there are more upsides than there are downsides to it. Here is how headhunting has helped revolutionize the recruitment of high-profile candidates.

Advantages of Headhunting

Headhunting offers several advantages over traditional recruitment methods:

Access to Passive Candidates: By targeting individuals who are not actively seeking new employment, organisations can access a broader pool of highly skilled professionals.

Confidentiality: The discreet nature of headhunting protects both candidates’ current employment situations and the hiring organisation’s strategic interests.

Customized Search: Headhunters tailor their search based on the specific needs of the organization, ensuring a better fit between candidates and company culture.

Industry Expertise: Many headhunters specialise in particular sectors, providing valuable insights into market dynamics and candidate qualifications.

Conclusion

Although headhunting can be costly and time-consuming, it is one of the most effective ways of finding good candidates for top jobs. Executive headhunters face several challenges maintaining the g discreetness while getting in touch with prospective clients. As organizations navigate increasingly competitive markets, understanding the nuances of headhunting becomes vital for effective recruitment strategies. To keep up with the technological advancements, it is better to optimise your hiring process by employing online recruitment software like HackerEarth, which enables companies to conduct multiple interviews and evaluation tests online, thus improving candidate experience. By collaborating with skilled headhunters who possess industry expertise and insights into market trends, companies can enhance their chances of securing high-caliber professionals who drive success in their respective fields.

View all