Page 141 - AIH-1-2
P. 141

Artificial Intelligence in Health                                    Movement detection with sensors and AI



            the infant mannequin was initially positioned in the   the training environment and creates a transformation
            supine position and then rolled approximately 90 degrees   pipeline. It requires two mandatory parameters, “data”
            to the left side and back to the original supine position,   and  “target,”  and  offers  several  optional  parameters  for
            a procedure repeated 100  times. Similarly, the same   customization. The user provides the data in a cohesive
            procedure was performed for rolling to the right side.   fashion with the target labeled appropriately, typically in
            Data regarding falling off the bed from the left side were   comma-separated values file (CSV) format. Since this is
            collected by initially positioning the infant mannequin   a classification model, the target is a categorical variable
            in the supine position and subsequently rolling it beyond   represented numerically (i.e., “Roll right” is 0, “Roll left” is
            its left side until it fell off the bed, a procedure repeated   1, “Drop right” is 2, “Drop left” is 3, “Breathing” is 4, and
            100  times.  Given  the  near-identical  nature  of  dropping   “Seizure” is 5). The code base for the Google Colaboratory
            the mannequin from its right side, this movement was not   notebook is available at: Sensor_Classification.ipynb.
            performed.                                           Once the setup is executed successfully, it displays an

            2.2. Data preprocessing                            information grid with experiment-level details (Table 1).
                                                               The session ID is a pseudo-random number (123 in this
            The raw dataset for each respective movement, collected   case) used as a seed for reproducibility in all functions
            by  the  sensors,  was  immediately  gathered  following  the   throughout the PyCaret pipeline, ensuring consistent
            completion of repeated movements. These datasets were   results when running the same code with the same session
            divided into six specific movements of interest, each   ID. The target refers to the column in the dataset (the
            ranging from approximately 18,000 to 35,000 data points   CSV file) that will be predicted. In this case, the target is
            containing the Euler angle points in the X-, Y-, and Z-axes.   designated “Predict.” The target type specifies the nature
            Of particular interest were the Euler angle points along the   of the target variable, which in this case is “Multiclass,”
            X-axes exclusively. To isolate the data for each movement,   indicating that the target variable has multiple distinct
            the raw dataset needed to be subdivided to capture data   classes  for multiclass  classification. The  original  data
            for every 100 movements. Approximately 200 data points   shape shows the dimensions of the dataset before any
            were needed to represent one complete movement. For   transformations, with 579 rows and 203 columns.
            example, the information of one complete roll to the left   Similarly, the transformed data shape also has 579 rows and
            side consists of 200 points, capturing the transition from   203 columns, indicating that the dataset was not modified
            the starting supine position to rolling the mannequin to   during the setup process. The transformed training set
            its left side and back to the starting supine position. This   shape indicates that the training dataset contains 405 rows
            collection  of  200  points  was  repeated  to  ensure  a  clear   and 203 columns after preprocessing, which was used to
            delineation of values for each of the 100 movements. This   train the machine learning models. The transformed test
            data  segmentation  process  was  similarly  applied  to  the   set shape indicates that the test dataset contains 174 rows
            other movements of interest. To mimic the mannequin   and 203 columns after preprocessing, which was used to
            dropping  from  the  right  side,  the  values  obtained from   evaluate the performance of the trained models. Therefore,
            dropping the mannequin from the left side were negated.   a split of 70% for training and 30% for testing was used.
            Once the data for each completed movement were
            collected, it was transferred to one single Excel sheet for   Table 1. Experiment setup details
            further analysis. From the raw datasets, 100 movements   No.   Description                Value
            were collected for each roll to the right side, roll to the left   0  Session ID          123
            side, and seizures. Ninety-five movements were collected   1   Target                     Predict
            for each dropping off the bed from the left and right sides,
            while 89 movements were collected for breathing.   2           Target type                Multiclass
                                                               3           Original data shape        (579, 203)
            2.3. Pycaret setup                                 4           Transformed data shape     (579, 203)
            The classification module in PyCaret is a supervised   5       Transformed train set shape  (405, 203)
            machine learning module designed for classifying elements   6  Transformed test set shape  (174, 203)
            and aiming to predict categorical class labels that are discrete   7  Numeric features    202
            and unordered. It can handle both binary and multiclass   8    Preprocess                 True
            problems, finding applications in various scenarios. The   9   Imputation type            Simple
            typical workflow in PyCaret for classification consists of
            five  steps:  setup,  compare  models,  analyze  model,  save   10  Numeric imputation    Mean
            model,  and  prediction.  The  first  step,  “Setup,”  initializes   11  Categorical imputation  Mode


            Volume 1 Issue 2 (2024)                        135                               doi: 10.36922/aih.2790
   136   137   138   139   140   141   142   143   144   145   146