11institutetext: Kyushu University, Fukuoka, Japan
11email: {xiaotong.ji<EMAIL_ADDRESS>
11email: {suehiro<EMAIL_ADDRESS>RIKEN Center for
Advanced Intelligence Project, Tokyo, Japan

# Revealing Reliable Signatures
by Learning Top-Rank Pairs

Xiaotong Ji 11111The author contribute equally to this paper.11footnotemark: 1
Yan Zheng 1111footnotemark: 111footnotemark: 1 Daiki Suehiro 1122
0000-0001-8901-9063 Seiichi Uchida 11 0000-0001-8592-7566

###### Abstract

Signature verification, as a crucial practical documentation analysis task,
has been continuously studied by researchers in machine learning and pattern
recognition fields. In specific scenarios like confirming financial documents
and legal instruments, ensuring the absolute reliability of signatures is of
top priority. In this work, we proposed a new method to learn “top-rank pairs”
for writer-independent offline signature verification tasks. By this scheme,
it is possible to maximize the number of absolutely reliable signatures. More
precisely, our method to learn top-rank pairs aims at pushing positive samples
beyond negative samples, after pairing each of them with a genuine reference
signature. In the experiment, BHSig-B and BHSig-H datasets are used for
evaluation, on which the proposed model achieves overwhelming better pos@top
(the ratio of absolute top positive samples to all of the positive samples)
while showing encouraging performance on both Area Under the Curve (AUC) and
accuracy.

###### Keywords:

writer-independent signature verification top-rank learning absolute top

##  1 Introduction

As one of the most important topics in document processing systems, signature
verification has become an indispensable issue in modern society [1, 2].
Precisely, it plays important role in enhancing security and privacy in
various fields, such as finance, medical, forensic agreements, etc. As
innumerable significant documents are signed almost every moment throughout
the world, automatically examining the genuineness of the signed signatures
has become a crucial subject. Since misjudgment is hardly allowed especially
in serious and formal situations like in forensic usages, obtaining “highly
reliable” signatures is of great importance.

Fig. 2 illustrates two scenarios of signature verification. In the writer-
dependent scenario (a), it is possible to prepare the verifiers specialized
for individuals. In contrast, in the writer-independent scenario (b), we can
prepare only a single and universal classifier that judges whether a pair of a
questioned signature (i.e., a query) and a genuine reference signature are
written by the same person or not. Consequently, for a reliable writer-
independent verification, the classifier needs (i) to deal with various
signatures of various individuals and (ii) not to accept unreliable pairs with
some confidence.

Figure 1: Two scenarios of signature verification. ‘Q’ and ‘G’ are the query
signature and a genuine reference signature, respectively.

Figure 2: (a), (b) Two ranking methods and (c) their corresponding ROCs. In
(a) and (b), a thick arrow is a ranking function that gives higher rank scores
to positive samples (purple circles) than negative samples (pink circles).
Each dotted line is an “equi-distance” line.

In this paper, we propose a new method to learn top-rank pairs for highly-
reliable writer-independent signature verification. The proposed method is
inspired by top-rank learning [3, 4, 5]. Top-rank learning is one of the
ranking tasks but is different from the standard ranking task. Fig. 2 shows
the difference of top-rank learning from standard learning to rank. The
objective of the standard ranking task (a) is to determine the ranking
function that evaluates positive samples much higher than negative samples as
possible. This objective is equivalent to maximize AUC. In contrast, top-rank
learning (b) has a different objective to maximize absolute top positives,
which are highly-reliable positive samples in the sense that no negative
sample has a higher rank than them. In (c), the very beginning of the ROC of
top-rank learning is a vertical part; this means that there are several
positive samples that have no negative samples ranked higher than them.
Consequently, Top-rank learning can derive absolute top positives as highly
reliable positive samples. The ratio of absolute top positives over all
positives is called<EMAIL_ADDRESS>
The proposed method to learn top-rank pairs accepts a paired feature vector
for utilizing the promising property of top-rank learning for writer-
independent signature verification. As shown in Fig. 2 (b), the writer-
independent scenario is based on the pairwise evaluation between a query and a
genuine reference. To integrate this pairwise evaluation into top-rank
learning, we first concatenate $q$ and $g$ into a single paired feature vector
$\boldsymbol{x}=q\oplus g$, where $q$ and $g$ denote the feature vector of a
query and a genuine reference, respectively. The paired vector
$\boldsymbol{x}$ is treated as positive when $q$ is written by the genuine
writer and denoted as $\boldsymbol{x}^{+}$; similarly, when $q$ is written by
a forgery, $\boldsymbol{x}$ is negative and denoted as $\boldsymbol{x}^{-}$.

We train the ranking function $r$ with the positive paired vectors
$\\{\boldsymbol{x}^{+}\\}$ and the negative paired vectors
$\\{\boldsymbol{x}^{-}\\}$, by top-rank learning. As the result, we could have
highly reliable positives as absolute top positives; more specifically, a
paired signature in the absolute top positives is “a more genuine pair” than
the most genuine-like negative pair (i.e., the most-skilled forgery), called
top-ranked negative, therefore highly reliable. Although being an absolute top
positive is much harder than just being ranked higher, we could make a highly
reliable verification by using the absolute top positives and the trained
ranking function $r$.

To prove the reliability of the proposed method in terms of pos@top, we
conduct writer-independent offline signature verification experiments with two
publicly-available datasets: BHSig-B and BHSig-H. We use SigNet [1] as not
only the extractor of deep feature vectors ($q$ and $g$) from individual
signatures but also a comparative method. SigNet is the current state-of-the-
art model of offline signature verification. The experimental results prove
that the proposed method outperforms SigNet not only pos@top but also other
conventional evaluation metrics, such as accuracy, AUC, FAR, and FRR.

Our contributions are arranged as follows:

  * •

We propose a novel method to learn top-rank pairs. This method is the first
application of top-rank learning to conduct a writer-independent signature
verification task to the best knowledge of the authors, notwithstanding that
the concepts of top-rank learning and absolute top positives are particularly
appropriate to highly reliable signature verification tasks.

  * •

Experiments on two signature datasets have been done to evaluate the effect of
the proposed method, including the comparison with the SigNet. Especially, the
fact that the proposed method achieves higher pos@top proves that the trained
ranking function gives a more reliable score that guarantees “absolutely
genuine” signatures.

##  2 Related Work

The signature verification task has attracted great attention from researchers
since it has been proposed [6, 7]. Generally, signature verification is
divided into online [8] as well as offline [9, 10] fashions. Online signatures
offer pressure and stroke order information that is favorable to time series
analysis methods [11] like Dynamic Time Warping (DTW) [12]. On the other hand,
offline signature verification should be carried out only by making full use
of image feature information [13]. As a result, acquiring efficacious features
from offline signatures [7, 14, 15] has become a highly anticipated challenge.

In recent years, CNNs have been widely used in signature verification tasks
thanks to their excellent representation learning ability [16, 17]. Among CNN-
based models, Siamese network [18, 19] is one of the common choices when it
comes to signature verification tasks. Specifically, a Siamese network is
composed of two identically structured CNNs with shared weights, particularly
powerful for similarity learning, which is a preferable learning objective in
signature verification. For example, Dey et al. proposed a Siamese network-
based model that optimizes the distances between two inputted signatures,
shows outstanding performance on several famous signature datasets [1]. Wei et
al. also employed the Siamese network, and by utilizing inverse gray
information with multiple attention modules, their work showed encouraging
results as well [20]. However, none of the those approaches target revealing
highly reliable genuine signatures.

To acquire the highly reliable genuine signatures, learning to rank [21, 22]
is a more reasonable approach than learning to classify. This is because
learning to rank allows us to rank the signatures in order of genuineness.
Bipartite ranking [23] is one of the most standard learning-to rank-approach.
The goal of the bipartite ranking is to find a scoring function that gives a
higher value to positive samples than negative samples. This goal corresponds
to the maximization of AUC (Area under the ROC curve), and thus bipartite
ranking has been used in various domains [24, 25, 26].

As a special form of bipartite ranking, the top-rank learning strategy [3, 4,
5] possesses characteristics that are more suitable for absolute top positive
hunting. In contrast to the standard bipartite ranking, top-rank learning aims
at maximizing the absolute top positives, that is, maximizing the number of
positive samples ranked higher than any negative sample. Therefore, top-rank
learning is suitable for some tough tasks that require possibly highly
reliable (e.g., medical diagnosis [27]). To the best of our knowledge, this is
the first application of top-rank learning to the signature verification task.

TopRank CNN [27] is a representation learning version of the conventional top-
rank learning scheme, which combines the favorable characteristics of both CNN
and the top-rank learning scheme. To be more specific, when encountered with
entangled features in which positive is chaotically tied with negative,
conventional top-rank learning methods without representation learning
capability like TopPush [3] can hardly achieve a high pos@top. That is to say,
the representation learning ability of CNN structure makes the TopRank CNN a
more powerful top-rank learning method. Moreover, for avoiding the easily-
happen over-fitting phenomenon, TopRank CNN considerately attached the max
operation with the p-norm relaxation.

Despite the superiority of ranking schemes, studies that apply ranking
strategies on signature verification tasks are still in great demand. Chhabra
et al. in [28] proposed a Deep Triplet Ranking CNN, aiming at ranking the
input signatures in genuine-like order by minimizing the distance between
genuine and anchors. In the same year, Zheng et al. proposed to utilize
RankSVM for writer-dependent classification, to ensure the generalization
performance on imbalanced data [2]. However, even if they care about ranking
results to some extent, no existing studies have been dedicated to the
absolute top genuine signatures yet. To address this issue, this work is
mainly designed to focus on obtaining the absolute top genuine signatures,
implemented by learning top-rank pairs for writer-independent offline
signature verification tasks.

Figure 3: The overall structure of the proposed method to learn top-rank pairs
for writer-independent signature verification. (a) Feature representation of
paired samples. (b) Learning top-rank pairs with their representation. (c)
Top-rank loss function $\mathcal{L}_{\mathrm{TopRank}}$.

##  3 Learning Top-Rank Pairs

Fig. 3 shows the overview of the proposed method to learn top-rank pairs for
writer-independent offline signature verification. The proposed method
consists of two steps: a representation learning step and a top-rank learning
step. Fig. 3 (a) shows the former step and (b) and (c) show the latter step.

###  3.1 Feature representation of paired samples

As shown in Fig. 2 (b), each input is a pair of a genuine reference sample $g$
and a query sample $q$ for writer-independent signature verification. Then the
paired samples $(g,q)$ are fed to some function to evaluate their discrepancy.
If the evaluation result shows a large discrepancy, the query is supposed to
be a forgery; otherwise, the query is genuine.

Now we concatenate the two $d$-dimensional feature vectors ($g$ and $q$) into
a $2d$-dimensional single vector as shown in Fig. 3 (a). Although the
concatenation doubles the feature dimensionality, it allows us to treat the
paired samples in a simple way. Specifically, we consider a (Genuine $g$,
Genuine $q^{+}$)-pair as a positive sample with the feature vector
$\boldsymbol{x}^{+}=g\oplus q^{+}$ and a (Genuine $g$, Forgery $q^{-}$)-pair
as a negative sample with $\boldsymbol{x}^{-}=g\oplus q^{-}$. If we have $m$
(Genuine, Genuine)-pairs and $n$ (Genuine, Forgery)-pairs, we have two sets
$\mathbf{\Omega}^{+}=\\{\boldsymbol{x}_{i}^{+}\ |\ i=1,\ldots,m\\}$ and
$\mathbf{\Omega}^{-}=\\{\boldsymbol{x}_{j}^{+}\ |\ j=1,\ldots,n\\}$.

Under this representation, the writer-independent signature verification task
is simply formulated as a problem to have a function $r(\boldsymbol{x})$ that
gives a large value for $\boldsymbol{x}_{i}^{+}$ and a small value for
$\boldsymbol{x}_{j}^{-}$. Ideally, we want to have $r(\boldsymbol{x})$ that
satisfies $r(\boldsymbol{x}_{i}^{+})>r(\boldsymbol{x}_{j}^{-})$ for arbitrary
$\boldsymbol{x}_{i}^{+}$ and $\boldsymbol{x}_{j}^{-}$. In this case, we have a
constant threshold $\theta$ that satisfies
$\max_{j}r(\boldsymbol{x}_{j}^{-})<\theta<\min_{i}r(\boldsymbol{x}_{i}^{+})$.
If $r(\boldsymbol{x})>\theta$, $\boldsymbol{x}$ is simply determined as a
(Genuine, Genuine)-pair. However, in reality, we do not have the ideal $r$ in
advance; therefore we need to optimize (i.e., train) $r$ so that it becomes
closer to the ideal case under some criterion. In 3.2, pos@top is used as the
criterion so that trained $r$ gives more absolute tops.

As indicated in Fig. 3 (a), each signature is initially represented as a
$d$-dimensional vector $g$ (or $q$) by SigNet [1], which is still a state-of-
the-art signature verification model realized by metric learning with the
contrastive loss. Although it is possible to use another model to have the
initial feature vector, we use SigNet throughout this paper. The details of
SigNet will be described in 3.4.

###  3.2 Optimization to learn top-rank pairs

We then use a top-rank learning model for optimizing the ranking function
$r(\boldsymbol{x})$. As noted in Section 1, top-rank learning aims to maximize
pos@top, which is formulated as:

$\displaystyle\mathrm{pos@top}=\frac{1}{m}\sum_{i=1}^{m}I\left(r(\boldsymbol{x}_{i}^{+})>\max_{1\leq
j\leq n}r(\boldsymbol{x}_{j}^{-})\right),$ (1)

where $I(z)$ is the indicator function. pos@top evaluates the number of
positive samples with a higher value than any negative samples. The positive
samples that satisfy the condition in Eq.1 are called absolute top positives
or just simply absolute tops. Absolute tops are very “reliable” positive
samples because they are more positive than the top-ranked negative, that is,
the “hardest” negative $\max_{1\leq j\leq n}r(\boldsymbol{x}_{j}^{-}).$

Among various optimization criteria, pos@top has promising properties for the
writer-independent signature verification task. Maximization of pos@top is
equivalent to the maximization of absolute tops — this means we can have
reliable positive samples to the utmost extent. In a very strict signature
verification task, the query sample $q$ is verified as genuine only when the
concatenated vector $\boldsymbol{x}=g\oplus q$ becomes one of the absolute
tops. Therefore, having more absolute tops by maximizing pos@top will give
more chance that the query sample is completely trusted as genuine.

Note that we call $r(\boldsymbol{x})$ as a “ranking” function, instead of just
a scoring function. In Eq. (1), the value of the function $r$ is used just for
the comparison of samples. This suggests that the value of $r$ has no absolute
meaning. In fact, if we have a maximum pos@top by a certain
$r(\boldsymbol{x})$, $\phi(r(\boldsymbol{x}))$ also achieves the same pos@top,
where $\phi$ is a monotonically-increasing function. Consequently, the ranking
function $r$ specifies the order (i.e., the rank) among samples.

We will optimize $r$ to maximize $\boldsymbol{x}^{+}$ in pos@top. Top-Rank
Learning is the existing problem to maximize pos@top for a training set whose
samples are individual (i.e., unpaired) vectors. In contrast, our problem to
learn top-rank pairs is a new ranking problem for the paired samples, and
applicable to various ranking problems where the relative relations between
two vectors are important ***Theoretically, learning top-rank pairs can be
extended to handle vectors obtained by concatenating three or more individual
vectors. With this extension, our method can rank the mutual relationship
among multiple vectors..

As noted in 3.3 and shown in Fig. 3 (b), we train $r$ along with a deep neural
network (DNN) to have a reasonable feature space to have more pos@top.
However, there are some risks when we maximize Eq. (1) directly using a DNN,
if it has a high representation flexibility. The most realistic case is that
the DNN overfits some outliers or noise. For example, if a negative outlier is
distributed over the positive training samples, achieving the perfect pos@top
is not a reasonable goal.

To avoid such risks, we employ the $p$-norm relaxation technique [29, 27].
More specifically, we convert the maximization of pos@top into the
minimization of the following loss:

$\displaystyle\mathcal{L}_{\mathrm{TopRank}}\left(\mathbf{\Omega^{+}},\mathbf{\Omega^{-}}\right)=\frac{1}{m}\sum_{i=1}^{m}\left(\sum_{j=1}^{n}\left(l(r(\boldsymbol{x}_{i}^{+})-r(\boldsymbol{x}_{j}^{-}))\right)^{p}\right)^{\frac{1}{p}},$
(2)

where $l(z)=\log(1+e^{-z})$ is a surrogate loss. Fig. 3 (c) illustrates
$\mathcal{L}_{\mathrm{TopRank}}$. When $p=\infty$, Eq. (2) is reduced to
$\mathcal{L}_{\mathrm{TopRank}}=\frac{1}{m}\sum_{i=1}^{m}\max_{1\leq j\leq
n}l(r(\boldsymbol{x}_{i}^{+})-r(\boldsymbol{x}_{j}^{-}))$, which is equivalent
to the original pos@top loss of Eq. (1). If we set $p$ at a large value (e.g.,
32), the Eq. (2) approaches the original loss of pos@top. In [27], it is noted
that it is better not to select a too large $p$, because it has a risk of
over-fitting and the overflow error in the implementation.

Figure 4: The learning mechanisms of SigNet (top) and the learning top-rank
pairs (bottom).

###  3.3 Learning top-rank pairs with their representation

In order to have a final feature representation to have a more pos@top, we
apply a DNN to convert $\boldsymbol{x}$ non-linearly during the training
process of $r$. Fig. 3 (b) shows the process with the DNN. Each of the paired
feature vectors in a minibatch is fed to a DNN. In the DNN, the vectors are
converted to another feature space and then their ranking score $r$ is
calculated. The parameters of DNN are trained by the loss function
$\mathcal{L}_{\mathrm{TopRank}}$.

###  3.4 Initial features by SigNet

As noted in 3.1, we need to have initial vectors ($g$ and $q$) for individual
signatures by an arbitrary signature image representation method. SigNet [1]
is the current state-of-the-art signature verification method and achieved
high performance in standard accuracy measures. As shown in Fig. 3 (a), SigNet
is based on metric learning with a contrastive loss and takes a pair of a
reference signature and a query signature as its input images. For all pairs
of reference and query signatures, SigNet is optimized to decrease the
distance between (Genuine, Genuine)-pairs and increase the distance between
(Genuine, Forgery)-pairs. The trained network can convert a reference image
into $g$ and a query into $q$. Then a positive sample $\boldsymbol{x}_{i}^{+}$
or a negative sample $\boldsymbol{x}_{j}^{-}$ is obtained by the concatenation
$g\oplus q$, as described in 3.1.

Theoretically, we can conduct the end-to-end training of SigNet in Fig. 3 (a)
and DNN in (b). In this paper, however, we fix the SigNet model after its
independent training with the contrastive loss. This is simply to make the
comparison between the proposed method and SigNet as fair as possible. (In
other words, we want to purely observe the effect of pos@top maximization and
thus minimize the extra effect of further representation learning in SigNet.)

One might misunderstand that the metric learning result by SigNet and the
ranking result by top-rank learning in the proposed method are almost
identical; however, as shown in Fig. 4, they are very different. As we
emphasized so far, the proposed method aims to have more pos@top; this means
we have a clear boundary between the absolute tops and the others. In
contrast, SigNet has no such function. Consequently, SigNet might have a risk
that a forgery has a very small distance with a genuine. Finally, this forgery
will be wrongly considered as one of the reliable positives, which are
determined by applying a threshold $\lambda$ to the distance by SigNet.

##  4 Experiments

In this section, we demonstrate the effectiveness of the proposed method on
signature verification tasks. Specifically, we consider a comparative
experiment with SigNet which is known as the outstanding method for the
signature verification tasks.

###  4.1 Datasets

In this work, the BHSig260 offline signature dataset†††Available at
http://www.gpds.ulpgc.es/download is used for the experiments‡‡‡CEDAR dataset
that is also used in [1] was not used in this work because it has achieved
100% accuracy in the test set. Besides, GPDS 300 and GPDS Synthetic Signature
Corpus datasets are restricted from obtaining, which composes two subsets
where one set of signatures are signed in Bengali (named BHSig-B) and the
other in Hindi (named BHSig-H). The BHSig-B dataset includes 100 writers in
total, each of them possesses 24 genuine signatures and 30 skillfully forged
signatures. On the other hand, BHSig-H dataset contains 160 writers, each of
them own genuine and forged signatures same as BHSig-B. In the experiments,
both of the datasets are divided into training, validation, and test set to
the ratio of 8: 1: 1.

Following the writer-independent setting, we evaluate the verification
performance using the pair of signatures. That is, the task is to verify that
the given pair is (Genuine, Genuine) or (Genuine, Forgery). We prepare a total
of 276 (Genuine, Genuine)-pairs for each writer and a total of 720 (Genuine,
Forgery)-pairs for each writer.

###  4.2 Experimental Settings

####  4.2.1 Setting of the SigNet

SigNet is also based on a Siamese network architecture, whose optimization
objective is similarity measurement. In the experiment, we followed the
training setting noted in [1], except for the modifications of the data
division.

####  4.2.2 Setting of the proposed method

As introduced in Section 3.4, we used the extracted features from the trained
SigNet (124G Floating point operations (FLOPs)) as the initial features. For
the learning top-rank pairs with their representation, we used a simple
architecture, 4 fully-connected layers (2048, 1024, 512 and 128 nodes
respectively) with ReLU function (1G FLOPs). The hyper-parameter $p$ of the
loss function 2 is chosen from $\\{2,4,8,16,32\\}$ based on the validation
pos@top. As a result, we obtained $p$=4 for BHSig-B and $p$=16 for BHSig-H.
The following results and the visualization are obtained by using these hyper-
parameters.

###  4.3 Evaluation metrics

In the experiment, pos@top, accuracy, AUC, False Rejection Rate (FRR), and
False Acceptance Rate (FAR) are used to comprehensively evaluate the proposed
method and SigNet.

  * •

pos@top: The ratio of the absolute top (Genuine, Genuine) signature pairs to
the number of all of the (Genuine, Genuine) signature pairs (see also Eq.
(1)).

  * •

Accuracy: The maximum result of the average between True Positive Rate (TPR)
and True Negative Rate (TNR), following the definition in [1].

  * •

AUC: Area under the ROC curve.

  * •

FAR: The ratio of the number of falsely accepted (Genuine, Forgery) signature
pairs divided by the number of all (Genuine, Forgery) signature pairs.

  * •

FRR: The ratio of the number of falsely rejected (Genuine, Genuine) signature
pairs divided by the number of all (Genuine, Genuine) signature pairs.

###  4.4 Quantitative and qualitative evaluations

Table 1: The comparison between the proposed method and SigNet on BHSig-B and BHSig-H datasets. Dataset | Approaches | pos@top ($\uparrow$) | Accuracy ($\uparrow$) | AUC ($\uparrow$) | FAR ($\downarrow$) | FRR ($\downarrow$)
---|---|---|---|---|---|---
BHSig-B | proposed | 0.283 | 0.806 | 0.889 | 0.222 | 0.222
SigNet | 0.000 | 0.756 | 0.847 | 0.246 | 0.247
BHSig-H | proposed | 0.114 | 0.836 | 0.908 | 0.179 | 0.178
SigNet | 0.000 | 0.817 | 0.891 | 0.192 | 0.192

(a) ROC curves (full and zoom) on BHSig-B

(b) ROC curves (full and zoom) on BHSig-H

Figure 5: The comparison of ROC curves between the proposed method and SigNet
on BHSig-B and BHSig-H datasets.

(a) PCA result of the proposed method on BHSig-B

(b) PCA result of the proposed method on BHSig-H

(c) Histogram of the ranking scores of the proposed method with a zoomed view
on BHSig-B

(d) Histogram of the ranking scores of the proposed method with a zoomed view
on BHSig-H

(e) Histogram of the ranking scores of SigNet with a zoomed view on BHSig-B

(f) Histogram of the ranking scores of SigNet with a zoomed view on BHSig-H

Figure 6: (a) and (b) PCA visualizations of feature distribution for the
proposed method. The top-ranked negative and the absolute top positives are
highlighted. (c)-(f) Distributions of the ranking scores as histograms. The
horizontal and vertical axes represent the ranking score and #samples,
respectively.

The quantitative evaluations of the proposed method and SigNet on two datasets
are shown in Table 1. Remarkably, the proposed method achieved an overwhelming
better performance on pos@top, while pos@top of SigNet is 0 for both datasets.
This proves that the proposed method can reveal absolute top positive
signature pairs (i.e., highly reliable signature pairs). Furthermore, the
proposed method also outperformed the comparison method on all other
evaluation criteria, accuracy and AUC, lower FAR, and FRR.

The ROC curves of the proposed method and SigNet on two datasets are shown in
Fig. 5 respectively, each followed by a corresponding zoom view of the
beginning part of ROC curves. As a more intuitive demonstration of Table 1,
other than the larger AUC, it is extremely obvious that the proposed method
achieved higher pos@top, which is the True Positive Rate (TPR) for $x=0$.

Figs. 6 (a) and (b) show the distributions of features from the proposed
method mapped by Principal Component Analysis (PCA) on two datasets, colored
by ranking scores (normalized within the range [0,1]). From the
visualizations, we can easily notice the absolute top positive sample pairs
distinguished by the top-ranked negative.

Following the feature distributions, Figs. 6 (c) and (d) give a more intuitive
representation of the ranking order for the learning top-rank pairs. These
graphs include information of (1) where did the top-ranked negative appear and
(2) how many (Genuine, Genuine) and (Genuine, Forgery)-pairs are scored to the
same rank. It could be observed that the first negative appeared after a
portion of positive from these two graphs. On the other hand, Figs. 6 (e) and
(f) show the ranking conditions of SigNet. Since the first negative pair shows
on the top of the ranking, this causes 0 pos@top for both datasets.

Figure 7: Examples of (a)(b) absolute top (Genuine, Genuine)-pairs, (c)(d)
non-absolute top (Genuine, Genuine)-pairs, and (e)(f) (Genuine, Forgery)-pairs
from BHSig-B and BHSig-H respectively.

As shown in Fig. 7, the absolute top (Genuine, Genuine)-pairs in (a) and (b)
show great similarity to their counterparts. Especially, the consistency in
their strokes and preference of oblique could be easily noticed even with the
naked eye. On the other hand, both the non-absolute top (Genuine,
Genuine)-pairs in (c) and (d) and (Genuine, Forgery)-pairs in (e) and (f) show
less similarity to their corresponding signatures, no matter whether they are
written by the same writer or not. Notwithstanding that they are all assigned
with low ranking scores by learning top-rank pairs, such resemblance between
two different classes could easily incur misclassification in conventional
methods. Thus, our results shed light on the validity of the claimed
effectiveness of the proposed method to maximize the pos@top.

##  5 Conclusion

As a critical application especially for formal scenarios like forensic
handwriting analysis, signature verification played an important role since it
has been proposed. In this work, we proposed a writer-independent signature
verification model for learning top-rank pairs. What is novel and interesting
for this model is that the optimization objective of top-rank learning is to
maximize the pos@top, to say the highly reliable signature pairs in this case.
This optimization goal has fulfilled the requirement of the intuitive need of
signature verification tasks to acquire reliable genuine signatures, not only
to naively classify positive from negative. Through two experiments on data
set BHSig-B and BHSig-H, the effectiveness of pos@top maximization has been
proved compared with a metric learning-based network, the SigNet. Besides, the
performance of the proposed model on the AUC, accuracy, and other common
evaluation criteria frequently used in signature verification shown
encouraging results as well.

## References

  * [1] S. Dey, A. Dutta, J. I. Toledo, S. K. Ghosh, J. Lladós, and U. Pal, “Signet: Convolutional siamese network for writer independent offline signature verification,” _CoRR_ , vol. abs/1707.02131, 2017.
  * [2] Y. Zheng, Y. Zheng, W. Ohyama, D. Suehiro, and S. Uchida, “Ranksvm for offline signature verification,” in _Proceedings of the ICDAR_ , 2019, pp. 928–933.
  * [3] N. Li, R. Jin, and Z. Zhou, “Top rank optimization in linear time,” in _Proceedings of the NIPS_ , 2014, pp. 1502–1510.
  * [4] J. Fréry, A. Habrard, M. Sebban, O. Caelen, and L. He-Guelton, “Efficient top rank optimization with gradient boosting for supervised anomaly detection,” in _Proceedings of the ECML-PKDD, Part I_ , vol. 10534, 2017, pp. 20–35.
  * [5] S. P. Boyd, C. Cortes, M. Mohri, and A. Radovanovic, “Accuracy at the top,” in _Proceedings of the NIPS_ , 2012, pp. 962–970.
  * [6] D. Impedovo and G. Pirlo, “Automatic signature verification: The state of the art,” _IEEE Trans. Syst. Man Cybern. Part C_ , vol. 38, pp. 609–635, 2008.
  * [7] L. G. Hafemann, R. Sabourin, and L. S. Oliveira, “Offline handwritten signature verification - literature review,” in _Proceedings of the IPTA_ , 2017, pp. 1–8.
  * [8] L. L. Lee, T. Berger, and E. Aviczer, “Reliable online human signature verification systems,” _IEEE Trans. Pattern Anal. Mach. Intell._ , vol. 18, pp. 643–647, 1996.
  * [9] M. K. Kalera, S. N. Srihari, and A. Xu, “Offline signature verification and identification using distance statistics,” _Int. J. Pattern Recognit. Artif. Intell._ , vol. 18, pp. 1339–1360, 2004.
  * [10] M. A. Ferrer, J. F. Vargas-Bonilla, A. Morales, and A. Ordonez, “Robustness of offline signature verification based on gray level features,” _IEEE Trans. Inf. Forensics Secur._ , vol. 7, pp. 966–977, 2012.
  * [11] S. Lai and L. Jin, “Recurrent adaptation networks for online signature verification,” _IEEE Trans. Inf. Forensics Secur._ , vol. 14, pp. 1624–1637, 2019.
  * [12] M. Okawa, “Template matching using time-series averaging and DTW with dependent warping for online signature verification,” _IEEE Access_ , vol. 7, pp. 81 010–81 019, 2019.
  * [13] D. Banerjee, B. Chatterjee, P. Bhowal, T. Bhattacharyya, S. Malakar, and R. Sarkar, “A new wrapper feature selection method for language-invariant offline signature verification,” _Expert Syst. Appl._ , vol. 186, p. 115756, 2021.
  * [14] M. Okawa, “From bovw to VLAD with KAZE features: Offline signature verification considering cognitive processes of forensic experts,” _Pattern Recognit. Lett._ , vol. 113, pp. 75–82, 2018.
  * [15] J. Ruiz-del-Solar, C. Devia, P. Loncomilla, and F. Concha, “Offline signature verification using local interest points and descriptors,” in _Proceedings of the CIARP_ , vol. 5197, 2008, pp. 22–29.
  * [16] L. G. Hafemann, R. Sabourin, and L. S. Oliveira, “Learning features for offline handwritten signature verification using deep convolutional neural networks,” _Pattern Recognit._ , vol. 70, pp. 163–176, 2017.
  * [17] V. L. F. Souza, A. L. I. Oliveira, and R. Sabourin, “A writer-independent approach for offline signature verification using deep convolutional neural networks features,” in _Proceedings of the BRACIS_ , 2018, pp. 212–217.
  * [18] I. Melekhov, J. Kannala, and E. Rahtu, “Siamese network features for image matching,” in _Proceedings of the ICPR_ , 2016, pp. 378–383.
  * [19] Q. Guo, W. Feng, C. Zhou, R. Huang, L. Wan, and S. Wang, “Learning dynamic siamese network for visual object tracking,” in _Proceedings of the ICCV_ , 2017, pp. 1781–1789.
  * [20] P. Wei, H. Li, and P. Hu, “Inverse discriminative networks for handwritten signature verification,” in _Proceedings of the CVPR_ , 2019, pp. 5764–5772.
  * [21] A. Trotman, “Learning to rank,” _Inf. Retr._ , vol. 8, pp. 359–381, 2005\.
  * [22] C. J. C. Burges, T. Shaked, E. Renshaw, A. Lazier, M. Deeds, N. Hamilton, and G. N. Hullender, “Learning to rank using gradient descent,” in _Proceedings of the ICML_ , vol. 119, 2005, pp. 89–96.
  * [23] S. Agarwal, T. Graepel, R. Herbrich, S. Har-Peled, and D. Roth, “Generalization bounds for the area under the ROC curve,” _J. Mach. Learn. Res._ , vol. 6, pp. 393–425, 2005.
  * [24] N. Usunier, M. Amini, and C. Goutte, “Multiview semi-supervised learning for ranking multilingual documents,” in _Proceedings of the ECML-PKDD_ , vol. 6913, 2011, pp. 443–458.
  * [25] N. Charoenphakdee, J. Lee, Y. Jin, D. Wanvarie, and M. Sugiyama, “Learning only from relevant keywords and unlabeled documents,” in _Proceedings of the EMNLP-IJCNLP_ , 2019, pp. 3991–4000.
  * [26] S. Mehta, R. Pimplikar, A. Singh, L. R. Varshney, and K. Visweswariah, “Efficient multifaceted screening of job applicants,” in _Proceedings of the EDBT/ICDT_ , 2013, pp. 661–671.
  * [27] Y. Zheng, Y. Zheng, D. Suehiro, and S. Uchida, “Top-rank convolutional neural network and its application to medical image-based diagnosis,” _Pattern Recognit._ , vol. 120, p. 108138, 2021.
  * [28] O. Chhabra and S. Chakraborty, “Siamese triple ranking convolution network in signature forgery detection,” 2019.
  * [29] C. Rudin, “The p-norm push: A simple convex ranking algorithm that concentrates at the top of the list,” _J. Mach. Learn. Res._ , vol. 10, pp. 2233–2271, 2009.


11institutetext: University of Central Florida, USA
11email<EMAIL_ADDRESS><EMAIL_ADDRESS>

# Ethical AI for Social Good

Ramya Akula 11 0000-0002-4008-075X Ivan Garibay 11 0000-0002-3302-9382

###### Abstract

The concept of AI for Social Good(AI4SG) is gaining momentum in both
information societies and the AI community. Through all the advancement of AI-
based solutions, it can solve societal issues effectively. To date, however,
there is only a rudimentary grasp of what constitutes AI socially beneficial
in principle, what constitutes AI4SG in reality, and what are the policies and
regulations needed to ensure it. This paper fills the vacuum by addressing the
ethical aspects that are critical for future AI4SG efforts. Some of these
characteristics are new to AI, while others have greater importance due to its
usage.

###### Keywords:

AI for Social Good Artificial Intelligence Ethics Fairness Equitable
Responsible AI Human Centered AI

##  1 Introduction

The concept of AI for Social Good(AI4SG) is gaining momentum within the AI
community. The models that fall under AI4SG are very diverse and include
models to forecast clinical manifestations, game-theoretic models to avoid
phishing, online reinforcement learning to focus on HIV education, statistical
methods to prevent harsh policing, and promote student retention name a few.
Indeed, new AI4SG applications emerge regularly, providing socially beneficial
results that were previously unattainable, impractical, or expensive. There
have lately been many methodologies for the formulation, development, and
operation of ethical AI in general. Nevertheless, a common accord for ”AI for
the Social Good” is an open topic. Encountering AI4SG Adhoc [3], as an annual
summit for the AI industry and the government, has been done by analyzing
specific application areas such as famine relief or disaster management. Since
2017, United Nations’ Sustainable Development Goals 111United Nations’
Sustainable Development Goals. https://aiforgood.itu.int/about/, an
interdisciplinary approach neither explains nor suggests how the development
of AI4SG solutions leads to harnessing their full potential. Because designers
of AI4SG confront at least two significant challenges: pointless losses and
unexpected accomplishments, having a clear grasp of what makes AI socially
beneficial in principle, what qualifies as AI4SG in reality, and how to
replicate its first achievements in terms of the policy is an issue.

Human values influence AI software, which, if not properly chosen, may result
in ”good-AI-gone-wrong” situations. Consider the failure of IBM’s oncology-
support software, which detects malignant tumors using machine learning, but
the medical practitioners on the ground reject the algorithm. The system was
trained on artificial data and was not yet sophisticated enough to understand
confusing, nuanced, or otherwise messy patient health information. It also
depended on US medical procedures that are not universally applicable.
Misdiagnoses and incorrect treatment recommendations resulted from the
software’s hasty rollout and poor design, jeopardizing physicians’ and
hospitals’ confidence. Context-specific design and deployment may assist in
avoiding such value mismatch and provide more consistent AI4SG initiatives.
Simultaneously, accurate socially beneficial AI results may emerge by
coincidence, such as an unintentional deployment of an AI solution in a
different environment. However, because of a lack of knowledge of AI4SG, this
achievement was just coincidental; it is unlikely to be replicated in the
future. AI4SG would benefit from examining the critical elements that underpin
the design of effective AI4SG systems to prevent needless failures and
successes. This paper aims that an AI4SG project concentrates on aspects that
are especially important to AI as a technology intended and utilized to
promote social good.

Figure 1: List of challenges mentioned by AI researchers and Social Sector
experts. Source: McKinsey Global Institute Analysis

##  2 Definition of ”AI for Social Good”

AI is one of the most rapidly expanding areas in the technology industry. The
use of AI has extended to a wide range of industries, including healthcare,
transportation, and security. As a result of this expansion, competent AI
experts are in high demand across various sectors. An AI4SG project is
adequate if it contributes to reducing, mitigating, eradicating a specific
issue of moral importance by overcoming potential challenges shown in Figure1
by McKinsey Global Institute Analysis 222https://www.mckinsey.com/featured-
insights/artificial-intelligence/applying-artificial-intelligence-for-social-
good. The following working definition serves as the foundation for our
investigation into the critical elements for effective AI4SG: The design,
development, and deployment of AI systems in such a way that they prevent,
mitigate, or resolve problems that negatively impact human life and the well-
being of the natural world, and enable socially preferable and environmentally
sustainable developments. It means that AI should be beneficial to both humans
and the natural environment, and AI4SG initiatives should not only adhere to
but also reaffirm this concept. Although beneficence is a crucial requirement
of AI4SG, it is not adequate in and of itself since the beneficial effect of
an AI4SG project may be neutralize by the development or amplification of
additional risks or harms. When it comes to AI4SG projects, ethical analysis
that informs the design and deployment process is critical in minimizing the
predictable risks of unintended effects and potential misuses of the
technology.

##  3 Ethical AI for Social Good

Entrepreneurs and enterprises may enjoy the advantages of AI while
simultaneously being aware of possible downsides and taking cautious measures
to minimize their impact. In this section we elaborate on Ethical AI for
Social Good shown in Figure 2 for

Figure 2: Components of Ethical AI for Social Good

###  3.1 Explainability and Interpretability

AI4SG applications need transparency to make the operations and results of
these systems understandable and their goals visible. Since the operations and
results of AI systems reflect the broader goals of human designers, these two
needs are naturally intertwined. An essential ethical concept in AI is the
need for systems to be understandable. Moreover, considering the growing
widespread deployment of AI systems, it has gotten greater attention lately.
As discussed above, AI4SG initiatives should provide Explainability and
Interpretability tailored to the specific needs of the recipient group they
are addressing. In various methods, the designers of AI4SG programs have
attempted to make decision-making systems more understandable to the public.
For example, machine learning predicts academic difficulty in certain studies
[6]. School administrators interpret the system utilized predictors based on
things they recognized and valued, such as grade point averages and socio-
economic classifications. According to the researchers, reinforcement-learning
techniques can assist authorities at homeless shelters in educating homeless
adolescents about HIV. By selecting which homeless adolescents to teach, based
on the likelihood that homeless youths would pass on their knowledge, the
system learns how to maximize the impact of HIV education [14]. One version of
the technology revealed the identity of the selected youngster by exposing
their social network graph. Although these explanations seemed counter-
intuitive to the homeless shelter administrators, they believed that they
might impact users’ knowledge of how the system operated and, as a result,
their confidence in the system as a whole. When describing an AI-based
conclusion, these two examples demonstrate how critical it is to use the
proper conceptualization. Because AI4SG initiatives range significantly in
terms of their goals, subject matter, context, and stakeholders, the
appropriate conceptualization is likely to change across them. Explainability
and Interpretability must establish as the first step to communicate anything
to someone.

###  3.2 Privacy Protection

Privacy is probably the most researched area with a substantial amount of
material available. Because privacy is an essential prerequisite for safety,
human dignity, and social cohesiveness, among other things, this should not
come as a surprise. Moreover, previous generations of digital technologies had
a significant effect on privacy. When a state obtains influence over people
via privacy infringements, jeopardizing the safety of those persons. Respect
for privacy is also a fundamental prerequisite of human dignity. We may
consider personal information to be the building blocks of an individual, and
depriving someone of their records without their permission is likely to be
considered a breach of their dignity. Individual privacy is a fundamental
right, and the idea of privacy as a fundamental right underpins court
judgments. When individuals deviate from social standards without offending,
and when societies retain their social structures, privacy undergirds the
individual’s social cohesion and cohesiveness. Tensions may develop between
people who have various levels of consent. In life-or-death circumstances such
as national catastrophes and pandemics, the stress is often at its highest
level. Consider the epidemic of Ebola in West Africa in 2014, which presented
a problematic ethical quandary [9]. In this particular instance, the quick
release and analysis of call-data records from mobile phone users in the
affected area may have enabled epidemiologists to monitor the spread of the
fatal illness in the area in question. When promptness is not essential, it is
feasible to seek a subject’s permission for and before the use of their
personal information. The amount or kind of permission requested may vary
depending on the situation.

In healthcare, it is possible to establish an assumed consent threshold.
Reporting a medical problem to a doctor is deemed to represent assumed
permission on the patient’s side. It will be more reasonable in other
situations to set a threshold for informed consent. However, since informed
consent requires researchers to acquire a patient’s explicit permission before
using their data for a non-consented purpose, practitioners may select a clear
consent threshold for general data processing, including medical use. Another
option is developing dynamic consent, which allows people to monitor and
modify their privacy choices on a more detailed level as their circumstances
change; otherwise, it disregards informed consent. Similarly, the recent
development of machine learning algorithms to forecast the prognosis of
ovarian cancer patients based on retrospective analysis of anonymized pictures
was a case in point [7]. The use of patient health data in the development of
AI solutions without the patients’ permission has also piqued the interest of
data protection authorities. However, it is still possible to balance
protecting patient privacy and developing successful AI4SG technologies.
However, even if adopting a computer vision-based solution to the issue has
obvious technological benefits, privacy laws prohibit video recording. Even in
situations where video recording is permitted, access to the recordings is
often restricted. Instead, the researchers used depth pictures, which do not
reveal the participants’ identities, thus protecting their anonymity. In the
process of complying with privacy regulations, the researchers’ non-intrusive
method managed to beat previous systems, even though they lost key visual
appearance signals in the process. Finally, consent in the internet
environment is fraught with difficulties; consumers often lack choice when
using online services. The relative absence of protection or permission for
the second-hand use of personal data that is openly accessible on the internet
allows for the creation of ethically problematic AI technologies.

###  3.3 Data Infringement

AI to anticipate future trends or patterns is becoming more common in AI4SG
settings, with applications ranging from using automated prediction to correct
an academic failure to prevent unlawful policing and identify corporate fraud.
The prediction capability of AI4SG is subject to two risks: manipulation of
input data and over-reliance on noncausal indicators such as correlation
coefficient. The manipulation of data is not a new issue, and it is not
confined to AI systems alone. However, AI has the potential to aggravate it,
and it is a significant danger for any AI4SG effort since it has the potential
to degrade the predictive capacity of AI and lead to the avoidance of socially
beneficial actions on an individual basis. Because of the scale at which AI is
usually implemented, the advent of AI complicates problems. The information
used to forecast an inevitable result may be known by an agent with such
knowledge. The value of each predictive variable can be changed to prevent
intervention. There is also a danger that excessive reliance on noncausal
indicators – that is, data associated with phenomena but is not causal of it –
may divert attention away from the context in which the AI4SG designer is
attempting to intervene. Instead of focusing on noncausal predictors, any such
intervention should aim to address the fundamental causes of a particular
issue, such as poor corporate governance or detecting fraudulence [15]. To do
otherwise is to run the danger of merely treating the symptoms of a problem
rather than the underlying cause. These dangers indicate that the usage of
safeguards as a design element for AI4SG projects should be considered. Strict
guidelines for AI4SG initiatives may restrict the selection of indicators to
be utilized in their design. These indicators should impact interventions and
the level of openness that should be applied to how indicators influence
decisions. As a result, the following best practice is established: AI4SG
designers should include safeguards that guarantee that noncausal indicators
do not unduly bias interventions and restrict, where appropriate, knowledge of
how inputs influence outputs from AI4SG systems in order to avoid
manipulation.

###  3.4 Intervention

Technology must intervene in the lives of users only in ways that are
respectful of their independence. Note that this is not an issue emerging when
AI intervenes, although AI brings additional concerns. In particular,
developing interventions that balance present and future benefits is a
significant issue for AI4SG initiatives. It comes down to a matter of temporal
choice interdependency, which is well-known in the field of preference
elicitation research. In the present, an intervention may elicit user
preferences, which the program can then rationalize future interventions to
the specific user in question. Thus, a user autonomy-preserving intervention
approach may be unsuccessful in collecting the information needed for
appropriately contextualized future interventions. On the other hand, an
intervention that oversteps the bounds of a user’s autonomy may impact the
consumer to shun the technology, making future interventions in that situation
challenging to perform. This balancing act is something that most AI4SG
projects have to deal with. Take, for example, interactive activity detection
software for individuals with cognitive impairments, becoming more popular.
The program intends to cause the least amount of disruption to their overall
objectives, to encourage patients to keep a routine activity. Each
intervention contextualizes such that the program learns the frequency of
future interventions based on the reactions to previous interventions, which
is a powerful feature. Furthermore, only significant intervention offers, and
yet all interventions are only partly voluntary since rejecting one prompt
results in a subsequent prompt with similar information. In this case, there
was a worry that patients might leave a device that was too invasive; thus,
exploring the middle ground. In our second case, there is a lack of this
balance. A game-theoretic application meddles in the patrols of wildlife
security agents by suggesting other paths to follow [5]. However, if physical
barriers obstruct a track, the program cannot offer alternate route
recommendations in this case. Officers may choose to disregard the advice by
pursuing an alternative path. However, they must do so without abandoning the
application and easing restrictions for users to reject an intervention while
accepting additional, more appropriate interventions in the form of advice
later on. These case studies demonstrate the significance of considering users
as equal partners in designing and implementing autonomous decision-making
systems. Adopting this frame of thinking may have contributed to the sad loss
of two Boeing 737 Max aircraft in October 2017 [11]. In part, it seems that
the pilots of these aircraft failed to correct a software problem caused by
defective sensors, which may exacerbate by the lack of optional safety
measures that Boeing offered at an extra cost. In many cases, the danger of
false positives is equally as severe as the risk of false negatives.
Appropriate intervention in the context of the receiver accomplishes a
reasonable degree of disruption while maintaining autonomy via options. This
contextualization underpins knowledge about users’ capabilities, preferences,
and objectives and the conditions in which the intervention will be
implemented and assessed.

###  3.5 Fairness and Discrimination

For the most part, AI developers depend on data that may skew in socially
important ways. As a result, the algorithmic decision-making that underlies
many AI systems may skew in unjust ways for the decision-making process. AI4SG
efforts that depend on skewed data may end up perpetuating that skewed data
via a vicious loop. In such a scenario, a limited dataset helps guide the
initial phase of AI decision-making, resulting in discriminatory behaviors,
which would then lead to the gathering and use of more biased data. For
instance, there has been a long-standing prejudice against African-American
women seeking care because of negative historical assumptions for preterm
birth [10]. In this case, AI can make a significant dent in the glaring racial
gap, but only provided the same historical prejudice is not reproduced in AI
systems. Alternatively, consider the use of predictive policing tools.
According to software developers, progressive policing software may pre-train
on data from the police department that includes deeply entrenched biases.
When prejudice has an impact on arrest rates, it gets ingrained in the data
collected during prosecutions. Such biases may lead to discriminatory
judgments, which in turn feedback in the more skewed datasets, resulting in a
vicious cycle of discrimination. Designers must, without a doubt, clean up the
datasets used to train AI. The danger of using too powerful a disinfectant
will remove crucial contextual subtleties that might help enhance ethical
decision-making down the road. As a result, designers must guarantee that AI
decision-making remains sensitive to variables that are essential for
inclusivity in the first place. A word processor, for example, should ensure
that all human users, regardless of their gender and race, have a similar
experience. However, we should also expect it to function in a non-equal and
still fair manner by assisting individuals with visual impairments. Let us
compare AI to a word processor. It allows for a much greater variety of
decision-making and interaction modalities, many of which base on possibly
biased input. Natural language in training datasets may include unjustified
connections between genders and words, which in turn may have normative force
due to their normative nature. In other settings and use cases, an equitable
approach may need variations in communication depending on variables such as
gender to be fair. Consider the example of the virtual teaching assistant who,
when informed that a user was expecting a child, failed to differentiate
between men and women in its replies, praising the males while dismissing the
women [4]. An investigation by the BBC News revealed an even more extreme
example: a mental health chat bot 333Child Advice Chatbots Fail Sex Abuse Test
https://www.bbc.com/news/technology-46507900designed for children could not
comprehend a kid reporting underage sexual assault to a mental health
professional. The ability to recognize and respect situational fairness is
critical for the effective deployment of AI4SG. A long-standing issue has been
the impact of past biases on decision-making in the future. Erroneous
reinforcement learning processes, on the other hand, can entrench these biases
in, strengthen them, and repeat them over and over again.

###  3.6 Adaptability and User Friendliness

AI4SG must enable people to curate and nurture their semantic capital, which
is any material that may improve someone’s ability to provide meaning and make
sense of things for it to be effective. We may have the technological
capability to automate the production of meaning and sense (connotations)
using AI. Still, if we do it carelessly, we may create distrust or injustice.
Two issues arise: The first issue is that AI software may define connotations
differently from our personal preferences. A similar issue may emerge if AI
software supports connotations based on previously used terms. It would be
difficult for AI software to define all meanings and sensations in a social
context, which is the second issue. For example, only legally authorized
agents have the authority to determine the legal meaning of the term violation
[1]. In the same way, the meaning and sense of emotional symbols, such as
facial expressions, is dependent on the kind of agent who is displaying a
particular indication. Effective AI may identify an emotion; for example, a
fake agent may correctly say that a person looks sad, but it cannot alter the
meaning of the feeling. It is necessary to differentiate between those
responsibilities that may and should not outsource to a computerized system of
some kind. AI should be used to enable human-friendly semantic annotation
rather than to offer semantic annotation itself. For example, when it comes to
individuals who have Alzheimer’s disease. Research on caregiver-patient
relationships identifies three aspects [2].First and foremost, caregivers
perform a significant, though time-consuming, role in reminding patients of
their involved tasks, such as taking medicine. Second, caregivers are
essential in ensuring that patients have meaningful interactions with one
another. Third, when caregivers remind patients to take their medication, the
patient-carer relationship may be weakened due to the patient being annoyed.
The caregiver may lose part of their ability to offer empathy and meaningful
support. As a result, researchers have created AI software that strikes a
balance between reminding the patient and irritating the patient. By using
reinforcement learning, it is possible to learn and optimize the equilibrium.
The researchers created the method so that caregivers may spend the majority
of their time giving empathetic support and maintaining a meaningful
connection with the patient rather than administering medications. Using AI to
automate formulaic activities while maintaining human-friendly connotations is
feasible.

###  3.7 Verification and validation

Verification and validation are essential considerations. For technology in
general and AI4SG applications, in particular, to be accepted and have a
significant beneficial effect on human life and environmental welfare,
trustworthiness are crucial. However, although there is no everyday experience
or guideline that can assure or guarantee integrity, subjectivity is a
critical aspect to consider when enhancing the trustworthiness of technology
applications in general and AI4SG applications specifically. Falsifiability
entails the specification of one or more urgent requirements and the
possibility of empirical testing of those requirements. A critical need is a
condition, resource, or means required for a capability to be fully
operational and without which something could or should not function. Safety
is an unquestionably vital necessity. As a result, for an AI4SG system to be
reliable, its safety must be verifiably safe. Unless demonstration of
falsifiability, it is impossible to verify the essential requirements [12].
Therefore the technology should not be considered trustworthy. As a result,
falsifiability is a critical consideration for any AI4SG initiatives that are
feasible. Unfortunately, we will not determine for certain whether or not a
particular AI4SG application is safe until we have tested the program in every
conceivable scenario. In an unpredictable and fuzzy environment with numerous
unexpected circumstances, the potential of knowing when a certain essential
need is not implemented or maybe failing to function correctly is within
reach. As a result, if the essential criteria are falsifiable, we can
determine whether the AI4SG application is not reliable, but we cannot
determine if the application is trustworthy. With an iterative deployment
cycle, it is important to validate the most critical requirements. Unintended
harmful consequences may only become apparent after testing. Software should
only be tested in the actual world if it is safe to do so, although this
should not be the case all of the time. To accomplish this, developers must
follow a deployment cycle that includes the following steps: (a) Verification,
(b) conducting inferential statistics (c) Validation across increasingly wacky
environments. When developing AI4SG applications, formal methods may use to
attempt to test key requirements. They might, for example, incorporate formal
verification to guarantee that autonomous cars and AI systems in other safety-
critical settings would choose the morally preferable option when given the
opportunity [13]. As far as falsifiability is concerned, such techniques
provide safety checks that may show high accuracy. Simulations may provide
assurances that are approximately comparable to those provided by experiments.
A simulation allows one to determine whether or not key criteria fulfill under
a set of formal assumptions by running the simulation. In contrast to a formal
demonstration, a simulation may not always show that the necessary
characteristics in all circumstances. However, a simulation often allows one
to test a far larger range of situations that cannot deal with formally, for
example, owing to the intricacy of the argument, than can be done in a formal
setting. The use of formal properties or simulations alone to disprove an
AI4SG application would be erroneous and counterproductive. The assumptions
behind these models limit the application of any conclusions drawn in the
actual world. Furthermore, assumptions may out to be wrong in practice. What
one may show to be right via formal proof or what one may believe to be
correct through simulation testing may be refuted later on when the system
deploys in the real world. For example, authors of a game-theoretic model for
wildlife protection assumed that the terrain was generally level and free of
significant obstacles. The program that they initially created included an
erroneous definition of an optimum patrol route, due to which the software was
subsequently updated. The application’s incremental testing allowed for
refining the optimum patrol route by demonstrating that the presumption of a
flat terrain was incorrect. After deployment, identifying and rectifying valid
inferences is a strategy when faced with new problems in real-world settings
that need altering previous assumptions established in the lab. An alternative
is to use an on the fly or runtime system, which allows for continuous
updating of a program’s processing of the inputs it receives. However, there
is a slew of issues with this method as well. For example, Microsoft’s
notorious Twitter bot, Tay [8], gained meanings in a very loose sense at run
time when it learned how to react to messages from Twitter users, which
accomplishes via machine learning. In the real—and often vicious—world of
social media, the bot’s capacity to modify its conceptual understanding
continuously became an unpleasant flaw, as Tay learned and regurgitated foul
language and unethical connections between ideas from other users after being
deployed. When dealing with the falsifiability of requirements, a supervised
learning method poses difficulties comparable to those encountered when using
a predictive approach. It is significant since supervision is the main
technique to learn from data. Germany’s strategy to regulate autonomous cars
is an excellent example of taking a gradual approach to regulation.
Constrained autonomy may test in deregulated zones, and after raising the
levels of trustworthiness, manufacturers can test cars with greater degrees of
autonomy in more regulated zones. Indeed, establishing such unregulated zones
was one of the recommendations for a more ethical AI strategy at the EU level.

##  4 Conclusion

According to the seven criteria, achieving effective AI4SG involves striking
two types of balances: intra- and inter-organizational credits. Each factor
may require a system’s intrinsic balance. For example, when deciding on
contextual interventions, there may be a need to balance the risks of over-and
under-intervening; or when deciding on protection by obfuscation versus
security by enumeration of salient differences between people’s intended goals
and circumstances. As the AI4SG community continues to grapple with the
general issue of whether one is ethically obligated to design, create, and
deploy a particular AI4SG project, the topic has become more complex and
challenging to answer. This article provides a framework of essential elements
that must be examined, understood, and assessed in the context of a particular
AI4SG project. Design, development, and deployment happen at the same time.
The development of AI4SG will probably offer additional chances to enhance
such a framework of critical variables in the future. Individual and systemic
balances are essential to maintaining in any system. AI itself may assist in
managing its life cycle by giving, in a meta-reflective manner, tools to
assess how to achieve the greatest possible individual and systemic balances.
This article aims to set the groundwork for both good practices and policies
and an additional study into the ethical concerns that should underpin AI4SG
initiatives and the ”AI4SG project” as a whole in the future.

##  5 Acknowledgments

This research is funded by University of Central Florida provost scholarship
for joint research with National Academy members.

## References

  * [1] Al-Abdulkarim, L., Atkinson, K., Bench-Capon, T.: Factors, issues and values: Revisiting reasoning with cases. In: Proceedings of the 15th international conference on artificial intelligence and law. pp. 3–12 (2015)
  * [2] Burns, A., Rabins, P.: Carer burden in dementia. International Journal of Geriatric Psychiatry 15(S1), S9–S13 (2000)
  * [3] Butler, D.: Ai summit aims to help world’s poorest. Nature News 546(7657), 196 (2017)
  * [4] Eicher, B., Polepeddi, L., Goel, A.: Jill watson doesn’t care if you’re pregnant: Grounding ai ethics in empirical studies. In: Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society. pp. 88–94 (2018)
  * [5] Fang, F., Nguyen, T.H., Pickles, R., Lam, W.Y., Clements, G.R., An, B., Singh, A., Tambe, M., Lemieux, A.: Deploying paws: Field optimization of the protection assistant for wildlife security. In: Twenty-eighth IAAI conference (2016)
  * [6] Lakkaraju, H., Aguiar, E., Shan, C., Miller, D., Bhanpuri, N., Ghani, R., Addison, K.L.: A machine learning framework to identify students at risk of adverse academic outcomes. In: Proceedings of the 21th ACM SIGKDD international conference on knowledge discovery and data mining. pp. 1909–1918 (2015)
  * [7] Lu, H., Arshad, M., Thornton, A., Avesani, G., Cunnea, P., Curry, E., Kanavati, F., Liang, J., Nixon, K., Williams, S.T., et al.: A mathematical-descriptor of tumor-mesoscopic-structure from computed-tomography images annotates prognostic-and molecular-phenotypes of epithelial ovarian cancer. Nature communications 10(1), 1–11 (2019)
  * [8] Mathur, V., Stavrakas, Y., Singh, S.: Intelligence analysis of tay twitter bot. In: 2016 2nd International Conference on Contemporary Computing and Informatics (IC3I). pp. 231–236. IEEE (2016)
  * [9] Oliver, N.: Big data for social good: Opportunities and challenges. In: 12th World Telecommunication/ICT Indicators Symposium (WTIS-14)[online][date of reference 20 May 2015]¡ http://www. itu. int/en/ITU-D/Statistics/Documents/events/wtis2014/003INF-E. pdf (2014)
  * [10] Petersen, E.E., Davis, N.L., Goodman, D., Cox, S., Mayes, N., Johnston, E., Syverson, C., Seed, K., Shapiro-Mendoza, C.K., Callaghan, W.M., et al.: Vital signs: pregnancy-related deaths, united states, 2011–2015, and strategies for prevention, 13 states, 2013–2017. Morbidity and Mortality Weekly Report 68(18), 423 (2019)
  * [11] Tabuchi, H., Gelles, D.: Doomed boeing jets lacked 2 safety features that company sold only as extras. The New York Times 21 (2019)
  * [12] Taddeo, M., Floridi, L.: How ai can be a force for good. Science 361(6404), 751–752 (2018)
  * [13] Taddeo, M., Floridi, L.: Regulate artificial intelligence to avert cyber arms race (2018)
  * [14] Yadav, A., Chan, H., Jiang, A., Rice, E., Kamar, E., Grosz, B., Tambe, M.: Pomdps for assisting homeless shelters–computational and deployment challenges. In: International Conference on Autonomous Agents and Multiagent Systems. pp. 67–87. Springer (2016)
  * [15] Zhou, W., Kapoor, G.: Detecting evolutionary financial statement fraud. Decision support systems 50(3), 570–575 (2011)


This section discusses the algorithms developed for our data processing chain.
We discuss two algorithms for calculating the derivative, the convolution
method and the discrete cosine and sine transform method (DCSTM), as well as
the underlying streaming discrete cosine transform method (SDCTM) used for
calculating the discrete cosine transform (DCT), the discrete sine transform
(DST), the inverse discrete cosine transform (IDCT), and the inverse discrete
sine transform (IDST). We also discuss approaches for finding the peaks of the
original data via zero crossings in the output of a derivative. The design of
our algorithms are all focused on implementation in hardware. We prioritize
designs that will minimize latency and strive for efficient resource usage in
an FPGA.

Convolution Method The convolution method uses a stationary kernel function
and streams data past this kernel while the data interacts with the kernel.
The choice of the kernel will change the operation at hand. We want to choose
a kernel that can take the derivative of our input signal. We arrive at the
desired kernel by two approaches. For the first, we use the 1-D derivative
property of convolution Heckbert, boxlets.

$\frac{d}{dx}\left(f\ast g\right)=\frac{d}{dx}\left(f\right)\ast
g=f\ast\frac{d}{dx}\left(g\right)$ (1)

Equation 1 shows we can take convolution of the derivative of the kernel $g$
with our original signal, and this result would be equivalent to taking the
convolution of the derivative of our signal with the kernel $g$. Now if we
consider a Gaussian kernel, $g$, then when we convolve it with the derivative
of our input signal, we get a smoothed version of our input signal [Talbi].
Therefore, we can actually compute the derivative of this Gaussian kernel and
convolve it with the original signal in order to get the smoothed version of
the derivative of our signal.For this, start by choosing a Gaussian kernel

$g=\frac{1}{\sqrt{2\pi}}e^{{\frac{-t^{2}}{2\sigma^{2}}}}$ (2)

and then take the derivative to get

$h=\frac{-t}{\sigma^{2}\sqrt{2\pi}}e^{{\frac{-t^{2}}{2\sigma^{2}}}},$ (3)

where $\sigma$ is the kernel width, and finally convolve the kernel with the
input signal. The second line of reasoning to arrive at this kernel shape is
to consider looking at the noiseless power spectrum of the data of interest
and then multiply it by the fourier transform of a step function which
represents a derivative [book1, website]. The resulting multiplication is then
inverse fourier transformed to arrive at the analytic derivative of the
Gaussian. Section LABEL:sec:convResults discusses this second line of
reasoning in the context of choosing the Gaussian derivative kernel width.

[width=0.55]figures/convolutionFigureUsed.pdf.

Figure : Data flow for convolution method for derivative. Kernel is stored as
an array with $M$ words each of $N$ bits. Each word gets multiplied by the
corresponding word in the $M$ word long data array registers which itself is a
FIFO with the input data streaming in. Each word of this input data is
$N_{in}$ bits. These multiplications are then added together, and the result
becomes one element of the derivative output. The points A, B, C, and D
correspond to table LABEL:tab:conv_wordsize.

Fig. 1 shows how we implement this algorithm. To perform the convolution on
data streaming in, we consider the kernel to be limited in extent to a
particular window size, $M$. Then we load our data into an array of registers
equal in extent to the window size. The data is loaded in first-in first-out
fashion (FIFO). Each element of the array is then multiplied by the
corresponding element in the kernel and the result is summed. The summed
result is then one of the output elements of the derivative. This is repeated
for all the data that is streamed in, with a new element in the total
convolution output available after each new piece of streaming data arrives.
This convolution then takes the form of

$y_{k}=\sum_{m=0}^{M}z_{k,m}*h_{m}$ (4)

where $M$ is the window size of the kernel, $z$ is the array of registers
piping the data in and out, and $h$ is the stationary kernel. In this
representation of convolution, for each new $k$, there is a new $z$ since a
new piece of data is streamed in. Therefore $z$ has a dependence on $m$ and
$k$. The final output will be valid once all of the data has been streamed
through the array of registers. The exact window size and kernel width is
application dependent and can be tuned ahead of time based on typical or
expected feature widths. Once the kernel is chosen, it can be stored in memory
as a look-up table (LUT) to be used while the algorithm is running.

##  Discrete Cosine and Sine Transform Method (DCSTM)

The streaming Discrete Cosine and Sine Transform Method (DCSTM) is designed to
take the derivative of incoming data in a way that produces a low noise
output, minimizes resource usage in the FPGA, and has high throughput and low
latency. One commonly used method for calculating derivatives of functions is
to use a fourier transform (FT) where one takes the FT, multiplies by a value
proportional to the frequency vector, and then takes the inverse fourier
transform (IFT). However, fourier transforms can both be costly in an FPGA and
be an overkill in terms of what is required [Johnson]. Here instead we use the
DCT, IDCT, DST, and IDST in a way that resembles an FT [Johnson, buskirk].
However, for our application we cannot simply feed our data vector in. Our
data is streaming in at a high rate (6 Gs/s) and may consist of over 5120
words. This could pose a problem for implementing these aforementioned
transforms in an FPGA while retaining high throughput and low latency since it
would require a large number of multipliers. Our algorithm instead handles
incoming data in chunks which we describe as a window size. Tuning this window
size is important and depends on the nature of the expected data. Furthermore,
the algorithm must be able to handle data that lands on the boundaries of
windows. To handle this, we introduce a design that uses two paths for the
incoming signal where each path initially applies a different filter, one path
then delays its signal, both paths apply identical derivative transformations,
the other path then delays its signal, and finally the two paths are
recombined. Fig. 1 shows the details of the algorithm.

[width=0.84]figures/dcstmUsed.pdf

Figure : Shows the data flow (left to right) for the derivative algorithm for
peak identification. The original signal and a copy are multiplied by SIN2 and
COS2 coefficients which are stored in LUTs prior to runtime. Both paths follow
identical operations involving DCT and DST, multiplication proportional to
frequency, and inverse DST and DCT, and finally summation. One path is delayed
at the beginning of the operations and the other path is delayed following the
operations in order to regain time coherence for the final, recombining
addition. Points A–C and E–K correspond to table LABEL:tab:wordsize while D is
in Fig. 1.

In the block diagram on the top path, data streams in one word at a time, with
each word multiplied by a particular value from a sine-squared (SIN2) filter
which was stored pre-runtime in a LUT. The period of the SIN2 coefficient is
proportional to the window size. The data splits paths again, one into a DCT
block and the other to a DST block. These blocks take this streaming data and,
after a window size amount of data comes in, the output is ready in parallel.
Once the array of data leaves these blocks, each output word is multiplied by
a value proportional to frequency. These values then go through the
corresponding inverse transform blocks before being added back together. The
DCT, DST, IDCT, and IDST blocks are described in section 1. The other data
path that was not multiplied by the SIN2 coefficients is instead multiplied by
the cosine-squared (COS2) equivalent. Then the data is delayed before going
through the same series of transformations. This delay is to address capturing
signal that might lie on the boundaries of the windows by providing an offset
in time to move the signal away from the window size boundary in order to
perform the algorithm. The data on this path then proceeds through the same
series of transformations. Finally the two paths are recombined by first
delaying the original path in order to sync the two paths together, regaining
temporal coherence. They are then added together and to form the final result.
The multiplication by SIN2 and COS2 values both rolls-off the signal at the
edges of the window and ensures the final recombination of the two paths leads
to the proper value.

##  Streaming Discrete Cosine Transform Method (SDCTM)

The normalized DCT, IDCT, DST, and IDST (eq 5–8, respectively) are

$\split y_{k}=2\sum_{n=0}^{N-1}fx_{n}\cos\left(\frac{\pi
k(2n+1)}{2N}\right)\cr\text{where}\
f=\cases{\sqrt{\hfil}}{\frac{1}{4N}},&\text{if}k=0\\\
\sqrt{\frac{1}{2N}},\text{otherwise}$ (5) $\split
y_{k}=fx_{0}+2\sum_{n=1}^{N-1}fx_{n}\cos\left(\frac{\pi
n(2k+1)}{2N}\right)\cr\text{where}\
f=\cases{\sqrt{\hfil}}{\frac{1}{N}},&\text{if}n=0\\\
\sqrt{\frac{1}{2N}},\text{otherwise}$ (6) $\split
y_{k}=2\sum_{n=0}^{N-1}fx_{n}\sin\left(\frac{\pi(k+1)(2n+1)}{2N}\right)\cr\text{where}\
f=\cases{\sqrt{\hfil}}{\frac{1}{4N}},&\text{if}k=0\\\
\sqrt{\frac{1}{2N}},\text{otherwise}$ (7) $\split
y_{k}=f(-1)^{k}x_{N-1}+&2\sum_{n=0}^{N-2}fx_{n}\sin\left(\frac{\pi(2k+1)(n+1}{2N}\right)\cr\text{where}\
f=\sqrt{\frac{1}{2N}}$ (8)

To adapt these equations for streaming data, we first realize each equation as
data multiplied by coefficients that depend on the specific $n$ and $k$. These
coefficients then can be packaged into a matrix that is $n\times k$. By proper
multiplication and addition, these functions can all be implemented.

[width=0.95]figures/streamingDCTUsed.pdf

Figure : This figure shows the streaming DCT, DST, IDCT, and IDST algorithms
which all use this same general framework. Pre-runtime, a $M\times M$ LUT with
words of $K$ bits specific to the transform of choice is stored in memory.
Each time a new piece of data streams in, a new column from the LUT is loaded
into a register array. This data is simultaneously multiplied with each
element in this register array. The output of this then goes into a multiply-
accumulate function until $M$ pieces of data have streamed in, at which point
the process is completed. The points D, G, and I correspond to table
LABEL:tab:wordsize and are used within Fig. 1.

Fig. 1 shows the block diagram for these algorithms and the desired transform
is selected by choice of LUT matrix for the coefficient values. We start
before run-time by generating this coefficient matrix according to equations
5–8 for the corresponding values of $n$ and $k$. At the top of the diagram we
see the data ($x_{\mbox{in}}$) streaming in one word at a time. At each clock
cycle, a new word will stream in and the next column from the coefficient
matrix will get loaded in parallel into the $M$ long array of registers. So
each time a piece of data comes in, that specific piece of data will get
multiplied $M$ times and accumulate in a temporary array until $M$ pieces of
data have come in and the final output vector is ready. In total, $M$ numbers
of multiplications and additions will occur at each clock cycle (this can be
pipelined if needed) as well as loading the next row of the coefficient
matrix. In this way, no clock cycles are wasted since $M$ words come in and
the operations are happening in sync with the data streaming in. Of course a
number of trade-offs are present in this design. For reducing resource usage,
it is best to limit the size of $K$ as this limits the number of simultaneous
multiplications that need to occur (as well as additions). Additionally,
constraints on the clock period can be loosened if pipelining at various
stages is employed, but the ability to do this depends on latency
requirements. Furthermore, we enforce symmetry and anti-symmetry in the
signals streaming into the DCT and DST functions, respectively. Doing so takes
advantage of the even and odd properties of these functions In software, this
is accomplished by replicating data and flipping it where needed. In hardware,
this is accomplished by assigning 0 to particular computations as either the
even or odd coefficient outputs will be 0 depending on if the operation is a
DCT or a DST. Therefore, those computations can be ignored and will not add to
the overall required number of multiplications for the DCT and DST.

##  Zero Crossing

[width=0.70]figures/peakFinding_paperUsed.png

Figure : Shows the process for qualifying derivative signals as a valid pulse.
Three checks occur on the data. 1) threshold to see that the data goes high
(low) enough; 2) checks for a change in sign from positive (negative) to
negative (positive); and 3) checks that the data meets an opposite threshold
that is low (high) enough. If data meets the change of sign check, the two
points around this change of sign are loaded into the position and value
arrays. If final disqualifies pulse, these now-invalid values will be
overwritten.

The zero crossing algorithm is the final stage of finding the peaks in the
data. Here we search for the x-positions–time for xFEL or frequency for ECE
cases–where the derivative signals cross zero. One possible resource
conserving approach to this search for streaming data is shown in Fig. 1.
Given that features resemble something between a triangle and a Gaussian
pulse, the derivative will also have a known shape. With this expectation, the
algorithm waits for the streaming derivative input signal to pass a particular
threshold, then change sign, and finally cross a second threshold. If the
derivative meets these criteria, then the two positions in the data that were
closest to the zero crossing are saved. In hardware, this would involve an
array of predefined length for holding all of the data pairs and corresponding
positions for qualifying zero crossings. A pointer in the array would then
update where in the array the next data pair will be saved. In this way, if a
data pair meet the first two qualifications threshold and then fail the final
threshold, the saved data pair from this can be overwritten by moving the
pointer back. This method determines two x-axis values and two corresponding
y-axis values for the points surrounding the zero crossing. The last portion
of the algorithm arrives at an estimate for the zero crossing based on these
two surrounding points. In the simplest approach, the position corresponding
to the value with smaller magnitude between the two can be taken as the x-axis
position stamp for the zero crossing. We call this method the direct method
for finding the zero crossing. [h!] Weighted average zero crossing
calculation. ($t1$,$v1$) is the first point and ($t2$,$v2$) is the second
point. 2 [1] $(v1\leq 0\land v2\geq 0)\lor(v2\leq 0\land v1\geq 0)$ $|v1|==0$
$t_{out}\leftarrow t1$ $|v2|==0$ $t_{out}\leftarrow t2$ $|v1|\geq|v2|$
$|v1|\leq 2*|v2|$ $t_{out}\leftarrow(2*t2+t1)/3$ $|v1|\leq 4*|v2|$
$t_{out}\leftarrow(4*t2+t1)/5$ $|v1|\leq 8*|v2|$:
$t_{out}\leftarrow(8*t2+t1)/9$ $|v1|\leq 16*|v2|$:
$t_{out}\leftarrow(16*t2+t1)/17$ : $t_{out}\leftarrow t2$ $|v1|==|v2|$
$t_{out}\leftarrow(t1+t2)/2$ $|v2|\leq 2*|v1|$ $t_{out}\leftarrow(2*t1+t2)/3$
$|v2|\leq 4*|v1|$ $t_{out}\leftarrow(4*t1+t2)/5$ $|v2|\leq 8*|v1|$:
$t_{out}\leftarrow(8*t1+t2)/9$ $|v2|\leq 16*|v1|$:
$t_{out}\leftarrow(16*t1+t2)/17$ : $t_{out}\leftarrow t1$ A second method uses
a weighted average between the two surrounding points to elicit a better
resolved x-position stamp. However, a standard weighted average is not
necessarily the most conducive option for efficient implementation in an FPGA.
Instead we propose a modified weighted average method. This method, shown in
algorithm 1, starts by assuming that by construction one point has negative
value ($v1$) and the other has positive value ($v2$). Then it checks if either
the $y$ value of the first point (called $v1$) or the $y$ value of the second
point (called $v2$) are zero. If not, then it compares $|v1|$ and $|v2|$ in
several steps. If $|v1|$ is larger than $|v2|$, then it checks how much
larger. Based on how much larger, the output position ($t_{\mbox{out}}$) is
assigned a corresponding proportion of $t1$ and $t2$. Specifically, we check
if $|v1|$ is 2 times $|v2|$, 4 times $|v2|$, 8 times $|v2|$, or 16 times
$|v2|$. This results in simple, digital operations in the FPGA design.
Similarly, we do the same comparisons for the case where $v2$ is bigger than
$v1$, and we handle the case where $v1$ and $v2$ are the same value by a
standard average. Additionally, the output position estimates can then be
adjusted based on known adjusting constants for time-zero or other required
shifts. This method leverages the ability to easily compare two values and the
corresponding factors involving powers of two, which in an FPGA only requires
shift-registers and comparators. The denominators for division can then be
stored in reciprocal form in LUTs ahead of time for multiplication for the
final output.