The ruin probability is used to determine the overall operating risk of an insurance company. Modeling risks through the characteristics of the historical data of an insurance business, such as premium income, dividends and reinvestments, can usually produce an integral differential equation that is satisfied by the ruin probability. However, the distribution function of the claim inter-arrival times is more complicated, which makes it difficult to find an analytical solution of the ruin probability. Therefore, based on the principles of artificial intelligence and machine learning, we propose a novel numerical method for solving the ruin probability equation. The initial asset u is used as the input vector and the ruin probability as the only output. A trigonometric exponential function is proposed as the projection mapping in the hidden layer, then a block trigonometric exponential neural network (BTENN) model with a symmetrical structure is established. Trial solution is set to meet the initial value condition, simultaneously, connection weights are optimized by solving a linear system using the extreme learning machine (ELM) algorithm. Three numerical experiments were carried out by Python. The results show that the BTENN model can obtain the approximate solution of the ruin probability under the classical risk model and the Erlang(2) risk model at any time point. Comparing with existing methods such as Legendre neural networks (LNN) and trigonometric neural networks (TNN), the proposed BTENN model has a higher stability and lower deviation, which proves that it is feasible and superior to use a BTENN model to estimate the ruin probability.