## 4 Research Method
### Naive Bayes Machine Learning Algorithm
#### 4.1.1 Proposed System Overview  
We utilized Android smartphones with Android version 12 or higher, equipped with sensors for context identification and authentication. The research focused on the operating system rather than specific brands to cater to different users who used their devices since the research used the Bring Your Own Device (BYOD) concept. After data collection, data analysis was conducted using R Studio. The smartphone worked as a lightweight information processor, sensing and actuating, and sending data to the cloud for further processing and storage. The research introduced a new feature, human-machine collaboration, which was integrated into the framework's monitoring, analysis, and execution. This work introduced novel aspects that included assigning authenticators based on risk, user medical conditions, available authenticators, and testing outside the lab environment. The Naive Bayes algorithm described in the previous section was used to calculate the risk associated with a login attempt. A user was defined using contextual features included in the algorithm below, namely, mobile browser, mobile operating system, IP address, network type, GPS coordinates, and access time. These features were used in the Naive Bayes chain rule to calculate the conditional probability of a login attempt being illegal based on the number of mismatches with known features. Having determined the risk score, the user'sage and medical condition were used, guided by the analysis of authenticators conducted in Section 2 to determine which authenticators available on a particular device could be used to authenticate an elderly user. Algorithm 1 shows the steps that a user follows from the time of clicking the login button to the time of authorization. ```
Input: \begin{tabular}{} \end{tabular} 
```
1. Start adaptive app by clicking an icon. \\
2. Obtain user verification information: \\  * User--begin signup if no account exists, or login if already registered. \\  * User--during signup, select medical condition(s) for the app to determine the usable authenticators for the user. \\  * App--verifies user email address/phone number and password or PIN. \\
3. Define partial conditional probabilities as weights using the Naive Bayes Theorem: \\  * App--use Naive Bayes to define conditional probabilities of deviation of input. \\  * App--capture all background and active data that define a user. \\
4. Calculate first-level weighted risk score: \\  * App--obtain email/username and device parameters. \\  * If the account is verified on the device, request an adaptive authentication PIN or password \\  * else \\  * Call other available and usable verification methods. \\
5. Calculate second-level weighted risk score: \\  * Verify user against the device. \\  * If the user and device match, call one usable authenticator and update the trust score \\  * Call other available and usable authenticators. \\
6. Iterate through user profiles: \\  * Begin: while trust score! threshold \\  * Repeatedly continue through each user profile, calculating the risk score, and initial trust score. \\  * Authenticate with available and usable authenticators, one at a time. \\  * Update trust score at each iteration: \\  * trust score += trust score \\  * End \\
7. Display Results: \\  * Show each user's risk score, trust score, and whether authenticated or not. \\
8. Authorize: \\  * Grant access to requested resources. \\ \end{tabular}  
The following is a summary of the algorithm: With the help of enumerators, users downloaded, installed, and registered on the adaptive app on their smartphones. Through the use of device sensors, the application gathered information in the background about the user, the device, the network, the location, the access time, and other details requiredto create a preliminary user profile. To ascertain the risk involved with that login attempt, the application then computed the risk score. One could log in with the same or different contextual data on the same or different days.