Research Methodology and Innovation in Mechatronics

Chapter 9
AI, Machine Learning, and Research Analytics

Bachelor Program in Mechatronics Engineering
Research Methodology and Innovation in Mechatronics   •   Bachelor

AI, Machine Learning, and Research Analytics

Introduction

Mechatronic systems generate data continuously through sensors, controllers, actuators, communication networks, maintenance records, and operator interactions. Artificial intelligence (AI) and machine learning (ML) provide methods for converting these data into predictions, classifications, anomaly alerts, and design knowledge. In research, however, an ML model is not automatically a scientific result. A useful study must define a question, acquire representative data, prevent leakage, validate performance, quantify uncertainty, and explain how the result supports an engineering decision.

For a mechatronics engineer, the central issue is therefore not simply selecting an algorithm. It is designing a defensible workflow that connects physical behaviour, data quality, statistical inference, model performance, and safe deployment.

Learning objectives

By the end of this chapter, the reader should be able to:

  1. Distinguish supervised, unsupervised, semi-supervised, and reinforcement learning in mechatronics applications.
  2. Construct meaningful features from time-series sensor data while respecting physical context and causality.
  3. Design leakage-resistant training, validation, and test procedures.
  4. Select and interpret suitable regression, classification, anomaly-detection, and predictive-maintenance metrics.
  5. Explain model predictions using global and local explainability methods.
  6. Assess bias, uncertainty, robustness, and operational risk.
  7. Develop a responsible workflow for using generative AI in engineering research.

1. AI and machine learning in the mechatronics context

AI is the broad field concerned with systems performing tasks that normally require aspects of human intelligence, such as perception, reasoning, planning, and language use. ML is a family of AI methods in which a model learns relationships from data rather than being specified entirely by hand-coded rules.

A mechatronic ML problem can be represented by observations xi and targets yi. A model f_θ uses parameters θ to produce a prediction:

ŷi = f_θ(xi)

Here, ŷi is the predicted target. In supervised learning, model parameters are selected by minimizing a loss over training data:

θ* = arg min_θ (1/n) ∑i=1n L(yi, f_θ(xi))

where n is the number of training observations and L is a loss function. This expression is a training objective, not a guarantee of good real-world performance. Generalization must be evaluated on data not used to fit the model.

Typical mechatronics tasks include:

TaskOutputExample
RegressionContinuous valuePredict bearing temperature
ClassificationDiscrete classIdentify normal, misalignment, or imbalance
ForecastingFuture value or sequencePredict motor current 10 s ahead
Anomaly detectionAbnormality score or labelDetect an unusual vibration pattern
ClusteringGroups without labelsDiscover operating modes
Control or optimizationAction or policySelect an energy-efficient trajectory

Supervised learning requires labelled examples. Unsupervised learning searches for structure without target labels. Semi-supervised learning combines a small labelled set with a larger unlabelled set. Reinforcement learning learns actions from interaction and reward; it is potentially useful for adaptive control but requires especially careful safety constraints.

2. From engineering question to analytical dataset

A credible study begins with a question stated in engineering terms. “Can AI detect faults?” is too broad. A stronger question is: “Can vibration and motor-current measurements identify coupling misalignment at least 30 minutes before a maintenance threshold is reached, under the operating speeds expected in service?” The second question specifies the phenomenon, prediction horizon, inputs, operating conditions, and practical objective.

2.1 Data provenance and experimental design

Record sensor identity, calibration status, sampling rate, units, timestamp convention, firmware, machine configuration, environmental conditions, maintenance events, and labelling procedure. A data dictionary should define every variable and its allowable range.

Data should represent the deployment population. If a model is trained only on a laboratory motor at one speed, its apparent accuracy may not transfer to a variable-speed industrial drive. Design experiments to cover relevant loads, speeds, temperatures, fault severities, and transitions. Where destructive or unsafe faults are impractical, use validated test rigs or simulation, but state the difference between simulated and field data.

2.2 Time alignment and windowing

Sensors often have different clocks and sampling rates. Alignment errors can create false relationships. A signal may be divided into windows of duration Tw with overlap To. For sampling frequency fs, a non-overlapping window contains:

Nw = fs Tw

samples, provided Tw is expressed in seconds and fs in hertz. Windowing should reflect the physical dynamics. A window that is too short may miss a fault signature; one that is too long may mix operating states.

Overlapping windows increase the number of records, but adjacent windows are not independent. Randomly assigning overlapping windows from the same run to both training and test sets causes leakage and overly optimistic results. Split by experiment, machine, production batch, or time period, depending on the intended deployment.

3. Feature engineering for mechatronic signals

Feature engineering transforms raw measurements into variables that expose physically meaningful patterns. It should combine domain knowledge with statistical exploration, rather than indiscriminately generating hundreds of features.

For a signal x1, x2, …, xN, common time-domain features include the mean:

μ = (1/N) ∑k=1N xk

and root-mean-square (RMS) value:

xRMS = √[(1/N) ∑k=1N xk2]

The mean has the same units as the signal. RMS also has the same units and represents signal magnitude; for a zero-mean signal it is related to signal power. The sample standard deviation is:

s = √[(1/(N−1)) ∑k=1N(xk − x̄)2]

where x̄ is the sample mean. The denominator N−1 is appropriate when estimating population variance from a sample under common independent-sampling assumptions. It is not a correction that makes correlated time-series data independent.

Other useful features include peak value, peak-to-peak range, crest factor, kurtosis, zero-crossing rate, and trend slope. Crest factor is commonly defined as:

C = |x|peak / xRMS

It is dimensionless, provided numerator and denominator refer to the same signal and window. Its interpretation depends on preprocessing and noise.

Frequency-domain features can be obtained from a discrete Fourier transform (DFT). A frequency resolution is approximately:

∆f = fs/N

for a record of N equally spaced samples, subject to windowing and spectral-estimation assumptions. Dominant frequency, band power, spectral centroid, and sideband amplitudes can reveal imbalance, gear-mesh effects, or bearing defects. The chosen frequency bands must be physically justified and must account for rotational speed; a fixed band may be inappropriate when speed varies.

Time-frequency methods, such as short-time Fourier transforms and wavelets, are valuable for transients. Sensor fusion may combine vibration, current, temperature, position, and control error. Features should be scaled when required by the algorithm. Standardization uses training-set statistics only:

z = (x − μtrain)/σtrain

The same μtrain and σtrain must be applied to validation, test, and deployment data. Computing them using all data leaks information from the test set.

Feature selection should consider redundancy, stability, interpretability, computational cost, and causal availability. A feature calculated from a future maintenance record cannot be used for an online prediction, even if it improves test accuracy.

4. Model families and selection

Linear regression is a useful baseline for continuous targets:

y = β0 + β1x1 + … + βpxp + ε

It is interpretable and often valuable for detecting whether a more complex model genuinely adds predictive value. Decision trees partition feature space; random forests average many trees and usually provide robust tabular performance. Gradient-boosted trees build models sequentially to reduce residual error. Support-vector machines can be effective in moderate-dimensional spaces. Neural networks are powerful for images, raw waveforms, and complex sequences, but generally require careful tuning, adequate data, and stronger governance.

Model choice should follow the data and decision, not fashion. A simple model may be preferable when the sample is small, the cost of false alarms is high, the explanation must be auditable, or the relationship is already well understood. A physics-informed or hybrid model can combine conservation laws, nominal dynamic models, and learned residuals. Such approaches can improve extrapolation and reduce the data required, but they do not eliminate the need for validation.

5. Validation and performance measurement

A defensible workflow separates training, validation, and test data. The training set estimates parameters; the validation set supports model and hyperparameter selection; the test set provides a final estimate of performance. If data are limited, nested cross-validation can separate tuning from performance estimation. For time-dependent data, use chronological or blocked splits. For multiple machines, use machine-level splits when generalization to unseen machines is claimed.

5.1 Regression metrics

For errors ei = yi − ŷi, mean absolute error (MAE) is:

MAE = (1/n) ∑i=1n |ei|

and root mean squared error (RMSE) is:

RMSE = √[(1/n) ∑i=1n ei2]

Both have the units of the target. RMSE gives greater influence to large errors. Mean absolute percentage error can be misleading when actual values are zero or close to zero, so it should not be used without checking its assumptions.

5.2 Classification metrics

For binary classification, a confusion matrix contains true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN). Accuracy is:

Accuracy = (TP + TN)/(TP + TN + FP + FN)

Precision and recall are:

Precision = TP/(TP + FP)
Recall = TP/(TP + FN)

Precision answers, “When the model raises an alarm, how often is it correct?” Recall answers, “Of actual faults, how many are detected?” In predictive maintenance, missing a dangerous fault may be much more costly than generating an inspection alert; therefore recall, precision, expected cost, and detection lead time should be considered together. Class imbalance makes accuracy particularly unreliable. Precision–recall curves may be more informative than accuracy alone.

5.3 Calibration and uncertainty

A classifier that reports 0.8 probability should be correct approximately 80% of the time for comparable cases if it is well calibrated. Calibration can be examined with reliability diagrams and quantified using metrics such as the Brier score:

Brier = (1/n) ∑i=1n(pi − yi)2

where pi is predicted probability and yi is a binary outcome coded 0 or 1. Predictive intervals, bootstrap variation, ensembles, or conformal methods can communicate uncertainty. Uncertainty estimates should be tested under distribution shift; confidence generated from a model trained on narrow laboratory data does not guarantee field reliability.

6. Anomaly detection and predictive maintenance

Anomaly detection is appropriate when abnormal labels are scarce. A model learns normal behaviour and assigns an anomaly score. In an autoencoder, an input vector x is compressed and reconstructed as x̂. A common reconstruction error is:

r(x) = (1/d) ∑j=1d(xj − x̂j)2

where d is the number of input variables. A threshold may be selected from a clean validation set, for example a high empirical quantile, but the threshold must be linked to false-alarm tolerance and operating conditions. An autoencoder can flag sensor drift, a new operating regime, or a fault; it does not by itself identify the cause.

Predictive maintenance estimates failure risk, remaining useful life (RUL), or time to an intervention threshold. A useful study must define the failure event, censoring policy, prediction horizon, maintenance policy, and cost of false alarms. Randomly splitting windows from the same degradation trajectory can leak future information. Evaluation should include lead time, missed failures, unnecessary interventions, and performance across machines.

A practical architecture combines a physics-based monitoring layer, data-quality checks, an ML predictor, an alert-management layer, and human maintenance review. The ML output should not directly command a hazardous actuator without an independent safety mechanism.

7. Explainability, bias, and robustness

Explainability concerns how a model’s behaviour can be understood and challenged. Global explanations describe average relationships, such as feature importance or partial-dependence patterns. Local explanations describe an individual prediction, using methods such as local perturbation or Shapley-value approximations. Explanations are diagnostic tools, not proof of causation. Correlated variables can share or distort importance, and an explanation method can itself be unstable.

Use explanation checks such as:

  • Does the model rely on physically plausible variables?
  • Does importance change drastically under small perturbations?
  • Are explanations consistent across machines and operating regimes?
  • Does removing a suspected shortcut reduce performance as expected?
  • Does the explanation distinguish a causal mechanism from a proxy, such as machine identity?

Bias can arise from unrepresentative machines, unequal sensor quality, missing fault types, labelling differences, or maintenance practices. In an engineering setting, “groups” may include machine models, sites, speeds, loads, environments, or suppliers rather than only demographic categories. Compare error rates and calibration across relevant groups. A model that performs well on average may be unsafe for a low-frequency but high-consequence operating regime.

Robustness testing should include sensor noise, missing channels, calibration shifts, changed loads, unseen machines, communication delays, adversarial or accidental perturbations, and out-of-distribution inputs. Report the conditions under which the model is not intended to operate.

8. Responsible use of generative AI in research

Generative AI systems can assist with brainstorming, code scaffolding, documentation, translation, literature-query formulation, and synthetic examples. They can also produce fabricated references, incorrect equations, insecure code, biased summaries, and plausible but false explanations. Consequently, generated content is an assistant output, not research evidence.

A responsible workflow includes:

  1. Define what the tool is permitted to do and prohibit confidential or personally identifiable data unless approved safeguards exist.
  2. Keep a record of prompts, model version, date, generated outputs, and human edits when the use is material to the research.
  3. Verify every technical claim against primary sources, laboratory tests, executable code, or independent calculations.
  4. Inspect generated code for data leakage, unsafe defaults, licensing issues, and numerical errors.
  5. Disclose substantive use according to institutional and publisher policies.
  6. Preserve human responsibility for experimental design, interpretation, authorship, safety, and final decisions.

Generative AI must not be presented as a cited authority, a substitute for peer review, or evidence that an experiment was performed. Synthetic data may support software testing or privacy-preserving development, but it should not be treated as equivalent to field data without validation of its distribution and failure modes.

9. Illustrative case: vibration-based gearbox monitoring

Background

A manufacturer operates a fleet of variable-speed gearboxes. Accelerometers, shaft-speed sensors, motor current, and oil temperature are sampled during production. Maintenance records identify confirmed tooth damage, but most historical windows are labelled only as normal operation.

Problem

The engineering team wants an early-warning system that detects developing gear damage while limiting unnecessary inspections. A random row-level split initially reports 98% accuracy, but this result is suspected to be optimistic because thousands of overlapping windows came from each gearbox.

Analysis

The team defines one prediction record as a 2-second window and assigns labels using maintenance history. Windows from the same gearbox and maintenance episode are kept in the same partition. Training uses normal data plus confirmed fault episodes; validation uses later episodes from known gearboxes; the final test set contains gearboxes excluded from training.

Features include RMS vibration, crest factor, temperature trend, rotational-speed-normalized spectral sidebands, motor-current harmonics, and recent alarm history available before the prediction time. Standardization parameters are calculated only from training data. A gradient-boosted tree is compared with a logistic-regression baseline and an unsupervised anomaly detector.

Approach and solution

The team evaluates recall, precision, false alarms per operating hour, and median warning lead time. The alert threshold is selected using maintenance capacity and the relative cost of missed damage. SHAP-like local explanations are inspected, but engineers also test physical plausibility by comparing important features with controlled misalignment experiments. A data-quality gate suppresses predictions when the accelerometer is saturated or the speed sensor is unavailable.

Outcome

Performance decreases from the initial 98% accuracy to a lower but credible estimate on unseen gearboxes. The model detects most confirmed damage cases with useful lead time, but performance is weaker at very low speed. The deployment specification therefore limits claims to the validated speed range and requires a periodic review of drift and false alarms.

Learning points

The case demonstrates that leakage control can reduce apparent performance while increasing scientific credibility. It also shows why feature engineering, operating-envelope definition, threshold selection, explanation, and data-quality controls are part of the system—not optional additions after model training.

10. Implementation workflow and professional practice

A robust research workflow is iterative:

Machine learning research workflow for mechatronics Engineeringquestion Data andlabels Features andsplitting Train andvalidate Deploy,monitor Monitor drift, safety, bias, and scientific validity; revise when evidence changes
Machine learning research workflow for mechatronics
Figure: Machine learning research workflow for mechatronics

Figure: An iterative machine-learning research workflow for mechatronics.

For employability, engineers should be able to use version control, reproducible notebooks, unit-tested feature pipelines, experiment tracking, containerized deployment, and clear technical reports. A report should state the data population, exclusions, split strategy, preprocessing, hyperparameters, metrics, uncertainty, limitations, safety controls, and intended operating range. Reproducibility is an engineering quality requirement as well as a research virtue.

Challenges and limitations

ML systems are limited by measurement quality, label uncertainty, distribution shift, small samples, non-stationary machines, rare failures, and changes in maintenance policy. Correlation does not establish mechanism. High-dimensional models can memorize machine identity or test-set artefacts. A model may be accurate but operationally useless if its alerts cannot be acted upon. Computational latency, memory, cybersecurity, energy consumption, and lifecycle maintenance matter in embedded systems.

Governance should address data ownership, privacy, cybersecurity, intellectual property, audit trails, human override, incident reporting, and model retirement. Safety-critical applications require hazard analysis and independent protective functions; an ML prediction should not be treated as a safety guarantee.

Contemporary developments

Current research increasingly combines foundation models, self-supervised learning, digital twins, physics-informed learning, edge inference, federated learning, and uncertainty-aware decision systems. Self-supervised methods can learn representations from large unlabelled sensor streams, while digital twins can generate scenarios that are difficult to observe in operation. These approaches remain sensitive to simulation-to-reality gaps, data governance, computational cost, and validation quality. Their value should be demonstrated against transparent baselines and realistic engineering requirements.

Chapter Summary

AI and ML support regression, classification, anomaly detection, forecasting, and maintenance decisions in mechatronics. Reliable results begin with a precise engineering question, representative and well-documented data, physically informed features, and leakage-resistant splitting. RMS, standard deviation, spectral resolution, MAE, RMSE, precision, recall, and calibration metrics must be interpreted with their assumptions and units. Predictive maintenance requires attention to operating conditions, failure definitions, warning lead time, and intervention cost. Explainability helps diagnose models but does not prove causation. Bias, uncertainty, robustness, safety, cybersecurity, and distribution shift must be assessed before deployment. Generative AI can assist research activities, but all substantive outputs require human verification, documentation, and responsible governance.

Key Terms

Artificial intelligence: The broad field of systems performing tasks involving perception, reasoning, learning, or decision-making.

Machine learning: Methods that estimate patterns or relationships from data.

Feature engineering: Construction or transformation of variables that represent useful signal characteristics.

Data leakage: Use of information during training that would not be available at prediction time.

Supervised learning: Learning from examples paired with target labels.

Unsupervised learning: Learning structure without target labels.

Anomaly detection: Identification of observations that differ from learned normal behaviour.

Predictive maintenance: Use of condition or risk predictions to plan maintenance.

RMS: Root-mean-square signal magnitude over a defined sample or window.

Crest factor: Peak magnitude divided by RMS magnitude.

Confusion matrix: Table of true and false positive and negative classifications.

Precision: Fraction of positive predictions that are correct.

Recall: Fraction of actual positive cases that are detected.

Calibration: Agreement between predicted probabilities and observed frequencies.

Explainability: Methods for understanding model behaviour or individual predictions.

Distribution shift: Change between training data and deployment data.

Concept drift: Change over time in the relationship between inputs and target.

Remaining useful life: Estimated time until a defined failure or maintenance threshold.

Generative AI: AI that produces new text, code, images, or other content.

Data provenance: Record of a dataset’s origin, processing, and transformations.

Review Questions

Short Answer Questions

  1. Distinguish supervised learning from unsupervised learning and give one mechatronics example of each.
  2. Why can random splitting of overlapping time windows produce data leakage?
  3. State the difference between precision and recall.
  4. What information does RMS provide about a sensor signal?
  5. Why is human verification required when generative AI is used in engineering research?

Long Answer Questions

  1. Describe a complete workflow for developing a vibration-based fault classifier, from problem definition to deployment monitoring.
  2. Explain how feature engineering can combine time-domain, frequency-domain, and physical operating information.
  3. Compare linear regression, tree ensembles, and neural networks for a mechatronics prediction problem.
  4. Discuss how bias, uncertainty, and distribution shift can affect predictive-maintenance decisions.
  5. Explain why explainability is useful but cannot by itself establish causation.

Analytical / Application Questions

  1. A classifier detects 45 of 50 actual faults and raises 60 alarms, of which 15 are false. Calculate recall and precision, and explain which additional operational metric should be reported.
  2. Design a validation strategy for a dataset containing 20 machines, each with thousands of overlapping sensor windows, when the intended deployment is on new machines.
  3. Propose a responsible generative-AI policy for a university mechatronics research laboratory, including data protection, verification, disclosure, and code-safety requirements.

Multiple Choice Questions with Answers

Question 1

Which practice most directly prevents leakage when using overlapping time-series windows?

A. Randomly shuffle every window before splitting

B. Split data by machine or experimental run before creating independent evaluation sets

C. Increase the number of overlapping windows

D. Use a more complex neural network

Correct Answer: B. Split data by machine or experimental run before creating independent evaluation sets

Question 2

Which metric answers the question: of all actual faults, what fraction did the model detect?

A. Precision

B. Accuracy

C. Recall

D. Specificity

Correct Answer: C. Recall

Question 3

A signal has samples 1, 2, 3, and 4 V. What is its RMS value?

A. 2.00 V

B. 2.50 V

C. 3.00 V

D. √7.5 V ≈ 2.74 V

Correct Answer: D. √7.5 V ≈ 2.74 V

Question 4

Why should standardization parameters normally be calculated using training data only?

A. To increase the physical units of the features

B. To prevent information from evaluation data entering model development

C. To guarantee perfect classification

D. To remove all sensor noise

Correct Answer: B. To prevent information from evaluation data entering model development

Question 5

Which statement about an autoencoder-based anomaly detector is correct?

A. A high reconstruction error can indicate behaviour unlike the learned normal data

B. It automatically identifies the physical cause of every anomaly

C. It requires every possible fault to be labelled

D. It is unaffected by changes in operating conditions

Correct Answer: A. A high reconstruction error can indicate behaviour unlike the learned normal data

Question 6

What is a principal limitation of accuracy for highly imbalanced fault data?

A. Accuracy has units of volts

B. Accuracy can appear high even when rare faults are missed

C. Accuracy cannot be calculated from a confusion matrix

D. Accuracy measures only calibration

Correct Answer: B. Accuracy can appear high even when rare faults are missed

Question 7

Which is an appropriate interpretation of a local explanation?

A. It proves that the most important feature caused the outcome

B. It describes factors associated with a particular prediction

C. It guarantees performance on unseen machines

D. It replaces independent validation

Correct Answer: B. It describes factors associated with a particular prediction

Question 8

Which split is most appropriate when claiming generalization to unseen machines?

A. Place windows from every machine in all partitions

B. Split individual samples randomly regardless of machine

C. Keep complete machines out of training for final evaluation

D. Use only the first sensor channel

Correct Answer: C. Keep complete machines out of training for final evaluation

Question 9

What should an engineer do with a technically plausible equation generated by a generative-AI tool?

A. Publish it without checking because the output is fluent

B. Verify it independently and document substantive use

C. Treat the tool as the primary scientific authority

D. Use it only if it contains no variables

Correct Answer: B. Verify it independently and document substantive use

Question 10

Which design best supports safe deployment of an ML maintenance system?

A. Allow the model to bypass all protective controls

B. Use the model as the only safety mechanism

C. Combine model monitoring with data-quality checks, human review, and independent safety functions

D. Disable monitoring after deployment

Correct Answer: C. Combine model monitoring with data-quality checks, human review, and independent safety functions

Research Methodology and Innovation in Mechatronics
Chapter 9 of 15