# One-Class Learning for AI-Generated Essay Detection
## 2 Materials and Methods
### One-Class Models
Considering the \(k\)-distance \((A)\) as the distance of instance \(A\) from its \(k\)-th nearest neighbors, it is possible to define the notion of reachability distance: \[RD_{k}(A,B)=max\{k-d(B),distance(A,B)\}.\] Instances that belong to the \(k\) nearest neighbors of \(B\) are considered to be equally distant. The local reachability density of an instance \(A\) defined as \(lr_{k}(B)\) is the inverse of the average reachability distance of the object \(A\) from its neighbors. Local reachability densities are compared with those of the neighbors as: \[LOF_{k}(A):=\frac{\Sigma_{B\in N_{k}(A)}\frac{lr_{k}(B)}{lr_{k}(A)}}{|N_{k}(A )|}=\frac{\Sigma_{B\in N_{k}(A)}lr_{k}(B)}{|N_{k}(A)|\cdot lr_{k}(A)},\] which represents the average local reachability density of neighbors divided by the local reachability density of the instance. A value lower than 1 is indicative of a higher density than neighbors (inlier), whereas a value greater than 1 is indicative of a lower density than neighbors (outlier). * **Isolation Forest**[45]: It uses a group of tree-based models and calculates an isolation score for every data instance (essay). The average distance that lies from the tree's root to the leaf associated with the data instance, corresponding to the number of partitions required to reach the instance, is used to compute the anomaly score. Considering that more noticeable variations in values relatively correspond to shorter paths in the tree, the method uses this information to distinguish one abnormal observation (AI-generated essays) from the rest (human essays). The anomaly score is defined as \[s(x,n)=2^{-\frac{E(R(x))}{c(n)}},\] where \(h(x)\) is the path length of the instance \(x\), \(c(n)\) is the average path length of unsuccessful search in the Binary Search Tree, and \(n\) is the number of external nodes. An anomaly score close to 1 indicates that an instance has a high chance to be an anomaly (AI-generated essay), whereas scores smaller than 0.5 are indicative of a normal instance (human essay). * **Angle-Base Outlier Detection (ABOD)**[46; 47]: is a widely adopted method that calculates the variance of weighted cosine scores between each data instance and its neighbors and uses that variance as the anomaly score. It has the ability to reduce the frequency of false positive detections by effectively identifying relationships in high-dimensional spaces between each instance and its neighbors rather than interactions among neighbors. * **Histogram-based Outlier Score (HBOS)**[48]: It is a straightforward statistical approach for anomaly detection that assumes feature independence. The main concept is the generation a histogram for each feature of the data. Subsequently, for each instance, the method multiplies the inverse height of the bins associated to it, providing an assessment of the density of all features. This behavior is conceptually similar to the Naive Bayes algorithm for classification, which is known for multiplying all independent feature probabilities. Histograms represent a quick and effective way to identify anomalies (AI-generated essays). Even though feature relationships are ignored (i.e., the method assumes feature independence), this simplification allows the method to converge quickly. HBOS builds histograms in two different modalities: (i) static bin sizes and a preset bin width, and (ii) dynamic bins with a close-to-equal number of bins. * **AutoEncoder**: A neural network model used to learn efficient representation of unlabeled data in an unsupervised manner. It learns two functions: an encoding function that transforms the input data, and a decoding function that recreates the input data from the encoded representation. The learned representation can be used to address detection tasks by performing the reconstruction of new data instances and comparing their reconstruction error with that of the learned distribution.