Solar X-ray flares often drive coronal mass ejections and solar energetic particles (SEPs), which are key elements of space weather near the Earth and beyond. Machine learning with capability to improve space weather forecasting, prevents the adverse consequences of the space weather phenomena. We study temporal parameters of the solar X-ray flares associated with the SEP events. The temporal profile of the X-ray flare is usually divided into rising and decaying phases each approximated by a single functional representation. We observe a more complex nature of the rising and decaying phase for number of X-ray flares, which includes a pre-flare increase of intensity and a break in the decay phase. We develop a method to define, derive, and provide an optimized set of X-ray flare temporal profile parameters which takes into account the complex nature of the flare. We create a set of X-ray flare temporal properties which we next apply to the machine learning algorithms for a better forecasting of X-ray flare evolution in time and the associated SEP events.