Abstract Recent advances in robotics and artificial intelligence have highlighted the potential for the integration of computational intelligence in enhancing the functionality and adaptability of robotic systems, particularly in rehabilitation. Designing robotic exoskeletons for the lower limb rehabilitation of post-stroke patients requires frequent adjustments to accommodate individual differences in leg anatomy. This complex engineering challenge necessitates a deep understanding of human physiology, robotics, and optimization to develop adaptive robotic systems and also to swiftly quantify the required adjustments and implement them for each patient. The conventional approaches, which mostly rely on heuristics and manual tuning, often struggle to achieve optimal results. This paper presents a novel method that integrates a genetic algorithm (GA) with a deep learning approach to generate a gait trajectory of the ankle joint from a six-bar linkage mechanism of fixed dimensions. Later, using the same approach, the inverse kinematics solution for this mechanism is also devised whereby, the set of the link dimensions of the six-bar linkage mechanism is obtained for the given gait trajectory of an individual to achieve customization. We simulated the kinematic behavior of the six-bar linkage mechanism within defined mechanical constraints and utilized the generated data for training a feedforward neural network and long short-term memory models. The proposed model, when trained, can produce accurate lengths for the desired gait trajectories in the sagittal plane and vice-versa which further validates our proposed approach for inverse kinematics solution.