{'fraction_non_alphanumeric': 0.04044746654968195, 'fraction_numerical': 0.01188857205527528, 'mean_word_length': 4.486401925391095, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Machine-learning-assisted construction of appropriate rotating frame

Machine learning with neural networks is now becoming a more and more powerful tool for various tasks, such as natural language processing, image recognition, winning the game, and even for the issues of physics. Although there are many studies on the application of machine learning to numerical calculation and the assistance of experimental detection, the methods of applying machine learning to find the analytical method are poorly studied. In this letter, we propose methods to use machine learning to find the analytical methods. We demonstrate that the recurrent neural networks can ``derive'' the Floquet-Magnus expansion just by inputting the time-periodic Hamiltonian to the neural networks, and derive the appropriate rotating frame in the periodically-driven system. We also argue that this method is also applicable to finding other theoretical frameworks in other systems.

Machine learning with neural networks is now becoming a more and more powerful tool for various tasks, such as natural language processing, image recognition, winning the game, and even for the issues of physics. Although there are many studies on the application of machine learning to numerical calculation and the assistance of experimental detection, the methods of applying machine learning to find the analytical method are poorly studied. In this letter, we propose methods to use machine learning to find the analytical methods. We demonstrate that the recurrent neural networks can "derive" the Floquet-Magnus expansion just by inputting the time-periodic Hamiltonian to the neural networks, and derive the appropriate rotating frame in the periodically-driven system. We also argue that this method is also applicable to finding other theoretical frameworks in other systems.
Introduction. -Machine learning with neural networks (NN) is now becoming a powerful tool for various tasks, such as natural language processing [1], image recognition [2][3][4], and winning the game [5]. As for the issues of physics, machine learning can be used for phase detection [6][7][8][9][10][11], solving the equilibrium state [12][13][14] or steady state [15], materials informatics [16][17][18][19] and noise reduction of the experimental measurement results [20]. While experimental detection and numerical calculation with the aid of machine learning are now making great progress, one might have a natural question: Can we develop theoretical analysis methods with the aid of machine learning?
Before tackling this question, let us consider how we ourselves have developed the theoretical analysis methods so far. One of the central techniques is scale separation, which leads to the reduction and the perturbation theory. A typical example is a derivation of the Langevin equation, in which, by utilizing the time-scale separation between the microparticles' motion and the Brownian particles' motion, we perform the reduction of the degrees of freedom of the microparticles and get the stochastic equation of motion. [21] Other examples are the dimensional reduction of nonlinear dynamical systems [22], the derivation of the Heisenberg model from the Hubbard model in half-filling and large interaction limit [23], the renormalization group methods [24], and so on. However, in general, it is a non-trivial problem to find and separate the fast process and the slow process of the system, and we have to perform an appropriate unitary transformation or projection and get the frame in which the scale separation is apparent. [25][26][27][28][29][30][31][32] For example, in periodically-driven systems, we introduce an appropriate rotating frame (RF) associated with the time-periodic unitary transformation and separate fast and slow modes. It is known that, under highfrequency driving where the frequency is larger enough than the energy scale of the system, the system stays the Floquet prethermalized before going to the infinite temperature state [33][34][35], and we can engineer the desired state in the Floquet prethermalized state. [36][37][38][39][40][41][42][43] In the high-frequency regime, we can construct an appropriate RF with high-frequency expansion. [44] In such an appropriate RF, the effective static Hamiltonian describes the Floquet prethermalized state, and the dressed driving term describes the heating rate. [44,45] Therefore, finding an appropriate unitary transformation or projection and a scale separation is highly beneficial, while it is usually difficult.
In this letter, we try to utilize machine learning for searching the appropriate unitary transformation because machine learning has the possibility of finding the "implicit" scale separation, which is difficult for the human to find, and giving us the helpful frame by the appropriate unitary transformation where we can easily analyze the physical properties. As a first step, in this letter, we check whether machine learning can derive the appropriate rotating frame when there is an apparent scale separation. As concrete systems, we focus on a periodically-driven system under high-frequency driving and its appropriate rotating frame.
We first show the concrete procedure to construct the RF in periodically-driven systems with the aid of machine learning and demonstrate it for a simple model. Then, we argue how we can generalize the above procedure to derive an appropriate unitary transformation under which we can easily solve the issues of physics. Our results show that machine learning is a powerful tool also in exploring theoretical analysis methods.
Concrete procedure to construct the rotating frame with the aid of machine learning. -The procedures to derive the RF are summarized in Figure. 1, and it can be divided into two steps. Below, we first review the Floquet theory and the RF shortly, and then explain each step.
We consider the time-dependent Hamiltonian aŝ whereĤ 0 is the system Hamiltonian without the driving andV (t) is the driving term which depends on time.
where we callĤ r (t) as the dressed Hamiltonian, which describes the dynamics of |ψ(t) from the reference frame ofÛ (t). When we focus on the periodically-driven systems, whereĤ(t) =Ĥ(t + T ) andV (t) =V (t + T ) are satisfied, it is known that there is the periodic timedependent unitary transformationÛ F (t) =Û F (t + T ), which make the dressed Hamiltonian time-independent, that is,Ĥ r (t) =Ĥ F . We callĤ F Floquet Hamiltonian, |ψ(t) =Û F (t) |ψ(t) , whose dynamics is described by the Floquet Hamiltonian, the exact rotating frame, and K(t) the micromotion operator or the kick operator. In the high-frequency regime, we can construct this exact rotating frame perturbatively with high-frequency expansion such as the Floquet-Magnus expansion [33,34] and van-Vleck expansion [36,46]. If we calculate up to the finite order O(1/Ω n ), the dressed Hamiltonian slightly depends on time by O(1/Ω n+1 ). Fortunately, when we calculate the heating rate of the system under the highfrequent driving, it is more beneficial to calculate the high-frequency expansion up to the second or third order [44] and we call this benefitial RF an appropriate RF.
In the following, supposing that the physicists in the world do not know the high-frequency expansion methods and the appropriate RF but want to derive the appropriate time-periodic unitary transformation in which the dressed Hamiltonian slightly depends on time, we "derive" the high-frequency expansion and the appropriate RF with the aid of machine learning.
In the first step (step 1), we numerically derive the RF with the recurrent neural networks (RNN) [47][48][49]. We input the model Hamiltonian H(t) and the kick op-erator K(t), which is calculated by the NN, and get the output as the time derivative of the kick operator K (t). Then, we can calculate the kick operator K(t + δt) = K(t) + K (t)δt and the dressed Hamiltonian We set the boundary condition K(t = 0) = 0; therefore, K(t) is given at t = 0, and we can input it into the NN. We note that, in this letter, we useÔ when it describes the operator form and O when it describes the matrix form numerically. Because we want to get the RF in which the time-dependence of the dressed Hamiltonian is small, we set the loss function at the time step t of learning as, where ||M || = i,j |M ij | 2 and γ is the discount rate which is usually introduced in the reinforcement learning and γ ≤ 1. After that, because we now have the kick operator at the next time step K(t + δt), we repeatedly do the same procedure until the time step reaches t = T , and calculate the total loss function as where N t = T /δt is the total time step, and update the parameters of NN by using the back propagation. The first term in Eq. (7) trains the NN to decrease the time dependence of the dressed Hamiltonian, and the second term in Eq. (7) trains the NN to get the timeperiodicity. [50] Finally, we do the backpropagation to the NN and update the parameters in the NN. We note that the loss function in Eq. (7) is zero as the minimum when the RNN outputs the exact RF. We also note, in our framework, there are two hyper-parameters γ and . The procedure in step 1 is summarized in Figure.2. In step 1, we numerically derive the kick operator K(t) in the matrix form. However, of course, this numerical form cannot be said to be a "theoretical analysis method" because it changes as the parameter or model changes. In step 2, we physicists interpret the results as the operator form. Once we get the kick operator and the RF in the operator form, its construction method does not change if we change the parameters and the model.
Although it is usually challenging to find the operator form from the matrix form, we can get some hints. In the first place, because the width of the input and output layer is limited by the memory of the computers, we have to use the small system, and it is comparably easy to translate the matrix form to the operator form in small systems. Moreover, we can get the numerical results in the different parameters, and therefore, we can find the parameter dependence of each matrix element of the kick operator. It tells us what kind of operator constructs each matrix element. We believe these clues are enough for physicists to construct the kick operator in the operator form and find the construction methods. After deriving the operator form, we can check by hand whether the constructed RF can be applied to other parameters or models. If not, it means we have derived the wrong methods to construct RF, and we collect more clues by calculating in another parameter or another model to find the appropriate RF and its construction method.
Next, using these procedures, we demonstrate that we "derive" the high-frequency expansion method to construct the appropriate RF in a concrete model. model calculation -Here we introduce the concrete model and demonstrate the concrete procedure. For simplicity, we analyze an interacting two-spin model under the periodic driving, which reads, whereŝ i represents the quantum spin operator at site i, h represents a static magnetic fields, J α represents an interaction between the two spins, and ξ represents an AC magnetic fields. For the simplicity, we set h = (0, 0, h z ), J = (J x , 0, J z ), and ξ = (ξ, 0, 0). This Hamiltonian can be described by a 4*4 matrix in the basis as where τ α , σ α is the Pauli matrix about the site index and the spin index. We vectorize and input this matrix into the NN and perform the learning. Next, we show the concrete results of the two-spin model in step 1. We use the NN, in which the size of the input layer and output layer is 20(4 for the parameters ofĤ(t) and 16 forK(t)) and 16 (16 forK (t)). The NN also holds the two hidden layers. We use Adam [51] as the optimization function and set the iteration number of the learning to 4000, and the activation function is tanh. Figure 3 shows the hidden layer width dependence of the learning dynamics. In the single iteration, the NN learns the single cycle of the time-periodic dynamics. In the learning dynamics, the loss function sometimes suddenly increases, and this may stem from the exploding gradient problem in machine learning with an RNN [52,53]. We can see that the narrower hidden layers get more stable learning dynamics. We note that we have calculated some batches and show the best learning dynamics in this letter. We note that the wide hidden layer often makes the learning not converge. (see Supplementary materials (SM) for the details [54].) The wide hidden layer can also output a too complicated kick operator to use or for us to understand in the operator form. Therefore, the narrow hidden layer might be suitable for our proposed procedure. Figure 4 shows that, in the RF derived by the RNN, the time-dependence of the eigenvalues of the dressed Hamiltonian becomes smaller than that of H(t) by an order. 10 * ( ! ⊗ " + " ⊗ ! ) 10 # * ( $ ⊗ % + % ⊗ $ ) 10 # * ( ! ⊗ $ + $ ⊗ ! ) ( , ! , " , h # , Ω) = (0.2, 1.0, 0.7, 0.5,10) (a)  Then, we show the resulting RF, which is derived by the RNN in figure 5(a). We can find three dominant contributions, which are proportional to (i)(τ 0 ⊗σ x +τ x ⊗σ 0 ), (ii)(τ y ⊗ σ z + τ z ⊗ σ y ), and (iii)(τ 0 ⊗ σ y + τ y ⊗ σ 0 ). We also check their dependence on the parameters. From figure 5(b)-(f), we can deduce that each term (i)-(iii) is proportional to ξΩ −1 , ξJ z Ω −2 , and ξh z Ω −2 . We note that the slight deviation from the proportional relationship should stem from the higher order expansions, and we do not focus on them in this letter although we can analyze them. Next, we can deduce the operator form of each term. First, let us consider the first term (i). It is independent of the parameters ofĤ 0 and is proportional to the drive strength, which means it can be described bŷ V (t). Moreover, it seems proportional to (1−cos(Ωt))/Ω, whileV (t) is proportional to sin(Ωt). Therefore, we can deduce its operator form as dt V (t ). [55] Then, we analyze the second term (ii). Because it is proportional to ξJ z , it should be the product ofV (t) and J zŝ z 1ŝ z 2 , and actually (τ y ⊗σ z +τ z ⊗σ y ) = i[(τ 0 ⊗σ x +τ x ⊗σ 0 ), τ z ⊗σ z ]/2. Moreover, because it is proportional to Ω −2 sin(Ωt), it should include the double integration of time. Therefore we can deduce the second term can be written in the operator form as −i dt 1 [56] By performing the same procedure with the other term, we can reach the proposal construction of the kick operator aŝ Finally, we can check whether this construction method can be applied to the other models and conclude that this is the appropriate RF. In fact, this derived method corresponds to the Floquet-Magnus expansion up to the second order.
Interestingly, this RNN treatment gives us the appropriate RF, not the exact RF in which H r (t) is timeindependent, while the loss function defined in Eq. 7 becomes the minimum in the exact RF. (see the SM [54] for how resulting RF is different from the exact RF.) It should stem from the representation capability limit of the NN because the exact RF is usually a highly complex function of the operators. However, this limit of NN is beneficial for physicists because the limited NN should prefer the perturbative or simple RF, and it should be easier for us to interpret and more useful. Therefore, the narrow hidden layers should be better, while they should have enough width to express the perturbative expression of RF. We note that we also tried to derive the appropriate RF in the resonant regime where the energy scale of the system is comparable to the frequency of the driving. Approaching to the resonant regime, the learning dynamics become unstable and the RNN rarely achieve the appropriate RF, and we cannot get the appropriate RF at the resonant regime. These results should imply that, in the resonant regime, there is no simple or perturbative construction methods of the appropriate RF. In this section, we have demonstrated that we can derive the construction methods of the appropriate rotating frame with the aid of the RNN in the high-frequency regime.
Generalization of the procedure to derive the appropriate unitary transformation. -Finally, we argue how the procedure we demonstrate in the previous section can be applied to other general problems. In the previous section, we have defined the loss function to train the NN to give us the RF in which the time dependence of the dressed Hamiltonian is small. This idea can be applied to find other appropriate frames or projections, which make us able to solve the physical problem easily. We can define the loss function as it becomes small in the frame which has desirable properties, and then, after the learning (if the learning works well), NN gives us the desirable frame. As we have demonstrated, we first calculate the appropriate frame or the projection in the matrix form in a small system, analyze the parameter dependence, and then, we physicists should be able to translate the operator form and develop the construction method.
Conclusion. -In this letter, we have proposed the method to construct the appropriate RF with the aid of RNN and demonstrate the concrete process and the re-sults. By defining the loss function as it becomes small when the output RF has the desirable property, which is the smallness of the time dependence of the dressed Hamiltonian, we can get the appropriate RF in the matrix form. In a small system, we can translate the results to the operator form and get the analytical method to construct the appropriate RF. Interestingly, the proposed method gives us the appropriate RF, not the exact RF. This property should stem from the representation capability limit of the NN, and this limit is beneficial for physicists to interpret and utilize the results. We hope our proposed method can be useful in other systems and this work paves a new way to utilize machine learning to develop analytical methods in physics.
Acknowledgements.-YM deeply appriciate Takashi Mori and Kaoru Mizuta for fruitiful discussion and Ken Mochizuki and Shuntaro Sumita for their valuable comments on the manuscript. YM also thanks Irasutoya [57] for allowing me to use the illustration of the physicist in Figure 1. We use Julia [58] and its library Flux.jl [59] for all calculation, and the codes we have used are uploaded in the Github[60]. This work is supported by RIKEN Special Postdoctoral Researcher Program.
Supplemental Materials for "Machine-learning-assisted construction of appropriate rotating frame" S1.

HIDDEN-LAYER-WIDTH DEPENDENCE OF THE LEARNING DYNAMICS
In figure. 3 in the main text, we have shown only successful learning dynamics. In this section, we show the learning dynamics of 5 batches, in which the NN is randomly initialized and the width of the hidden layers is each 2, 4, 8, 16, 64, and 256. Within these five batches, we can see that the learning dynamics are most stable when the width of the hidden layer is 8. As we have noted in the main text, narrow hidden layers are proper for the stable learning dynamics while it rarely get the appropriate RF when it is too narrow. In figure. S2, we also show the resulting kick operator and the dressed Hamiltonian when the learning does not work well. We note that we vectorize a 4*4 Hermitian matrix as (S1) In figure S2, the time-dependence of each element is shown.

S2. DEVIATIONS FROM THE EXACT RESULT.
In this section, we show the difference between the results by the RNN and the exact results in figure S3. We note that we can calculate the exact RF by using the following equation [38]: where T is the periodic time and δt = T /N . The similar equality in Eq. (S2) and Eq. (S3) becomes equality in N → ∞ limit. Eq. S3 can be derived from Eq. (5). In figure S3 shows that the largest deviation seems almost proportional to 1/Ω 3 while it depends on the loss of the RNN results. Therefore, this result implies that the RNN gives us the appropriate RF which is constructed by the Floquet-Magnus expansion up to O(1/Ω 2 ) as we have shown in the main text.

S3. GENERALIZATION PERFORMANCE OF THE RNN FOR THE KICK OPERATOR.
Here, we check the generalization performance of the RNN for the different parameters. We first train the NN at the parameter (ξ, Ω, J z , J x , h z ) = (0.2, 10, 1.0, 0.7, 0.5), and then, by using the trained NN, we calculate the kick operator at other parameters (ξ, Ω, J z , J x , h z ) = (0.2, 10, 1.0, 0.8, 0.5). As figure S4 shows, our RNN does not show the generalization performance. Because we repeatedly input the kick operator calculated by the NN in the RNN framework, a tiny error or difference from the exact Floquet-Magnus expansion of the NN parameters is amplified in each time step, which leads to the bad generalization performance in figure S4.

S4. QUEST FOR THE APPROPRIATE ROTATING FRAME UNDER THE RESONANT DRIVE
In this section, we show the results of the resonant regime calculated by our proposed method. First, we check the learning dynamics and its dependence on the hidden layer width. Figure S5 shows the learning dynamics at Ω = 5.0, w = 8 and Ω = 2.0. We can see that the learning dynamics become unstable and rarely achieve the appropriate RF as the drive approaches resonant, and we could not achieve the appropriate RF with a small loss. Remembering that the RNN can achieve the appropriate RF independent of the initial condition (independent of the batch index) in figure S1, these results should imply that the loss function of the parameter space has a single minimum with gentle gradient when there is a scale separation (the scale separation between Ω and the energy scale of the system), while it has some or many local minima with steep gradient when the scale separation is smeared.
We also show the best of the resulting kick operator and the dressed Hamiltonian in figure S6 and S7. In the middle regime at Ω = 5 in figure S6, the RNN gives us the appropriate RF which can be constructed with the high-frequency expansion (up to 1/Ω 3 ), while its learning dynamics is unstable. In the resonant regime in figure S7, the resulting kick operator seems different from the Floquet-Magnus expansion(see and compare with figure S6), and the resulting dressed Hamiltonian does not get the small time dependence and the time-periodicity. This failure of the quest for the appropriate RF in the resonant regime might imply that there is no "implicit" scale separation and a simple construction of the appropriate RF, or there are many sharp potentials for the training and it is difficult to reach the appropriate RF. The improvements in the RNN framework might lead to the discovery of the appropriate RF in the resonant regime, which is left for future works.