\section{Introduction}
With the gradual expansion of feature space, it is more and more difficult for people to recognize feature space \citep{R1}. The irrelevant or misleading features will degrade the performance of the classifier. The emergence of feature selection has turned these problems around. To solve these problems, feature selection is used to improve the performance of the classifier by removing the irrelevant and misleading features from original features. \citep{guyon2003an}.

Feature selection is helpful to reduce the dimension of feature space, which can reduce the computational cost, improve the performance of classifier and restrain the occurrence of over fitting. The design of feature selection methods is to select better features that allow the classifier to achieve better performance while reducing the demand on computing resources \citep{R3}.

The filter method and the wrapper method are two main  feature selection motheds \citep{R4}. The former ranks features and selects the best part of features as final feature subset. Mathematical methods are mostly used to measure the relationship between each feature and label. An evaluation value is calculated to each feature, which is used to rank the features \citep{R5}. The wrapper method sorting the feature subsets, the best one is as the final feature subset. The feature subsets are generated by the method and an evaluation value obtained by the classifier  is used to rank the feature subsets \citep{R6}.

The metaheuristic algorithms are proposed for the optimization problems \citep{R7}. A deterministic algorithm can obtain the optimal solution to the optimization problem, while a metaheuristic algorithm is based on an intuitive or empirical construction that can give a feasible solution at an acceptable cost, and the degree of deviation of that feasible solution from the optimal solution may not be predictable in advance \citep{R8}.

The feature selection is essentially a Non-deterministic Polynomial (NP) problem, which is solved by the metaheuristic algorithms \citep{Yusta2009Different}. Metaheuristic algorithms rely on a combination of local and global search to find an optimal solution in a large solution space. The search process requires the use of iteration to approach the optimal solution, and the setting of the parameters in search process has a significant impact. Both advanced algorithms and suitable parameters are needed to achieve a favorable solution.

As mentioned above, a sophisticated design is necessary for the metaheuristic algorithm to balance local and global search. This design trades relative complexity for the validity of the algorithm, and different tasks require individual finding of the suitable parameters. Swarm intelligence algorithms are gradually becoming the main implementation of metaheuristic algorithms such as \citep{R9,Yusta2009Different,R91}.

The main contributions of this paper are summarized as follows:
\begin{enumerate}[1.]

\item Use one-hot encoding to process categorical features and perform feature selection directly from the processed high-dimensional feature space.
\item Propose a novel approach to exploit the outcomes of filter method.
\item Propose a concise method for feature selection.

\end{enumerate}

The rest of this paper is organized as follows: \autoref{S2} reviews the related works. \autoref{S3} introduces two powerful tools used in this paper. \autoref{S4} details the proposed feature selection method. \autoref{S5} discusses the experiments and results. \autoref{S6} concludes this paper.

\section{Related works}
\label{S2}
The features in the dataset are not independent. In the context,it is essential for feature selection to consider the interaction between features. \cite{R6} explored the interaction between features. In this paper, authors investigated the strengths and weaknesses of the wrapper method and provided some improved design solutions. The wrapper method is designed to find the optimal feature subset.During the experimen, performance evaluation is based on some datasets. The experimental results indicate that the proposed algorithm achieves an improvement in accuracy.

With feature selection going from the edge of the stage to the center, \cite{guyon2003an}	provided an introduction of feature selection. In this paper,the following aspects of knowledge are discussed: the definition of the objective function,feature construction, feature ranking, multivariate feature selection, feature validity evaluation method and efficient search methods for better feature subset. Datasets in many areas have thousands of features, which makes feature selection especially useful for two purposes: better the performance of classifier, faster the speed of classifier.

\cite{R10} developed a noval feature selection method to overcome the limitations of MIFS \citep{R11}, MIFS-U \citep{R12},and mRMR \citep{R13}. The model known as NMIFS (normalized mutual information feature selection) is designed to optimize the measure of the relationship between features and labels. NMIFS is a filter method independent of any machine learning model. The purpose of normalization is to reduce the bias of mutual information toward multivalued features and restrict its value to the interval [0,1]. NMIFS does not require user-defined parameters such as $\beta$ in MIFS and MIFS-U. Compared to the MIFS, MIFS-U, and mRMR. NMIFS perform better on multiple artificial datasets and benchmark problems. In addition, the authors combine NMIFS with genetic algorithm and propose the GAMIFS, which uses NMIFS to initialize a better starting point and as part of a mutation operator. During the mutation process,features with high mutual information value will have a higher probability of being selected, which speeds up the convergence of the genetic algorithm.

The rough sets for feature selection were proven to be feasible \citep{R16}. The particle swarm optimization algorithm is an excellent metaheuristic algorithm \citep{R17}. \cite{R18} proposed an algorithm based on rough sets and particle swarms. The particle swarm optimization algorithm uses a number of particle flights in the feature space by interparticle interactions to find the best feature subset. The proposed algorithm utilized UCI datasets \citep{R19} for evaluation. The experimental results are compared with a GA-based approach and other deterministic rough set reduction algorithms. The experimental results showed that the proposed algorithm produces better performance.

Intrusion detection system (IDS) is an important security device. \cite{R20} proposed a mutual information-based feature selection method for IDS. A robust intrusion detection system needs to be both high performance and high speed. The proposed method uses LSSVM for classifier construction. The KDD Cup 99 dataset is used for the evaluation process and the evaluation results indicate that the proposed method produces a high level of accuracy, especially for remote to login (R2L) and user to remote (U2R) attacks.

Salp swarm algorithm (SSA) is an excellent optimization algorithm designed for continuous problems \citep{R21}. \cite{R22} came up with a novel approach which combines SAA with chaos theory (CSAA). Simulation results showed that chaos theory  improves the convergence speed of the algorithm significantly. The experiments reveal the potential of CSAA for feature selection, which can select fewer features while achieving higher classification accuracy.

Water wave optimization(WWO) is new nature-inspired metaheuristic algorithm that was developed by \citep{R23}.The approach known as WWO simulates the phenomena of water waves refraction, propagation and fragmentation to find the global optimal solution in optimization problems. A new feature selection algorithm uses a combination of rough set theory (RST) and  a binary version of the water wave optimization approach (WWO) was proposed by \citep{R24}. Several datasets are used to evaluate the proposed algorithm, and the results is compared to several advanced metaheuristic algorithms. The computational results demonstrate the efficiency of the proposed algorithm in feature selection.

Finally,the PIO (Pigeon Inspired Optimizer) is an advanced bionic algorithm proposed by \citep{R25}, \cite{R26} proposed two binary schemes to improve PIO to accommodate the feature selection problem and applied it to intrusion detection system. Three popular datasets: KDD Cup 99, NSL-KDD, and UNSW-NB15, are used to test the algorithm. The proposed algorithm surpasses six state-of-the-art feature selection algorithms in terms of F-score and other metrics. Further, Cosine\_PIO selecte 7 features from KDD Cup 99, 5 features from NSL-KDD and 5 features from UNSW-NB15. It is amazing to achieve a excellent performance by so few features.

In the field of feature selection, classifiers aside, the wrapper methods are gaining popularity with the development of computer hardware. Various metaheuristic and hybrid feature selection methods have been proposed. However, these algorithms have some shortcomings: hard to understand and learn; more difficult to determine parameters; large computational cost.

To solve the above problems, the paper proposed a concise method for feature selection via normalized frequencies (\textbf{NFFS}). This method can perform feature selection at a much lower computational cost while maintaining high performance. The best feature is that it has a very simple logic, so it can be applied easily.

\section{One-hot encoding and mutual information}
\label{S3}
	This section presents two tools used in this paper. Processing categorical features is an indispensable preprocessing step in machine learning, which is performed by One-hot encoding in this paper. Mutual information is an excellent filter method that can capture both the linear and nonlinear dependencies between feature and label.
\subsection{One-hot encoding}
One-hot encoding encode categorical features as a one-hot numeric array \citep{R241}. One-hot encoding projects the categorical features to a high-dimensional feature space. It allows the distance among features to be calculated more reasonably, which is important for many classifiers.

One-hot encoding uses $N$ status registers to encode $N$ states. Each register has its own individual register bits and only one of which is valid at any given time. It's easier to understand one-hot encoding with an example, let's side there is a dataset of a household item with seven samples. Length, Width and Color are used to describe each sample, but Color is not a numerical feature so it needs to be transformed. Ordinal encoding is a common encoding approach for categorical features \citep{R19}, by which feature is converted to ordinal integers. The contrast between one-hot encoding and ordinal encoding is illustrated in \autoref{F1}.

\begin{figure}
	\includegraphics[width=1\textwidth]{F1}
	\caption{Comparison of one-hot encoding and ordinal encoding.}
	\label{F1}
\end{figure}

As \autoref{F1} shows, one-hot encoding transforms the feature ‘Color’ into four features ( Color\_A, Color\_B, Color\_C, Color\_D). The characters ( Non-numeric ) A, B, C and D indicate different colors. From the middle table in  \autoref{F1}, it can be noted that each sample takes 1(numeric) in one of the four color features, while 0 is taken in the other three features ‘Color\_’. As can be seen from \autoref{F1}, one-hot encoding will expands the dimensionality of the dataset  in comparison to ordinal coding. We also use \_ as a separator in the processing of the dataset in the later part of this paper.

\subsection{mutual information}

Mutual information can be applied for evaluating dependency between random variables \citep{R251}. Let $X$ ( feature ) and $Y$ ( label ) be two discrete random variables, The mutual information (\textbf{MI} value) between $X$ and $Y$ can be calculated by \autoref{E1}.
\begin{equation}
\label{E1}
\large
I(X;Y)=\sum_{x\in X}^{}\;\sum_{y\in Y}^{}p(x,y)\log\frac{p(x,y)}{p(x)p(y)}
\end{equation}

Where $I(X; Y)$ is mutual information, $p(x,y)$ is the joint probability density function, $p(x)$ and $p(y)$ are marginal density functions of $X$ and $Y$, respectively.  From the equation, we know that when $X$ and $Y$ are independent of each other, their MI value is 0, otherwise it must be greater than 0.

\section{ NFFS}
\label{S4}
This section details the proposed feature selection method in two phases. Phase I of NFFS is described in \autoref{S4.1} and phase II of NFFS is located in \autoref{S4.2}. Phase II further processes the information provided by phase I and finally finds the best feature subset. \autoref{T1} lists some abbreviations appeared in this paper, which allow the paper more concise and clear.

NFFS is different from common feature selection methods in the following two points:
\begin{enumerate}
\item NFFS selects features from the feature space of the preprocessed dataset, rather than from the raw feature space. The features selected by NFFS will not contain any categorical features.
\item All steps of NFFS use the preprocessed dataset. Only the preprocessing process would touch the raw dataset. The dimensionality of the preprocessed dataset will be greater than the raw dataset.
\end{enumerate}

\begin{table}
\centering
\caption{Abbreviations used in this paper and their meanings.}
\label{T1}
\begin {tabular}{cccc}
\toprule
WV1 & AFS1 & WV2  & AFS2 \\ \midrule
\begin {tabular} [c]{@{}c@{}}Weight vector\\ obtained \\ in phase I of NFFS\end {tabular} & \begin {tabular}[c]{@{}c@{}}Alternative feature subsets\\ generated\\ in phase I of NFFS\end {tabular} & \begin {tabular}[c]{@{}c@{}}Weight vector\\ obtained \\ in phase II of NFFS\end {tabular} & \begin {tabular}[c]{@{}c@{}}Alternative feature subsets\\ generated\\ in phase II of NFFS\end {tabular} \\ \bottomrule
\end{tabular}
\end{table}

\begin{figure}[h]
	\centering
	\includegraphics[width=\textwidth]{F2}
	\caption{NFFS for feature selection.}
	\label{F2}
\end{figure}

\subsection{Phase I of NFFS}
\label{S4.1}
	The purpose of phase I of NFFS is to generate a batch of feature subsets, a portion of which can yield a slightly higher fitness values. The mechanism of this section is shown at the left side of \autoref{F2}, the steps being as follows:

\textbf{1. measure MI values}: Mutual information is used here only to evaluate the MI value for each feature. The preprocessed dataset is fed to the mutual information module, which outputs a positive floating number for each feature. The larger the number is, the stronger the relationship between feature and label, and vice versa.

\textbf{2. Find the threshold}: In the above step we obtained the MI value for each feature in the dataset. Histogram is used to analyze the distribution of MI values of features in the dataset. The distribution for these MI values of NSL-KDD dataset (A dataset used for the experiment) is shown in \autoref{F4}, from which it can be noticed that the majority of features obtained tiny MI values. A threshold is introduced to filter out these tiny MI values since it is not necessary to be calculated in the next step.

Finding the threshold requires analyzing MI values of features first, and the histogram is a handy tool. It is important to note that the threshold is selected by analyzing the histogram rather than a self-defined parameter.

\textbf{3. Obtain WV1}: A formula is used to convert MI values of features into weights of features, which is defined as in \autoref{E2}.
\begin{equation}
\label{E2}
\large
\mathrm{WV1}_i=\left\{\begin{array}{lc}\left(V_i-V_t\right)\frac{0.4}{V_{max}-V_t}+0.5&V_i>V_t\\0.5&V_i\leq V_t\end{array}\right.
\end{equation}

Where $i$ (number of features) denotes the $i$-th item of a vector, vector WV1 (weight vector obtained in phase I of NFFS) denotes weights of features, $V_i$ denotes MI value of the $i$-th feature. $V_{max}$ denotes the maximum MI value in vector $V$, while $V_t$ is the threshold from the previous step. Where 0.4 represents the upper bound for the increase of weights, which is intended to keep the weights in a suitable range for next step. Another constant, 0.5, denotes the basic weight that all features can hold.

It is clear from \autoref{E2} and \autoref{F4} that there are a large number of features with a weight of 0.5, but this is not a problem, phase I of NFFS isn't about getting an awesome result.

\textbf{4. Generate AFS1 by \emph{probability}}: When the WV1 is obtained, it's also the time to generate feature subsets. The generation process requires the use of \autoref{E3}.

\begin{equation}
\label{E3}
\large
\mathrm{AFS1}_L^i=sgn(\mathrm{WV1}_i-rand_i)=\left\{\begin{array}{lr}1&\mathrm{WV1}_i-rand_i>0\\0&\mathrm{WV1}_i-rand_i\leq0\end{array}\right.
\end{equation}

Where $L$ denotes the $L$-th generated feature subset, $i$ denotes the $i$-th item of a vector. $AFS1_L^i$ denotes the $i$-th feature of the $L$-th feature subset. AFS1$_L$ , WV1 and rand are all vector with the same dimension as the number of features in th dataset. AFS1$_L$ is a mask to represent a features subset. Each item in $rand$ is a uniform random number in the range [0,1]. In the vector AFS1$_L$, `1' means the feature is selected, while `0' means the feature is not selected.

Applying \autoref{E3}, the $L$ feature subsets constitute AFS1 (alternative feature subsets generated in phase I of NFFS). From \autoref{E3}, it can be learned that features with higher MI value will have a higher probability of being selected,  as a result, the introduction of mutual information makes NFFS have a better starting point.

\textbf{5. Evaluate feature subsets}: Each feature subset in AFS1 is evaluated using classifier to obtain a fitness value. Specifically, the evaluation process consists of the following three steps: first, prepare training dataset and testing dataset according to AFS1$_L$; next, train the classifier with the training set; finally, test dataset is used to evaluate the trained classifier, and the result is the fitness value of AFS1$_L$.

As \autoref{E2} demonstrates, we use the outcomes of mutual information directly, rather than as a filter method to rank features. Phase I of NFFS is now complete, feature subsets in AFS1 and their fitness values are the raw materials for phase II of NFFS.

\autoref{Phase I of NFFS} show an overall procedure for Phase I of NFFS. As the algorithm shows that there are two layer while loops. The first layer represents a generated feature subset, while the second layer determines which features are selected in this feature subset.

Also we list the shapes of some of the variables from \autoref{Phase I of NFFS} in \autoref{Variables}, taking the NSL-KDD dataset as an example. \autoref{Variables} also contains some of the variables in \autoref{Phase II of NFFS}.

\begin{algorithm}
\caption{Phase I of NFFS.}
\label{Phase I of NFFS}
\KwIn{$L$}
\KwResult{AFS1; fitness values of AFS1}
Use mutual information to score each feature.\\
Select an appropriate threshold value.\\
Use \autoref{E2} to get WV1.\\
\While{$L>0$}{
\While{$i>0$}{Get $AFS1_L^i$ by \autoref{E3}.\\$i=i-1$}
$L=L-1$}
Evaluate the feature subsets inside AFS1.\\
\Return AFS1; fitness values of AFS1
\end{algorithm}

\begin{table}[]
\centering
\caption{Shapes of partial ariables in \autoref{Phase I of NFFS} and \autoref{Phase II of NFFS} }\label{Variables}
\begin{tabular}{ccccccc}
\toprule
\textbf{value} & \textit{WV1} & \textit{$WV2$} & \textit{AFS1} & \textit{$AFS2$} & \textit{\begin{tabular}[c]{@{}c@{}}fitless values\\ of AFS1\end{tabular}} & \textit{\begin{tabular}[c]{@{}c@{}}fitless values\\   of $AFS2$\end{tabular}} \\ \midrule
\textbf{shape} & 1x122        & 1x122        & $L$x122       & $O$x122        & $L$x1                                                                     & $O$x1                                                                        \\ \bottomrule
\end{tabular}
\end{table}

\subsection{Phase II of NFFS}
\label{S4.2}
A new weight vector (WV2) would be obtained by utilizing the raw materials provided by phase I of NFFS, which is the secret sauce for finding the optimal feature subset. The mechanism of this section is shown at the right side of \autoref{F2}, the steps being as follows:

\textbf{1. Count frequencies}: First, sort the feature subsets in AFS1 by their fitness values, the $M$ feature subsets with higher fitness values constitute AFS1$_{top}$, the $N$ $(M+N<L)$ feature subsets with lower fitness values constitute AFS1$_{bottom}$, the rest feature subsets with ordinary fitness values are not involved in the counting. Next, count how many times each feature be selected in AFS1$_{top}$ and AFS1$_{bottom}$, respectively. The counting results constitute vector $\overrightarrow{F_{top}}$ and vector $\overrightarrow{F_{bottom}}$, respectively. The dimensions of these two vectors are the same as the number of features in dataset. The i-th item in $\overrightarrow{F_{top}}$ represents the total number of occurrences of the i-th feature of the dataset in AFS1$_{top}$. The i-th item in $\overrightarrow{F_{bottom}}$ represents the total number of occurrences of the i-th feature of the dataset in AFS1$_{bottom}$.

\textbf{2. Obtain WV2}: WV2 can be derived from $\overrightarrow{F_{top}}$ and $\overrightarrow{F_{bottom}}$ by \autoref{E4}.

\begin{equation}
\label{E4}
\large
\mathrm{WV2}=\frac{\overrightarrow{F_{top}}}{\left\|\overrightarrow{F_{top}}\right\|}-\frac{\overrightarrow{F_{bottom}}}{\left\|\overrightarrow{F_{bottom}}\right\|}
\end{equation}

Where $\left\|\overrightarrow{F_{...}}\right\|$ denotes the length of a vector, the purpose of which is to normalize the vector in order to obtain a normalised frequency. The normalized frequencies have the same effect as the weights. The logic of the equation is that if a feature appears often in AFS1$_{top}$ but rarely in AFS1$_{bottom}$, then it has a high weight. Note that the style of \autoref{E4} is '$vector = vector - vector$'. This concise formula is the heart of NFFS. What the 'normalized frequencies' in the title of the paper refers to is \autoref{E4}.

From the above step, we know that the items in the vector \overrightarrow{F_{top}} and vector \overrightarrow{F_{bottom}} are the frequencies of the features. It makes sense to compare a frequency in \overrightarrow{F_{top}} with another frequency in \overrightarrow{F_{top}}. But it is meaningless to compare a frequency in \overrightarrow{F_{top}} with a frequency in \overrightarrow{F_{bottom}}. This is why normalization is needed.

\textbf{3. Generate AFS2 by \emph{sorting}}: When the WV2 is obtained, it is also the time to generate feature subsets, the generation process is much simpler than those in phase I of NFFS.

The first feature subset generated is the feature with the highest weight in WV2, the second feature subset generated is the two features with highest weight in WV2, the third feature subset generated is the three features with the highest weight in WV2, and so on. In total, O (O $<$ number of features) feature subsets is generated.These feature subsets constitute AFS2.

\textbf{4. Evaluate feature subsets and get the result}: Each feature subset in AFS2 is provided to the classifier for evaluation, and the feature subset with the highest fitness value would be selected as the output of NFFS. \autoref{Phase II of NFFS} show an overall procedure for Phase II of NFFS. NFFS only needs to evaluate ($L + O$) feature subsets to obtain result, which is a great advantage in speed compared to the heuristic algorithms, and the result is excellent.

\begin{algorithm}
\caption{Phase II of NFFS}\label{Phase II of NFFS}
\KwIn{$M, N, O$}
\KwResult{Best feature subset.}
Sort feature subsets in AFS1 by their fitness values.\\
Get AFS1$_{top}$ and AFS1$_{bottom}$ from AFS1.\\
Get $\overrightarrow{F_{top}}$ from AFS1$_{top}$.\\
Get $\overrightarrow{F_{bottom}}$ from AFS1$_{bottom}$.\\
Use \autoref{E4} WV2.\\
\While{$O>0$}{AFS2$_O$ = The $O$ feature subsets with the highest weight in WV2.\\ \tcp*[h]{AFS2$_O$  represents the $O$-th feature subset in AFS2.}\\$O$=$O$-1}
Evaluate the feature subsets inside AFS2.\\
Sort feature subsets in AFS2 by their fitness values.\\

\Return Feature subset that get the best fitness value in AFS2.
\end{algorithm}

\section{Experiments and results}
\label{S5}
In his section, we introduced the dataset used for experiments. Data preprocessing is discussed. We described the evaluation indicators and classifier used in this paper, fitness function is also be illustrated. In \autoref{S5.4}, we implemented the proposed NFFS. In \autoref{S5.5}, we described the results and compared the proposed method with several state-of-the-art feature selection methods.

\subsection{Dataset}
\label{S5.1}
NSL-KDD dataset \citep{R27} and UNSW-NB15 \citep{R27} dataset are used to evaluate the proposed feature selection method. These two dataset are authoritative real-world dataset for intrusion detection domain. Also both datasets have been provided with ready-made training dataset and testing dataset. It is not necessary to prepare the training dataset and test dataset by sampling from the unsegmented datase.

NSL-KDD dataset uses 41 features to represent a record, and each record is either an normal or attack. This dataset is a refined version of KDD Cup 99 dataset \citep{R261} and adds a item to represent the difficulty of classifying correctly.  UNSW-NB15 dataset consists of 42 features and a multiclass label and a binary label, here we only use the binary label. There are no duplicate records in these two dataset.

\begin{table}
\centering
\caption{Type of features in NSL-KDD dataset.}
\label{TK}
\begin{tabular}{ll}
\toprule
\multicolumn{1}{c} {Types of features} & \multicolumn{1}{c}{Features}                                                                                \\ \midrule
Binary                     & [ f7,  f12,  f14, f15, f21, f22 ]                                                                                \\
Categorical                & [ f2, f3, f4 ]                                                                                \\
Numeric                    & \multicolumn{1}{p{0.8\columnwidth}}{[ f1, f5, f6, f8, f9, f10, f11, f13, f16, f17, f18, f19, f20, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f37, f38, f39, f40, f41 ]}                                                                                \\ \bottomrule
\end{tabular}
\end{table}

\begin{table}
\centering
\caption{Type of features in UNSW-NB15 dataset.}
\label{TU}
\begin{tabular}{ll}
\toprule
\multicolumn{1}{c} {Types of features} & \multicolumn{1}{c}{Features}                                                                                \\ \midrule
Binary                     & [ f37, f42 ]                                                                                \\
Categorical                & [ f2, f3, f4 ]                                                                                \\
Numeric                    & \multicolumn{1}{p{0.8\columnwidth}}{[ f1, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20,  f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31, f32, f33, f34, f35, f36, f38, f39, f40, f41 ]}                                                                                \\ \bottomrule
\end{tabular}
\end{table}

\begin{table}[]
\centering
\caption{Summary quantitative information of NSL-KDD datatset and UNSW-15 dataset.}
\label{TS}
\begin{tabular}{cccc}
\toprule
Datasat                           & Partition        & Positive (Ratio) & Negative (Ratio) \\ \midrule
\multirow{2}{*}{NSL-KDD} & Training dataset & 58630 (46.5\%)  & 67343 (53.5\%)  \\
                                  & Testing dataset  & 12833 (56.9\%)  & 9711 (43.1\%)   \\
\multirow{2}{*}{UNSW-15} & Training dataset & 119341 (68.1\%) & 56000 (31.9\%)  \\
                                  & Testing dataset  & 45332 (55.1\%)  & 37000 (44.9\%) \\  \bottomrule
\end{tabular}%
\end{table}

The features of NSL-KDD dataset are presented in \autoref{TK}  in a manner that is more friendly to machine learning \citep{R31}. Where 'f$n$' represents the column $n$ in the dataset file. \autoref{TU} show the features of UNSW-NB15 dataset in the same style. As shown in \autoref{TK} and \autoref{TU}, both dataset contains three categorical features. \autoref{TS} shows the distribution for NSL-KDD and UNSW-NB15. As the table shows that both dataset are relatively balanced.

\subsection{Data preprocessing}
\label{S5.2}
The first step in the experiments is to process the nonnumerical marks in dataset. Preprocessing consists of two items: convert categorical features into numeric features by one-hot encoding; convert symbolic labels into binary labels. In the experiments, we used '0' denotes normal class while '1' denotes attack class in spite of the specific type of attack. After one-hot encoding processed, 41 features inside NSL-KDD have been expanded to 122.

\subsection{Classifier related}
\label{S5.3}
\subsubsection{Classifier}
In this paper, random forest \citep {R32} with PCA \citep{R33} is used as the classifier, and PCA is regarded as a part of the classifier rather than an independent processing step \citep{R331}. All feature subsets need to be evaluated by this classifier. The PCA plays an important role as part of the classifier, the data will be processed by PCA before being fed into the classifier.

PCA can project data into an orthogonal feature space, which can remove redundant linear relationships from the original feature space. PCA makes the classifier robuster and at the same time further decreases the computational cost.

Since PCA is a scale sensitive method, it needs the help of standardization. It is important to note that CART-based random forest does not need standardization, standardization is only for PCA here. This classifier is also used to evaluate the feature selection methods from state-of-the-art related works.

\subsubsection{Evaluation indicators}
Different learning tasks in machine learning require different indicators, the evaluation indicators in this paper adopt generic nomenclature, rather than exclusive to a specific task. Accuracy, recall, precision, F-score and AUC are used to evaluate feature subsets in this paper. All indicators used can be calculated from the confusion matrix \citep{R34}, the confusion matrix is shown in \autoref{T3}, where the positive means attack class, while the negative means normal class. The four parameters in table represent the number of records that match a certain condition:

\begin{table}
\centering
\caption{Binary confusion matrix.}
\label{T3}
\begin{tabular}{lcc}
\toprule
           & Predicted normal & Predicted attack \\ \midrule
Actual normal & TN          & FP          \\
Actual attack & FN          & TP           \\ \bottomrule
\end{tabular}
\end{table}

\textbf{TP (True Positive)}: Attack and predicted to be attack.

\textbf{TN (True Negative)}: Normal and predicted to be normal.

\textbf{FP (False Positive)}: Normal and predicted to be attack.

\textbf{FN (False Negative)}: Attack and predicted to be attack.

The evaluation indicators used in experiments are described as follows:

\textbf{1. Accuracy}: Measure how many records are correctly classified as in \autoref{E5}.
\begin{equation}
\label{E5}
\large
accurary=\frac{TP+TN}{TP+TN+FP+FN}
\end{equation}

\textbf{2. Recall}: Measures how many attacks could be discovered as in \autoref{E6}.
\begin{equation}
\label{E6}
\large
recall=\frac{TP}{TP+FN}
\end{equation}

\textbf{3. Precision}: Measures how many attacks classified as attack are really attack as in \autoref{E7}.
\begin{equation}
\label{E7}
\large
precision=\frac{TP}{TP+FP}
\end{equation}

\textbf{4. F-score}: A weighted average of the precision and recall as in \autoref{E8}.
\begin{equation}
\label{E8}
\large
F-score=2\times\frac{\left(precision*recall\right)}{\left(precision+recall\right)}
\end{equation}

\textbf{5. AUC(Area Under the Receiver Operating Characteristic)}: Simply put it monitors the potential of the model \citep{R35}.

Recall and precision are two of the mutually exclusive evaluation indicators. A classifier can only achieve a high F-score if it obtains high values on both recall and precision. All evaluation indicators except AUC are in the range [0,1]. The maximum value of AUC is 1, while the minimum value is 0.5. If a classifier makes a random decision, then its AUC will be 0.5.

\subsubsection{Fitness function}
In the search for the optimal feature subset, we use only F-score to constitute fitness function without considering the number of features in feature subset, which is based on two considerations: the F-score is a comprehensive indicator; and NFFS is not a wrapper method, there is no comparison of independent feature subsets. Note that fitness function is used to search for the optimal feature subset, while evaluation indicators are used to evaluate the final result.

\subsection{Perform feature selection}
\label{S5.4}
Scikit-learn is a Python module for machine learning. In this paper, experiments were completed by Scikit-learn \citep{R39}. The quality of a feature subset needs to be judged by its fitness value, but the fitness value from the classifier is highly dependent on the parameters used to train the classifier. To solve this problem, we adopt the strategy of testing a feature subset with multiple groups of parameters, and the average value is used as the fitness value of the feature subset.

\subsubsection{Phase I of NFFS}
\label{S5.4.1}

\begin{figure}
	\centering
	\includegraphics[width=0.4\textwidth]{F4}
	\caption{Distribution for MI values of features in NSL-KDD dataset.}
	\label{F4}
\end{figure}

\autoref{F4} shows the MI values of features in NSL-KDD dataset, from which it can be seen that the majority of features hold tiny MI values. The threshold taken in NSL-KDD dataset is 0.05, and it is indicated by a red vertical line in \autoref{F4}. As shown in figure, a large number of features would hold a weight of 0.5 after calculation by \autoref{E2}. However, the final optimal feature subset show that majority of features are eliminated as well.

\begin{figure}
	\centering
	\includegraphics[width=0.4\textwidth]{F5}
	\caption{Distribution for fitness values of feature subsets in AFS1.}
	\label{F5}
\end{figure}

After obtaining WV1 via \autoref{E2}, \autoref{E3} was used to generate 180 feature subsets, which constituted AFS1. We wanted to get a glimpse of the power of PCA. \autoref{F5} shows the performance of feature subsets in AFS1. As can be observed in the figure, the classifier with PCA shifts the bar significantly to the right, which means fitness values of feature subsets is significantly improved by PCA. The reason is that PCA removes linearly correlated redundant information from the input data, which allows a robuster classifier. Note that, this is just to a test of the significance of PCA, elsewhere PCA always accompanies classifier around.
\subsubsection{Phase II of NFFS}
\label{S5.4.2}
In experiments, 45 feature subsets with higher fitness values from AFS1 were selected to constitute AFS1$_{top}$ and 45 features with lower F-score were selected to constitute AFS1$_{bottom}$. After counting frequencies, WV2 can be calculated by \autoref{E4}, which were used to generate 70 feature subsets to constitute AFS2.

   \autoref{F6} shows the performance of feature subsets in AFS1 and AFS2. As figure shown, feature subsets in AFS2 hold distinct advantages, which suggests that phase II of NFFS plays a significant role. It can also be seen that the feature subsets in AFS2 performed more stably. The phase II of NFFS is based on the phase I of NFFS but is far superior to it.

\begin{figure}
	\centering
	\includegraphics[width=0.4\textwidth]{F6}
	\caption{Distribution for fitness values of feature subsets in AFS1 and AFS2.}
	\label{F6}
\end{figure}

\subsection{Result}
\label{S5.5}
\begin{table}
\centering
\caption{Results of several feature selection methods applied to the NSL-KDD dataset.}
\label{T4}
\begin{tabular}{llcp{0.36\columnwidth}}
\toprule
\multicolumn{1}{c}{Reference} & \multicolumn{1}{c}{Method}        & NF & \multicolumn{1}{c}{Selected feature subset}                                                                                \\ \midrule
          \citep{enache2015anomaly}         & BAT                       & 89(18)                          &[ f1, f2, f3, f8, f9, f13, f14, f18, f19, f20,  f26, f28, f32, f33, f34, f38, f39, f40 ]                                                                                \\
            \citep{ambusaidi2016building}       & LSSVM                     & 97(18)                          &[ f3, f4, f5, f6, f12, f23, f25, f26, f28, f29,  f30, f33, f34, f35, f36, f37, f38, f39 ]                                                                                \\
            \citep{moustafa2015a}       & Hybrid Association Rules  & 13(11)                          &[ f2, f5, f6, f7, f12, f16, f23, f28, f31, f36,  f37 ]                                                                                \\
       \citep{aljawarneh2017anomaly-based}      & IG                        & 87(8)                           & [ f3, f4, f5, f6, f29, f30, f33, f34 ]                                                                                \\
            \citep{tama2019tse-ids:}       & PSO                       & 118(37)                          &[ f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12,  f13, f14, f15, f17, f18, f20, f21, f22, f23,  f24, f25, f26, f27, f28, f29, f31, f32, f33,  f34, f35, f36, f37, f38, f39, f40, f41 ]                                                                                \\
       \citep{R26}            & Sigmoid\_PIO              & 98(18)                          &[ f1, f3, f4, f5, f6, f8, f10, f11, f12, f13, f14,  f15, f17, f18, f27, f32, f36, f39, f41 ]                                                                                \\
         \citep{R26}          & Cosine\_PIO               & 7(5)                           & [ f2, f6, f10, f22, f27 ]                                                                                \\           Proposed method        & NFFS                      & 34(11)                      &[ f2\_icmp, f3\_IRC, f3\_aol, f3\_auth, f3\_csnet\_ns, f3\_ctf, f3\_daytime, f3\_discard, f3\_ecr\_i, f3\_http\_8001, f3\_imap4, f3\_login, f3\_name, f3\_netbios\_ssn, f3\_pop\_2, f3\_pop\_3, f3\_rje, f3\_supdup, f3\_telnet, f3\_urh\_i, f4\_OTH, f4\_RSTO, f4\_RSTOS0, f4\_RSTR, f4\_S1, f4\_SF, f6, f7, f9, f10, f21, f30, f40, f41 ]\\ \bottomrule
\end{tabular}
\end{table}

The related works used to compared with NFFS and the features they selected from NSL-KDD are summarized in \autoref{T4}. Where the number outside the parentheses in the third column (NF) denote the number of encoded features (encoded by one-hoting encoding), while the number inside the parentheses denote the number of original features. It can be noticed that the feature subset selected by NFFS is reported with the encoded format, that is because NFFS is selecting features directly from the encoded feature space. Regarding the format of the features selected by NFFS, for example, f$2$\_tcp indicates the category ‘tcp’ in the 2-th feature (communication protocol).

In order to fairly compare the quality of the feature subsets found by each feature selection method, we need to train a separate classifier for each feature subset. For each feature subset reported in \autoref{T4},  we searched for the best parameters to build a classifier for it. During the search for the optimal parameters, the explanation ratio of PCA was always set to 0.93. Thirty different random seeds was used to perform 30 runs to obtain means and standard deviations to compose the results of the method. The 30 random seeds used are integers from 7 to 36, and the random seeds start from 7 simply because we believe that 7 represents luck. The fixed random seed allows the experimental results to be accurately reproduced.

Each feature subset in \autoref{T4} was fed to the customized classifier for evaluation, and the evaluation results are presented in \autoref{T5}. Based on the results shown in \autoref{T5}, NFFS obtain the best score in terms of accuracy, precision, recall, F-score and AUC.

\begin{table}[]
\centering
\caption{The performances of the feature subsets in \autoref{T4}.}
\label{T5}
\begin{tabular}{lccccc}
\toprule
Methods          & Precision±std & Recall±std & Accuracy±std & F-score±std & AUC±std \\ \midrule
BAT                   & 0.962±0.011          & 0.704±0.029       & 0.815±0.016         & 0.812±0.019        & 0.838±0.014    \\
LSSVM                     & 0.904±0.002          & 0.842±0.019       & 0.859±0.010         & 0.871±0.011        & 0.921±0.007    \\
Hybrid Association Rules& 0.956±0.009          & 0.636±0.020       & 0.776±0.011         & 0.763±0.015        & 0.802±0.012    \\
IG                & 0.898±0.002          & 0.781±0.032       & 0.825±0.017         & 0.835±0.018     & 0.927±0.005   \\
PSO                     & 0.948±0.021          & 0.687±0.035       & 0.800±0.021         & 0.796±0.025        & 0.819±0.020   \\
Sigmoid\_PIO             & 0.921±0.001         & 0.702±0.011       & 0.796±0.006         & 0.797±0.007       & 0.880±0.022   \\
Cosine\_PIO             & 0.926±0.003          & 0.821±0.040       & 0.861±0.022         & 0.870±0.023       & 0.910±0.009 \\
NFFS                      & 0.963±0.005          & 0.852±0.028       & 0.897±0.015         & 0.904±0.016        & 0.938±0.001    \\ \bottomrule
\end{tabular}
\end{table}

\begin{figure}
	\centering
	\includegraphics[width=0.8\textwidth]{F7}
	\caption{Performances of feature selection methods in \autoref{T4}.}
	\label{F7}
\end{figure}
F-score and AUC are relatively more comprehensive and pertinent indicators in machine learning, and \autoref{F7} visualizes these two indicators from \autoref{T5}. Where each bar represent mean and standard deviation of each method. As shown in \autoref{F7}, NFFS achieves the highest F-score and AUC. For F-score, NFFS gains an absolute victory without any doubt. For AUC, NFFS not only achieved the highest score, but also hold the smallest standard.

\begin{table}
\centering
\caption{Results of several feature selection methods applied to the UNSW-NB15 dataset.}
\label{Results of UNSW}
\begin{tabular}{llcp{0.36\columnwidth}}
\toprule
\multicolumn{1}{c}{Reference} & \multicolumn{1}{c}{Method}        & NF & \multicolumn{1}{c}{Selected feature subset}                                                                                \\ \midrule
            \citep{moustafa2015a}       & Hybrid Association Rules  & 21(11)                          &[ f4, f10, f11, f18, f20, f23, f25, f32, f35, f40, f41 ]                                                                                \\
            \citep{tama2019tse-ids:}       & PSO                       & 41(19)                          &[ f3, f4, f7, f8, f10, f11, f16, f20, f22, f24, f26, f28, f30, f32, f34, f35, f36, f41, f42 ] \\
            \citep{tama2019tse-ids:}       & Rule-Based                       & 157(13)                          &[ f2, f3, f7, f8, f10, f15, f17, f31, f33, f34, f35, f36, f41 ]  \\
Proposed method        & NFFS                      & 38(14)                      &[ f7, f10, f11, f14, f19, f27, f28, f29, f34, f35, f36, f2\_argus, f2\_bbn-rcc, f2\_br-sat-mon, f2\_cbt, f2\_crudp, f2\_dcn, f2\_ddp, f2\_eigrp, f2\_hmp, f2\_ipcv, f2\_leaf-2, f2\_netblt, f2\_ospf, f2\_ptp, f2\_scps, f2\_snp, f2\_st2, f2\_vines, f3\_pop3, f3\_ssl, f4\_CLO, f4\_CON, f4\_no ]\\ \bottomrule
\end{tabular}
\end{table}

UNSW-NB-15 is another dataset used to evaluate the NFFS.  \autoref{Results of UNSW} reports the selected feature subsets from UNSW-NB15 dataset. The format of \autoref{Results of UNSW} is the same as that of \autoref{T4}. \autoref{POU} show the results of realted works and NFFS. The format of \autoref{POU} is the same as that of \autoref{T5}, the data therein are also derived from 30 runs. As the table shows, NFFS get the best result against other method in term of the five indicators.

\begin{table}[]
\centering
\caption{The performances of the feature subsets in \autoref{Results of UNSW}.}
\label{POU}
\begin{tabular}{lccccc}
\toprule
Methods          & Precision±std & Recall±std & Accuracy±std & F-score±std & AUC±std \\ \midrule
Hybrid Association Rules   & 0.762±0.001          & 0.968±0.001       & 0.816±0.001         & 0.853±0.001        & 0.937±0.001    \\
PSO                    & 0.768±0.003          & 0.983±0.004       & 0.827±0.003         & 0.862±0.002        & 0.960±0.002   \\
Rule-Based     & 0.797±0.002          & 0.973±0.003       & 0.849±0.002         & 0.876±0.002       & 0.962±0.002   \\
NFFS                      &  0.818±0.004          & 0.985±0.001       & 0.871±0.003         &0.893±0.002        & 0.977±0.002    \\ \bottomrule
\end{tabular}
\end{table}

\section{Conclusion}
\label{S6}
In this work, a concise method for feature selection is proposed to overcome the shortcomings of metaheuristic algorithms. The proposed method is divided into two phases to implement feature selection. The proposed method is based on the following ideas: (Phase I) If the filter method considers a feature of higher importance, then the feature is selected with higher probability in the generation of feature subsets; (Phase II) If a feature is often contained by the feature subsets that perform well, while rarely being contained by the feature subsets that perform poorly, it means that the feature is beneficial to the classifier, the opposite means that the feature is harmful to the classifier.

In order to provide sufficient feature subsets with diverse performances for phase II. We generated the feature subsets by probability in phase I, which allowed the generated feature subsets better than the randomly generated ones. We used experiments to illustrate the reasons why the two phases used different strategies to generate feature subsets. The experimental results indicate that the proposed method outperformed several methods from state-of-the-art related works in terms of precision, recall, accuracy, F-score and AUC.

Future researches can investigate the use of clustering to optimize the efficiency of encoding and the application of the proposed method to semi-supervised learning.

\bibliographystyle{elsarticle-harv}


\section{Introduction}
The search for a full theory of quantum gravity is a major open problem in modern physics. The difficulty to find such a theory has even raised conceptual questions on the need for the quantization of gravity \cite{eppley1977necessity, penrose1996gravity, dyson2014graviton, baym2009two, mari2016experiments, belenchia2018quantum, rydving2021gedankenexperiments, carney2021newton}. One major challenge is the lack of experimental evidence. However, in recent years experimental proposals to test the quantization of gravity have become an active research field. On the one hand, quantum gravity phenomenology offers alternative models that can be probed from astrophysical observations \cite{amelino1998tests, hossenfelder2017experimental} and table-top experiments \cite{marshall2003towards, pikovski2012probing, bekenstein2012tabletop, bassi2017gravitational}. On the other hand, the entanglement between two gravitating systems can provide indirect signatures of quantized gravity \cite{bose2017spin, marletto2017gravitationally}. In similar spirit as the latter, a recent paper by Carney, M\"{u}ller and Taylor ~\cite{Carney2021} showed that interactions between atoms and a massive systems can hint at the quantum nature of gravity. They showed that the coupling results in periodic collapses and revivals of the interferometer visibility of the atomic interferometer. The authors show that under specific conditions such as Markovianity and time independent Hamiltonians, this behavior implies entanglement between the atom and the harmonic oscillator through gravity, hence to conclude the quantum nature of gravity.

Here we study classical models for the loss and revival of visibility. Our analysis shows that this signature can be reproduced if the atom evolves according to a random unitary channel, without being coupled to another quantum system~\cite{audenaert2008random}. As the central part of the atomic interferometer is the accumulated phase during the time evolution, the idea is motivated by a previous work~\cite{armata2016quantum} where the optical phase originating from an optomechanical interaction is found to have a classical origin, such that classical models can explain supposed quantum behaviour in other proposals, such as in Ref. \cite{marshall2003towards}. For the case where both the atoms and the oscillator are described fully quantum mechanically, we study the non-classicality for a thermal harmonic oscillator, showing that it vanishes for low coupling even if the system is in the ground state. Therefore, such experiments with very low coupling strengths and at finite temperature always allow for a classical description, unless it is explicitly invalidated experimentally.

\section{the original quantum model}\label{sec:level1}

The setup described in Ref.~\cite{Carney2021} consists of an atom localized into one of two positions interacting with a quantum harmonic oscillator. The position degree of freedom of the atom can therefore be represented as a qubit.
The atom will interact gravitationally with the harmonic oscilltor according to the Hamiltonian
\begin{equation}\label{eq:qHam}
    \hat{H}=\omega\hat{a}^{\dagger}\hat{a}+g(\hat{a}+\hat{a}^{\dagger})\hat{\sigma}_z.
\end{equation}
Here $\hat{a}$ and $\hat{a}^{\dagger}$ are annihilation and creation operators for the mechanical oscillator. They are related to the position and momentum operators of the mechanical oscillator via $\hat{a}=\sqrt{m\omega/2}\hat{X}+i/\sqrt{2m\omega}\hat{P}$, where $m$ and $\omega$ are the mass and frequency of the oscillator, respectively. The operator $\hat{\sigma}_z$ acts on the atom, defined as
\begin{equation}
    \hat{\sigma}_z=|1\rangle\langle1|-|0\rangle\langle0|,
\end{equation}
where $|0\rangle$ and $|1\rangle$ are two states of the position degree of freedom of the atom.
The coupling strength $g$ depends on the gravitational force between the two systems (i.e. the masses of the two systems and the distance between them).
Note that throughout this article we have set $\hbar=1$.

The mechanical oscillator is initially in a thermal state at temperature $T$, described by
\begin{equation}
    \rho_{\mathrm{th}}=\frac{1}{\pi\tilde{n}}\int d^2\alpha\; e^{-\frac{|\alpha|^2}{\tilde{n}}} \ketbra{\alpha}{\alpha}, \label{eq:thermal}
\end{equation}
where $\tilde{n}=(\exp(\omega/k_{\mathrm{B}}T)-1)^{-1}$ is the thermal phonon number and $\ket{\alpha}$ is a coherent state. The atom is initially in the state $|0\rangle$.

The experimental proposal in \cite{Carney2021} is to then perform  interferometry on the atom.
This consists of the following steps. The Hadamard gate is applied to the atom, resulting in the transformation
\begin{subequations}\label{eq:hadamard}
\begin{align}
    &|0\rangle\rightarrow \ket{+}=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle),\\
    &|1\rangle\rightarrow\ket{-}=\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle).
\end{align}
\end{subequations}
Then the atom-oscillator system evolves according to the Hamiltonian Eq.~\eqref{eq:qHam} for time $t$, described by the unitary operator
\begin{equation}
    \hat{U}_q(t)=e^{-i\hat{H}t}.
\end{equation}
To describe the system in a thermal state, we first calculate the evolution for an arbitrary coherent state $\ket{\alpha}$.
After evolving for a time $t$ the combined atom-oscillator state is given by (up to a global phase),
\begin{align}
    \hat{U}_q(t)&\ket{+}\ket{\alpha} \nonumber \\
    &= \frac{1}{\sqrt{2}}\left(e^{i\theta(t)} \ket{0}\ket{\alpha_{+}(t)} + e^{-i\theta(t)}\ket{1}\ket{\alpha_{-}}\right)
\end{align}
where
\begin{subequations}
\begin{align}
\alpha_{\pm}(t) &= \alpha e^{-i\omega t}\pm \frac{g}{\omega}\left(1-e^{-i\omega t}\right), \\
\theta(t) &= \frac{g}{\omega}\text{Im}(\alpha(1-e^{-i\omega t})).
\end{align}
\end{subequations}
Therefore, if the oscillator begins in a thermal state, the combined system will evolve under $\hat{U}_{q}(t)$ to the state
\begin{align}
    &\hat{U}_q(t)\left(\ketbra{+}{+}\otimes \rho_{\text{th}}\right)U^{\dagger}_{q}(t) \nonumber \\
    &\;= \frac{1}{\pi\tilde{n}} \int e^{-\frac{|\alpha|^2}{\tilde{n}}}\frac{1}{2}\left(e^{i\theta(t)} \ket{0}\ket{\alpha_{+}(t)} + e^{-i\theta(t)}\ket{1}\ket{\alpha_{-}}\right) \nonumber \\
    &\qquad\qquad \times \left(e^{-i\theta(t)} \bra{0}\bra{\alpha_{+}(t)} + e^{i\theta(t)}\bra{1}\bra{\alpha_{-}}\right)d^{2}\alpha. \label{eq:evolve}
\end{align}
After this evolution a phase shift $\varphi$ is applied to the atom state $|1\rangle$, which is realised by the unitary operator
\begin{equation}
    \hat{U}_{\varphi}=e^{i\varphi}|1\rangle\langle1|+|0\rangle\langle0|.
\end{equation}
Then another Hadamard gate Eq.~\eqref{eq:hadamard} is applied to the atom. Finally the position of the atom is measured. The probability of the atom to be in the state $|0\rangle$ is
\begin{equation}\label{eq:probQ}
    P_{q,\varphi}=\frac{1}{2}+\frac{1}{2}e^{-16\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}}\cos\varphi.
\end{equation}
The interference visibility is defined as
\begin{equation}
    V=\frac{\max_{\varphi}P_{q,\varphi}-\min_{\varphi}P_{q,\varphi}}{\max_{\varphi}P_{q,\varphi}+\min_{\varphi}P_{q,\varphi}}.
\end{equation}
After inserting in Eq.~\eqref{eq:probQ} we get
\begin{equation}\label{eq:qV}
    V=e^{-16\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}}.
\end{equation}
The visibility decays to its minimum value at $t=\pi/\omega$,  when the atom is maximally  entangled with the harmonic oscillator \eqref{eq:evolve}. The visibility then returns to the maximum value $1$ at $t=2\pi/\omega$, when the atom is fully disentangled from the harmonic oscillator. This pattern is repeated with the period $2\pi/\omega$. These are referred to as the periodic collapse and revival of the interference visibility, which in the fully quantum mechanical picture can be attributed to the entanglement between the two systems.

The periodic appearance and disappearance of entanglement can be clearly seen by examining the explicit form of the unitary time evolution operator. For this purpose, we generalise the $\hat{\sigma}_z$ operator in Eq.~\eqref{eq:qHam} to any operator $\hat{O}$ that commutes with $\hat{a}$ and $\hat{a}^{\dagger}$,
\begin{equation}\label{eq:qGen}
    \hat{H}_O = \omega\hat{a}^{\dagger}\hat{a}+g(\hat{a}+\hat{a}^{\dagger})\hat{O}.
\end{equation}
The corresponding unitary time evolution operator can be expressed as
\begin{align}\label{eq:UO}
    &\hat{U}_O(t)=e^{-i\hat{H}_Ot}\\
    &=e^{i\frac{g^2}{\omega^2}(\omega t-\sin\omega t)\hat{O}^2}e^{-i\omega t\hat{a}^{\dagger}\hat{a}}e^{-\frac{g}{\omega}((e^{i\omega t}-1)\hat{a}^{\dagger}-(e^{-i\omega t}-1)\hat{a})\hat{O}}.\nonumber
\end{align}
The last exponential factor is a displacement operator of the oscillator, conditioned on the state of the atom.
At times $t=2n\pi/\omega$ where $n\in\mathbb{Z}$, the last two factors in Eq.~\eqref{eq:UO} reduce to the identity, meaning that at these times $\hat{U}_O(t)$ is independent of $\hat{a}$ and $\hat{a}^{\dagger}$, and the atom and the oscillator decouple. The first factor is usually associated with a nonlinear geometric phase gate on the mode described by $\hat{O}$. In \cite{armata2016quantum}, a similar interferometric setup was considered but with coherent states of light. In that case the non-linear factor in \eqref{eq:UO} caused an additional loss of visibility. Since the model considered here only studies interferometry with a single qubit, there is no additional loss of visibility. Indeed since $\hat{\sigma}_z^2$ is the identity operator, the non-linear factor only appears as a global phase.

\section{Semi-classical Approaches}

In this section we present several semi-classical models which reproduce the same periodic collapse and revival pattern as seen in the fully quantum mechanical case \eqref{eq:qV}. In these models, the only quantum element in the setup is the atom, which is modelled as a two-level system. We start with a general formalism where the atom is subject to a random unitary channel, then we explicitly consider three examples.

\subsection{General Formalism}

In our semi-classical models we perform the same atom interferometry experiment but we replace $\hat{U}_q(t)$ with a random unitary channel. To be specific, the atom is prepared in the $|+\rangle$ state. It then evolves under a random unitary channel whose effect on the atomic state is described by
\begin{equation}\label{eq:scState}
    \rho(t)=\langle \hat{U}_{sc}(t)|+\rangle\langle+|\hat{U}_{sc}^{\dagger}(t) \rangle_c,
\end{equation}
where $\hat{U}_{sc}(t)$ a phase shift unitary operator,
\begin{equation}\label{eq:scU}
    \hat{U}_{sc}(t)=e^{i\phi(t)}|1\rangle\langle1|+|0\rangle\langle0|,
\end{equation}
$\phi(t)$ is a real-valued random variable at each time, and $\langle \cdot \rangle_c$ refers to taking the average over the classical probability distribution of random variables. The phase shift $\phi(t)$ can, for instance, be generated via the Hamiltonian of the atom,
\begin{equation}
    \hat{H}_{sc}=G(t)\hat{\sigma}_z,\label{eq:HamGen}
\end{equation}
where
\begin{equation}
    G(t)=-\frac{1}{2}\frac{d\phi(t)}{dt}.\label{eq:gT}
\end{equation}
The atomic state can be explicitly written as
\begin{align}
    \rho(t)&=\frac{1}{2}|1\rangle\langle 1|+\frac{1}{2}|0\rangle\langle 0|+\frac{1}{2}\langle e^{i\phi(t)} \rangle_c|1\rangle\langle0|\nonumber\\
    &+\frac{1}{2}\langle e^{-i\phi(t)} \rangle_c|0\rangle\langle1|.
\end{align}
To finish the interferometry, same as the quantum case, a phase shift $\varphi$ is applied to $|1\rangle$, then the Hadamard gate Eq.~\eqref{eq:hadamard} acts on the atom, and finally we measure the atom position. The interference visibility is derived to be
\begin{equation}
    V=|\langle e^{i\phi(t)} \rangle_c|.
\end{equation}
The condition for reproducing the quantum collapse and revival of the visibility, is therefore
\begin{equation}\label{eq:condition}
    |\langle e^{i\phi(t)} \rangle_c| = e^{-16\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}}.
\end{equation}
Any random unitary channel, i.e., classical probability distribution of $\phi(t)$, which can satisfy the condition Eq.~\eqref{eq:condition}, will reproduce the same visibility as a function of time as governed by the quantum interaction Hamiltonian Eq.~\eqref{eq:qHam}.
This will be true if the classical uncertainty associated with $\phi(t)$ vanishes with period $2\pi/\omega$, but remains at intermediate times.
We will now give several examples of such a $\phi(t)$.

\subsection{Example semi-classical model 1} \label{sec:ex1}

The first semi-classical model is based on a semi-classical mean-field approximation to the quantum Hamiltonian Eq.~\eqref{eq:qHam}. We assume that the atom is a two-state quantum system, while the mechanical oscillator is classical. The atom evolves according to the Hamiltonian
\begin{equation}\label{eq:sc1h}
    \hat{H}_{sc1}=\sqrt{2}g x(t)\hat{\sigma}_z,
\end{equation}
where $x(t)$ is the dimensionless position of the mechanical oscillator, which is related to the physical displacement $X$ of the oscillator via the `zero-point length', $x=X\sqrt{m\omega}$. The mechanical oscillator is assumed to only see the mean-field effect of the atom, i.e., the force applied from the atom onto the mechanical oscillator is $F=-\sqrt{2m\omega}g\langle \hat{\sigma}_z \rangle$. As the atom is in the state $(|0\rangle+|1\rangle)/\sqrt{2}$ before the interaction with the mechanical oscillator starts, and the interaction Eq.~\eqref{eq:sc1h} only induces a phase difference between the two basis states $|0\rangle$ and $|1\rangle$, $F=0$ holds throughout the time evolution. Therefore we can write the time evolution of the dimensionless mechanical oscillator position as
\begin{equation}
    x(t)=x_0\cos\omega t+p_0\sin\omega t,
\end{equation}
where $x_0$ is the initial value of dimensionless position and $p_0\sqrt{m\omega}$ is the initial value of the momentum. The energy of the classical oscillator is therefore
\begin{equation}
    E(x_{0},p_{0}) = \frac{\omega}{2}(x_{0}^{2}+p_{0}^{2}).
\end{equation}
The Hamiltonian \eqref{eq:sc1h} induces evolution according to the unitary
\begin{equation}
    U_{sc1}(t) = \exp\left(-i \sqrt{2} g \int_{0}^{t} d\tau x(\tau) \sigma_{z}\right).
\end{equation}
This is (up to a global phase) of the form \eqref{eq:scU}, where
\begin{align}\label{eq:sc1Phase}
    \phi(t)&=-2\sqrt{2}g\int_0^t d\tau x(\tau)\nonumber\\
    &=-2\sqrt{2}\frac{g}{\omega}(x_{0}\sin\omega t+p_{0}(1-\cos\omega t)).
\end{align}
If we assume the classical harmonic oscillator is in a thermal state at inverse temperature $\beta$, then the energy distribution is given by a Boltzmann distribution,
\begin{equation}
    p(E(x_{0},p_{0})) = \frac{\beta\omega}{2\pi}e^{-\frac{\beta\omega}{2}(x_{0}^{2}+p_{0}^{2})}.
\end{equation}
Thus we see the variables $x_{0}$ and $p_{0}$ have a normal distribution with standard deviation $\sqrt{1/\beta\omega}$.
Therefore, the interferometric visibility is
\begin{align}\label{eq:sc1V}
    \left|\langle e^{i\phi(t)} \rangle_c \right| &= \left|\int dx_{0}dp_{0}\, p(E(x_{0},p_{0}))\, e^{i\phi(t)}\right| \nonumber \\
    &=e^{-16n_c\frac{g^2}{\omega^2}\sin^2\frac{\omega t}{2}},
\end{align}
where we defined the classical phonon number as $n_c=1/\beta\omega$.
This is in the same form as Eq.~\eqref{eq:condition} except that, the factor $\tilde{n}+1/2$ in the exponential is replaced by $n_c$. Recall that the quantum thermal phonon number is expressed as $\tilde{n}=1/(\exp(\omega/k_{\mathrm{B}}T)-1)$. For high temperature, $k_{\mathrm{B}}T\gg \omega$,  we have that $\tilde{n}+1/2 \approx n_c$. The visibility Eq.~\eqref{eq:sc1V} is thus indistinguishable from the quantum visibility Eq.~\eqref{eq:qV}. If the temperature is low, the difference between $\tilde{n}+1/2$ and $n_c$ is significant. However, the quantum visibility can be reproduced if the classical oscillator begins in a higher temperature, so that the standard deviations of $x_0$ and $p_0$ are proportional to $\sqrt{\tilde{n}+1/2}$, instead of the thermal width $\sqrt{n_c}$.

We can explain the revival and collapse of the interferometric visibility in this semi-classical model as follows. The phase shift in this example is proportional to the integral of the position \eqref{eq:sc1Phase} of the classical oscillator from its initial position at time $t=0$. The uncertainty in the initial position and momentum of the oscillator translates into uncertainty into the phase shift which leads to a reduction in visibility. However since the motion of the mechanical oscillator is periodic, the integral of the position will be zero with certainty every mechanical period $t=2\pi/\omega$, implying that the phase shift at these times is certainly zero and therefore the visibility will periodically revive.

Note that this semi-classical model based on the mean-field interaction with a classical oscillator shares the same idea as the optomechanical example in Ref.~\cite{armata2016quantum}, and it has been suggested recently~\cite{hosten2021testing} to claim against the proposal in Ref.~\cite{Carney2021}. In the next subsections we describe other semi-classical models that do not correspond to the interaction of the atom with a classical thermal mechanical oscillator, but which nevertheless reproduce the same interference visibility as Eq.~\eqref{eq:qV}.

\subsection{Example semi-classical model 2}

The second semi-classical model assumes an interaction Hamiltonian
\begin{equation}\label{eq:Hsc2}
    \hat{H}_{sc2}=\sqrt{2}g\tilde{x}_0\cos\left(\frac{\omega t}{2}\right)\hat{\sigma}_z,
\end{equation}
where $\tilde{x}_0$ is a Gaussian random variable with mean $0$ and standard deviation $\sqrt{\tilde{n}+1/2}$. The corresponding phase modulation $\phi(t)$ in Eq.~\eqref{eq:scU} is
\begin{equation}\label{eq:sc2Phase}
    \phi(t)=-4\sqrt{2}\frac{g}{\omega}\sin\left(\frac{\omega t}{2}\right)\tilde{x}_0.
\end{equation}
At times $t=2n\pi/\omega$ where $n\in \mathbb{Z}$, $\phi(t)=0$, thus the randomness which depends on $\tilde{x}_0$ disappears, leading to full revival of the interference visibility. It is straightforward to show that the visibility Eq.~\eqref{eq:qV} is recovered.

This example might be considered a special case of the first, with $p_{0}=0$. In such a case there is no uncertainty in the initial momentum of the classical oscillator. As a result, the integral of the position \eqref{eq:sc1Phase} is periodically zero with half the period, therefore in order to match \eqref{eq:qV} in this example, the classical oscillator must have half the frequency, as seen in \eqref{eq:Hsc2}.

The phase modulation Eq.~\eqref{eq:sc2Phase} is the product of one random variable and a periodic time-dependent function. In comparison, in the first semi-classical model, Eq.~\eqref{eq:sc1Phase} contains two random variables, each one multiplied by a periodic time-dependent function. It is possible to construct more semi-classical models, by summing up larger numbers of terms, each term made of the product between a random variable and a periodic time-dependent function. In the next subsection, we will describe a systematic way of constructing semi-classical models based on the characteristic function of classical random variables.

\subsection{Characteristic function method and example semi-classical model 3}

We can construct semi-classical models directly from Eq.~\eqref{eq:scU}. The condition for reproducing the quantum visibility, Eq.~\eqref{eq:condition}, is related to the characteristic function of a random variable. At each time $t$, $\phi(t)$ is a random variable. Its characteristic function is
\begin{equation}
    \Psi_{\phi(t)}(k)=\langle e^{ik\phi(t)} \rangle_c.
\end{equation}
The condition Eq.~\eqref{eq:condition} is therefore the requirement
\begin{equation}\label{eq:char}
    |\Psi_{\phi(t)}(k=1)|=e^{-16\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}}.
\end{equation}
There are an infinite number of $\Psi_{\phi(t)}(k)$ (and therefore $\phi(t)$), that satisfy Eq.~\eqref{eq:char}. As an example, we choose
\begin{equation}
    \Psi_{\phi(t)}(k)=e^{-16k^2\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}}.
    \label{eq:charFun}
\end{equation}
This can be the characteristic function of a single Gaussian random variable, or the sum of several independent Gaussian random variables. For the former case, $\phi(t)$ is a Gaussian random variable with mean $0$ and time-dependent variance
\begin{equation}
    \sigma^2=32\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\left(\frac{\omega t}{2}\right).
\end{equation}
Note that the semi-classical example 2 considered in the previous subsection is included in this situation. For the latter case, we apply this characteristic function method to explicitly construct another semi-classical model, named example 3. To be specific, we can split the characteristic function Eq.~\eqref{eq:charFun} into the product of two exponentials, each one corresponding to the characteristic function of a Gaussian random variable,
\begin{align}
    \Psi_{\phi(t)}(k)&=e^{-16k^2\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}\sin^2\omega t}\nonumber\\
    &\times e^{-16k^2\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\frac{\omega t}{2}\cos^2\omega t}.
\end{align}
Thus $\phi(t)=v_1+v_2$ is the sum of two independent zero-mean Gaussian random variables $v_1$ and $v_2$, with variance
\begin{subequations}
\begin{align}
&\sigma^2_{v_1}=32\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\left(\frac{\omega t}{2}\right)\sin^2(\omega t),\\
&\sigma^2_{v_2}=32\frac{g^2}{\omega^2}(\tilde{n}+\frac{1}{2})\sin^2\left(\frac{\omega t}{2}\right)\cos^2(\omega t).
\end{align}
\end{subequations}
These can be realised by choosing
\begin{subequations}
\begin{align}
    &v_1=4\sqrt{2}\frac{g}{\omega}\sin\left(\frac{\omega t}{2}\right)\sin(\omega t)x_1,\\
    &v_2=4\sqrt{2}\frac{g}{\omega}\sin\left(\frac{\omega t}{2}\right)\cos(\omega t)x_2,
\end{align}
\end{subequations}
where $x_1$ and $x_2$ are two independent Gaussian random variables with mean $0$ and standard deviation $\sqrt{\tilde{n}+1/2}$. By making use of Eqs.~\eqref{eq:HamGen} and \eqref{eq:gT}, we get the Hamiltonian
\begin{align}
    \hat{H}_{sc3}=&-\frac{1}{\sqrt{2}}g\Big[\left(3\sin\frac{3\omega t}{2}-\sin\frac{\omega t}{2}\right)x_1\nonumber\\
    &+\left(3\cos\frac{3\omega t}{2}-\cos\frac{\omega t}{2}\right)x_2\Big]\hat{\sigma}_z.
\end{align}

\section{Non-classicality}
So far our approach has been to treat the problem in a semi-classical picture where only the atom position is a quantum mechanical degree of freedom and it is subject to a random unitary channel. In this section we look at non-classicality of the system when it is treated quantum mechanically as a whole (as described in section~\ref{sec:level1}). To analyze if entanglement can be inferred, we calculate the Wigner function negativity of the oscillator state when it interacts with the atomic interferometer. The negativity of the Wigner function is a measure of the non-classicality of a quantum state \cite{Kenfack2004}, and quantifies the extent to which the corresponding Wigner function has negative values.
The Wigner function of a quantum state $\ket{\psi}$ is defineded as
\begin{equation}
    W(q,p) = \frac{1}{2\pi \hbar} \int dx \braket{q-\frac{1}{2}x}{\psi}\braket{\psi}{q+\frac{1}{2}x}e^{\frac{ipx}{\hbar}}.
\end{equation}
The negativity of a Wigner function is defined as
\begin{align}
    \delta(W) &= \int dq \, dp\, \left(|W(q,p)| - W(q,p)\right) \nonumber \\
    &= \int dq \, dp\, |W(q,p)| - 1. \label{eq:wigneg}
\end{align}

The scheme in \cite{Carney2021} relies on enhancing the sensitivity for detecting entanglement (by witnessing the decline and revival of the entanglement visibility) through increased temperature of the oscillator. To the extent the state \eqref{eq:evolve} is entangled, the state of the oscillator should be in a superposition and hence non-classical.
The Wigner negativity was used in \cite{Kleckner2008} to study whether an oscillator achieved non-classical states if it is located in one arm of a single photon interferometer. There it was found that the negativity decreased as the initial temperature increased. We do a similar calculation here.

\begin{figure}[t]
    \centering
    \includegraphics[scale=0.6]{wig_neg_plot.pdf}
    \caption{Wigner negativity for the oscillator in state \eqref{eq:evolve} at a half mechanical period $t=\pi/\omega$ and after decoupling from the atom. Wigner function is given by \eqref{eq:wig}. The negativity increases for larger interaction strength $\lambda$ but decreases with increasing initial oscillator temperature.}
    \label{fig:wigneg}
\end{figure}

To study the state of the oscillator directly, we consider it at a half mechanical period $t=\pi/\omega$ where the entanglement is largest, and we decouple it from the atom by projecting the atom onto the state $\ketbra{+}{+}$, so as to not destroy the oscillator superposition.
The Wigner function of the oscillator in this state can be written in dimensionless quadrature operators as
\begin{equation}
W_{\rho_{\mathrm{th}}}(Q,P)= W_{+}(Q,P)+W_{-}(Q,P)+W_{\text{int}}(Q,P),\label{eq:wig}
\end{equation}
where
\begin{subequations}
\begin{align}
&W_{\pm}(Q,P) = \frac{1}{N} \exp\left(\frac{1}{2\tilde{n}+1}\left(-2P^{2}-\left(\sqrt{2}Q\pm\sqrt{8}\lambda\right)^{2}\right)\right), \\
&W_{\text{int}}(Q,P) = \frac{2}{N}\exp\left(\frac{1}{2\tilde{n}+1}\left(-2P^{2}-2Q^{2}\right)\right)\cos\left(8P\lambda\right),
\end{align}
\end{subequations}
where $\lambda = g/\omega$ and where
\begin{equation}
    N = \pi(2\tilde{n}+1)\left(1+e^{-8\lambda^{2}(2\tilde{n}+1)}\right).
\end{equation}
We see that when $\lambda=0$, the Wigner function is a Gaussian centred at the origin in phase space corresponding to the initial thermal state.

The integral \eqref{eq:wigneg} must be performed numerically, and we show the results in Fig.~\ref{fig:wigneg}. We see that the negativity increased with coupling strength $\lambda$, and when the interaction strength is zero the oscillator remains in a thermal state and hence is classical. For larger $\lambda$, the oscillator state contains more coherence at a half mechanical period and hence larger negativity. However the negativity decreases with initial oscillator temperature, and to achieve large negativity with high temperature requires a larger $\lambda$ to introduce enough coherence to compensate for the thermal noise.

This can be seen directly by rewriting \eqref{eq:wig} more compactly as
\begin{align}
&W_{\rho_{\mathrm{th}}}(Q,P)\label{eq:wigcompact}  \\
&\quad= \frac{2}{N}\exp\left(\frac{-2P^{2}-2Q^{2}}{2\tilde{n}+1}\right) \nonumber \\
&\qquad\times\left(\exp\left(\frac{-8\lambda^{2}}{2\tilde{n}+1}\right)\cosh\left(\frac{8Q\lambda}{2\tilde{n}+1}\right)+\cos(8P\lambda)\right),\nonumber
\end{align}
in which the negativity of the Wigner function is caused solely by the cosine term. This term will cause more negativity with larger $\lambda$. Decreasing $\tilde{n}$ also increases the negativity as it suppresses the exp-cosh term. The Wigner function will only be negative for $Q$ sufficiently close to zero, with the troughs occurring at $P=(2n+1)\pi/8\lambda$ for $n\in \mathbb{Z}$.

In other words, the evolved state \eqref{eq:evolve} of the oscillator becomes more classical as the initial temperature increases.
This is to be expected from our first semi-classical model (see section~\ref{sec:ex1}) which identically reproduces the same visibility decline and revival as the fully quantum mechanical model in the case of high temperatures, and differs only at lower temperatures. Unless the oscillator is very close to its ground state, the non-classicality is vanishingly small, especially for very low coupling strengths. Since $\lambda \ll 1$ in Ref. \cite{Carney2021}, one would need to operate at and independently verify the ground state of the oscillator to infer entanglement generation.

Let us look more closely at the negativity in the small coupling regime $\lambda \ll 1$. Let us assume that the system is in the ground state, $\tilde{n}=0$, since as we saw earlier, the negativity decreased with increasing temperature.
From \eqref{eq:wigcompact} one can use the triangle inequality to obtain
\begin{align}
|W_{\rho_{\mathrm{th}}}(Q,P)| &\leq \frac{2}{N}\exp\left(-2P^{2}-2Q^{2}\right) \\
&\quad\times\left(\exp\left(-8\lambda^{2}\right)\cosh\left(8Q\lambda\right)+1\right).\nonumber
\end{align}
Therefore, after integrating we have
\begin{equation}
    \delta(W_{\rho_{\text{th}}}) \leq \tanh\left(4\lambda^{2}\right).
\end{equation}
For $\lambda \ll 1$, we can approximate this as
\begin{equation}
    \delta(W_{\rho_{\text{th}}}) \lesssim 4\lambda^{2}.
\end{equation}
Thus we see that for small $\lambda$ the negativity of the oscillator state produced in the experiment \eqref{eq:evolve} becomes vanishingly small, even when the system begins in the ground state. For finite temperature, it effectively vanishes.

\section{Discussion}

The authors of \cite{Carney2021} support their claim that the collapse and revival of the interferometric visibility is a true signature of entanglement by proving a theorem that shows that if no quantum entanglement is generated, the visibility cannot revive. The theorem rests on some  assumptions, and since we claim to be providing semi-classical models which do not generate any entanglement but nevertheless display the same collapse and revival signature, we ought to discuss how our models contradict the theorem proved in \cite{Carney2021}.
Here we quote the theorem in full.

\begin{theorem}\label{thm:cmt}
Let $L$ be a channel on $H_{A}\otimes H_{B}$ where $H_{A}$ is a two-state system and $H_{B}$ is arbitrary. Assume that:
\begin{enumerate}
    \item The channel $L$ generates time evolution, in a manner consistent with the time-translation invariance, thus obeying a semigroup composition law $L_{t\rightarrow t^{\prime\prime}} = L_{t\rightarrow t^{\prime}}L_{t^{\prime}\rightarrow t^{\prime\prime}}$ for all $t\leq t^{\prime}\leq t^{\prime\prime}$.
    \item The two-level subsystem $H_{A}$ has its populations preserved under the time evolution, $\sigma_{z}(t) = \sigma_{z}(0)$.
    \item $L$ is a separable channel: all of its Kraus operators are simple products. In particular, this means that any initial separable (non-entangled) state evolves to a separable state: $\rho(t) = L_{t}[\rho(0)]$ is separable for all separable initial states $\rho(0)$.
\end{enumerate}
Then the visibility $V(t)$ is a monotonic function of time.
\end{theorem}

In our semi-classical models, the quantum channel is the random unitary channel given by Eqs. \eqref{eq:scState} and \eqref{eq:scU}. Since it commutes with $\sigma_{z}$ it clearly satisfies assumption 2, and by appending an arbitrary Hilbert space $H_{B}$, then we see that $L \otimes \mathbb{I}$ satisfies assumption 3 as well. Thus the conflict with this theorem must lie in the first assumption. Indeed, the proof of Theorem 1 in Ref.~\cite{Carney2021} relies on the form of Lindblad master equation, where the Lindblad operators are time independent. The sufficient and necessary condition for the existence of such a Lindblad master equation is the divisibility of the master equation (the first condition of theorem~\ref{thm:cmt}). The additional assumption of time-translation invariance implies that the Lindblad operators are time-independent and this is used in the proof. This is equivalent to requiring the quantum channel satisfy a one-parameter semigroup composition law $L_{t_{1}}L_{t_{2}} = L_{t_{1}+t_{2}}$.

Our semi-classical models are not divisible, thus they do not correspond to a Lindblad master equation for the atom.
However our first semiclassical model is in fact time translation invariant.
Although there is explicit time dependence in the Hamiltonian in our semi-classical models, which indicates that the Hamiltonian is not time translation invariant, that does not mean that the corresponding random unitary channel after averaging over the classical randomness is not time translation invariant.
It is straightforward to check that our first semi-classical model is time translation invariant by showing that $L_{0\rightarrow \tau}=L_{t\rightarrow t+\tau}$ for all $t$.

The existence of our semi-classical models demonstrates that the conditions of this theorem are very restrictive, as many simple semi-classical models reproduce the decline and revival of interferometric visibility.

\section{Conclusions}
Experiments to probe the quantum nature of gravity have become promising research directions in recent years. While some proposals aim to test specific models \cite{marshall2003towards, pikovski2012probing, bekenstein2012tabletop, bassi2017gravitational}, others focus on indirect signatures of the quantization of gravity through gravitational generation of entanglement \cite{bose2017spin, marletto2017gravitationally, pedernales2021enhancing, Carney2021}. The proposed signature in Ref. \cite{Carney2021} is the loss and revival of visibility in an atomic interferometer, under specific assumptions on the dynamics. Here we show that this signature appears also in simple semi-classical models, thus such a signature by itself cannot indicate entanglement between the systems. According to the Ehrenfest theorem, the average behavior of a harmonic oscillator can be classically described. It is thus important to explore the classical picture to test whether specific signatures can reflect quantum behavior.
The semi-classical models we have discussed are reasonably general and applicable to other systems and states. In fact, a random unitary channel represents the time evolution of a quantum system under the influence of classical systems containing classical uncertainties~\cite{audenaert2008random}. As the collapse and revival of the interference visibility can be reproduced by the atom subject to random unitary channels, they cannot be considered good signatures of entanglement generation.

Our results do not contradict the claims of Ref. \cite{Carney2021} since the models we present do not satisfy the conditions on the dynamics under which entanglement can be inferred. But our findings highlight that such conditions are violated in many semi-classical scenarios. This indicates that the conditions imposed on the dynamics in Ref. \cite{Carney2021} are very restrictive: they exclude simple and reasonable classical dynamics, and thus leave little room to test against the inference of entanglement generation unless there is supplementary evidence that the conditions are satisfied. For the very low coupling strengths envisioned in the experiment, the non-classicality vanishes unless the oscillator is nearly exactly in its ground state.
It therefore remains a significant challenge to verify the quantum nature of the interaction in such an experimental scenario.

\emph{Note added} -- We were made aware of Ref.~\cite{hosten2021testing} after we complete the manuscript. Ref.~\cite{hosten2021testing} is closely related to Sec.~\ref{sec:ex1} to show that collapses and revivals can also be explained using a semi-classical mean-field model.

\acknowledgements

MSK and YM thank EPSRC for financial supports (EP/R044082/1, EP/P510257/1). IP and TG acknowledge support by the Swedish Research Council under
grant no. 2019-05615. IP also acknowledges support by the European Research Council under grant no. 742104 and The Branco Weiss Fellowship -- Society in Science.

\providecommand{\noopsort}[1]{}\providecommand{\singleletter}[1]{#1}%