Sleep Tech Evolved: The Impact of Analysis Systems in Mattresses on Personalized Sleep Health



2022 – present



scikit learn icon
spark icon

About the Client

Our client is a successful company specializing in the production of quality mattresses, pillows, and other sleep accessories. Their service helps people take better care of their health, improve sleep and maintain body comfort.

Business Context

Data Scientists of Amazinum joined our client’s team to implement Machine Learning algorithms in the early stages of developing innovative mattresses.

The model, based on certain factors, such as pressure on the surface, was supposed to detect whether there is a person on the mattress or not. This is the first and most important stage because only after it can all further metrics work, such as a person’s sleep duration, sleep quality, heart rate, etc.

Challenges for the Amazinum Team

The client provided Amazinum Data Scientists with all data and models about mattress pressure sensors. One of them was already in production, the other was developed in a draft. Thus, our work consisted in finalizing the draft model and bringing it to production, and developing a new one.

Among the difficulties faced by our team were the following:

  • Availability of unbalanced data. That is an uneven distribution of classes in the data set. This leads to a change in the model itself and the correlation between features.
  • Lack of memory, due to large volumes of data that the model could not process.
  • Insufficient accuracy of production models and complex computation of the draft model.
sleep tech graph

Data Science in Action: Improvement of the Draft Model

Our data scientists faced several tasks to improve the draft model and introduce it into production:

  • Fix overfitting;
  • Improve data processing so we can train the model on all datasets;
  • Tuning layers and their parameters;
  • Tuning the model to improve its speed;
  • Fix the problem of lack of memory.

Amazinum solution

  • Our programmers overcame the problem with unbalanced data using class_weight and Undersampling. Class_weight helps fit the model by defining each class label (eg. 0 and 1) and weights. As for Undersampling, it managed to balance imbalanced data sets and keep all data in a smaller class. This made it possible to reduce the main class and remove light data.
  • To combat overfitting, that is machine learning behavior that makes accurate predictions for training data but fails for new ones. Our data scientists used Class_weight, L1, L2 Regularization, and Dropout. L1L2 Regularization methods allow working with a large set of functions.
  • Data processing was performed using PySpark. Thus, the model processes the data only at the second it needs to be processed.
  • The model was trained using the Tensorflow Records.
  • Amazinum Data Scientists used the Keras Tuner for tuning the Data model. It selects parameters and layers.

Data Science in Action: Development of the XGBoost model

Because the production model had problems with accuracy, and the draft model remained difficult in terms of calculations, it was necessary to develop a more universal option. Our Data Scientists settled on the XGBoost model. It could give the same result as the previous ones while spending fewer resources and being more convenient.

To begin with, we needed to pick up data on which the model could work and make predictions. The difficulty was that the data we used was Time Series.

Therefore, the Amazinum Data Scientists company came up with a solution to deal with this problem:

It was necessary to share the data on a window-by-window basis – that is, data for every second; That is, from 5 lines, we derive the average and get a feature line of the data made.

Amazinum programmers have developed several features that can show historical changes. For example, we received information about major horse races, the duration of these races, and the breaks between them. Functions that a person could adjust independently were also implemented – for example, pressure.

The next stage was the tuning of the model. In this case, we used the same solutions as in the draft model. Our Data Scientists team provided the optimal configuration for a specific data set. This made it possible to build ideal hyperparameters and their settings.

As for overfitting, here the Data Scientists of Amazinum worked according to the same scenario – they used Class_weight, L1, L2 Regularization, and Dropout.


Through the introduction of machine learning algorithms and data analysis, final users are able to regulate their sleep and monitor their general state of health. Sensors implemented in the mattress analyze data on pressure, temperature, or accelerometer sensors. The model is trained on these data, which determines the stages, breathing, heart rate, and other parameters related to sleep.

That is, using smart mattresses, final users can:

  • Improve sleep quality and general health;
  • Monitor body indicators that have a direct impact on a person’s sleep and well-being;
  • Receive personalized sleep recommendations;
  • Fix problems with falling asleep by adjusting the necessary parameters;
  • Prevent the occurrence and development of sleep disorders.

Vitaliy Fedorovych

CEO, Data Scientist at Amazinum

Vitaliy Fedorovych contact us photo

Hello there!

Amazinum Team assists you through all data science development processes:
from data collection to valuable insights generation.
Get in touch with our CEO and Data Scientist to figure out the next move together

Contact Us

Click or drag a file to this area to upload.

This will close in 0 seconds

Book a FREE consultation today and get

a 10% discount on your next project

You will receive:

  • A qualified specialist with experience in your field
  • High-quality and fast solution for your business
  • Convenient models of cooperation from POC to a full-fledged project

Leave your email and we will contact you

No limits to solutions with Amazinum