Machine Learning for Diagnosing Drug Users and Types of Drugs Used

—Drug use is very detrimental to the physical and psychological health of users. Drug abuse also causes addiction and is a global epidemic. Therefore it is not surprising that scientific research related to drugs has attracted attention for research. However, many factors become obstacles in the medical services of the drug user, including cost, flexibility, and a slow process. Meanwhile, electronic systems can speed up handling time, improve work efficiency, save costs and reduce inspection errors. It means that a breakthrough is needed in developing a platform that can identify drug users. Therefore, this research aims to build machine learning with expertise like an expert who can diagnose drug users and distinguish the types of drugs used by drug users. The expert system on machine learning was developed using the Forward Chaining and Certainty Factor methods. This study concludes that the expert system on machine learning developed can be used to diagnose drug users and distinguish the types of drugs used with an accuracy of up to 80%. The implications of the expert system on machine learning are an alternative method for narcotics officers and medical doctors in diagnosing drug users and the types of drugs used.


I. INTRODUCTION
Social environment factors have influenced others to engage in drug use [1] [2]. Adult figures who are addicted to drugs have a great influence on the behavior of others to become addicted [3]. Poor, low skills, life pressure, anxiety, and deviant behavior are factors that also lead to drug use [3]. Relaxing, drinking, staying up late, increasing enthusiasm, and relieving stress are other triggering factors for many drug use among young people [4]. Drug use, including amphetamines, marijuana, cocaine, heroin, and the like, are a major public health problem in physiological symptoms, resulting in behavioral changes, cognitive problems, and mental health [5]. Drug use also affects the physiology and behavior of future generations [2].
Drug abuse causes physical dependence (addiction) or relapse to continuously consume [6], although it has resulted in physical and psychological problems [6]. The previous research shows that drug users are very high [7] [1] and increasing globally [8]. Drug abuse has become a global epidemic that affects human behavior [9]. Because drug use is very detrimental to the physical and psychological harm of the user, it is not surprising that this research related to drugs has attracted attention for scientific research [10].
Another factor that is often considered in medical services is the cost factor and its inflexibility (Bevan & Patel, 2016). Processes that are done manually tend to cause delays in medical diagnosis [11]. Using an electronic system can speed up handling time, improve work efficiency, and save costs [11]. Using an electronic system allows lower errors and eliminates omissions in deciding the test results and achieving the results [12]. However, the success of curing drug abuse and dependence is still limited; this includes the lack of success in the early identification of at-risk populations, resulting in increased death rates due to overdose [13]. In other words, not paying attention to the early symptoms of consuming drugs will be disastrous and make people who are loved suffer the destructive effects of the substance [14].
Meanwhile, if it turns out to be able to identify it early, it can prevent harmful consequences in the future that are sure to occur [14]. It means that there is a need for breakthroughs in developing platforms that can identify and screen patients susceptible to addiction after using opioid drugs [13]. Therefore, this research aims to develop a machine learning that has expertise like an expert. The expert system created can identify and screen or diagnose early drug users and the types of drugs used by using the Certainty Factor and Forward Chaining methods. The certainty factor method measures the certainty of the type of drug used by the user or patient who conducts consultations. On the other hand, forward chaining plays a role in the flow of the reasoning process from beginning to end based on data mining of physical symptoms of drug users and the types of drugs used (collected or explored previously).
Medical data is helpful as the knowledge that helps make scientific decisions regarding drug use [15]. Electronic medical use based on doctor's notes is useful for an effective treatment medium [10]. In the meantime, data mining is capable of electronic checks based on the patient's medical record [10]. www.ijacsa.thesai.org Besides, the machine learning methods are a technique that can be useful for finding correlations based on the case for prediction purposes [16]. Unfortunately, machine learning is still few in the medical field due to technical problems [17]. Therefore, the simple machine learning method built in this research by imitating (studying) human knowledge in analyzing the physical symptoms of drug users and then implementing it in predicting drug users and identifying drug types used by users. It means that the expert system in machine learning has intelligence like an expert in diagnosing users and the types of drugs used from the physical symptoms that arise from drug users. Taking into account that the current use of information and communication technology (ICT) is growing or expanding very quickly or booming [18]. Therefore, the embodiment of the machine learning system in this research is website-based. So, anyone (the public) can access it from anywhere and has flexibility because it can work on various devices and operating systems. Therefore, a machine learning system in this research is helpful for early diagnosis without having to examine a narcotics laboratory and without a doctor or expert.
It is necessary to know the percentage of machine learning efficacy in identifying drug users and the type of drug used. It means that further testing to determine the actual percentage of machine learning efficacy still needs to be done. This study makes this happen by comparing the test results achieved by machine learning based on symptoms of drug users compared to the test results achieved from laboratory tests of drug users' urine in identifying drug users and the type of drug used. If machine learning has high efficacy, it can save time and cost of drug testing for suspects or drug users by using machine learning compared to testing drugs on urine or blood for suspects and drug users.
Some recent works related to this research:  Zhongheng Zhang (2016) introduced the k-nearest neighbor (kNN) method as a simple machine learning method for modeling [17]. The similarity between the research in this article and the previous one is that they both use a simple approach to machine learning. While the difference is that the research uses the certainty factor method and forward chaining for machine learning, while previous research uses the kNN method for machine learning. Another difference is that the previous research was focus on predicting the class from the new dataset to the most similar class. In contrast, the research in this article focuses on machine learning to diagnose drug users and the types of drugs used.
 Anthony Anggrawan, Khasnur Hidjah, and Jihadil Qudsi S. (2017) implement intelligent application programs to detect kidney failure [19]. The previous research and the research in this article have similarities in developing web application programs with the PHP programming language and MySQL database. In addition, the last analysis used medical data on failure cases to diagnose new renal illness issues using CBR (Case-Based Reasoning method). In contrast, the articles in this study use the expertise of drug experts (specialists) as knowledge of the application system for early diagnosis of drug users and the types of drugs used by drug users using the Forward Chaining and Certainty Factor methods.
 Kurnia Muludi, Radix Suharjo, Admi Syarif, and Fitria Ramadhani (2018) identified tomato plant diseases [20]. This previous research and the research in this article both implements forward chaining and certainty factor methods. However, the difference in the last research is to build an expert system to identify plant diseases based on android [20]. In contrast, the research in the article builds an expert system to identify users of drugs and the types of drugs used based on the website.
 Munaiseche, Kaparang, and Rompas (2018) built an expert system to assist doctors in diagnosing eye diseases [21]. In contrast to the research in this article, it is to create an expert system to diagnose drug users and the types of drugs used. Furthermore, this previous research used the forward chaining method, while the research in this article uses the forward chaining method and certainty factor. The similarities between the previous study and the research in this article are that both use PHP and MySQL in building an expert system.
 Ninive Von Greiff and Lisa Skogens (2021) investigated a drug user recovery program for drug addiction [22]. The research method is the interview or qualitative approach [22]. The similarity of the research in this article with previous studies is that they both study drug users. The difference is in previous studies examining the results of addiction recovery on drugs with the interview method. Meanwhile, the research in this article builds machine learning that has an intelligent system to detect drug users and the types of drugs used.
The latest related work identifies that the article in this study has a novelty that no previous researcher has researched. Another strength of this research is conducting a comparative test to determine the efficacy of machine learning or expert systems developed in identifying users and the types of drugs used by users that have not been studied before.
The systematics of writing this paper is as follows: the following sub-section discusses the research methodology, which includes research data and research methods used. The next subsection discusses the results and discussion of the research. Finally, the conclusions obtained from the study results and suggestions for further research are narrated in the Conclusions subsection.

II. RESEARCH METHODOLOGY
This study is a case study at the Indonesian National Narcotics Agency (Badan Narkotika Nasional or BNN) in Mataram, Indonesia. The number of drug users used as samples to test the expertise and accuracy of the machine learning built in this study was 30. The selection of data samples in this study was random. This research's www.ijacsa.thesai.org development of machine learning expertise consists of stages: knowledge acquisition, expert system design (programming), machine learning/expert system testing, and accuracy test (see Fig. 1).

A. Knowledge Acquisition
For the system development stage, the effort made is to obtain knowledge from drug experts, which is used as a knowledge base to build the machine learning or expert systems. The method used in obtaining knowledge related to narcotics is the interview method. The knowledge gained is the knowledge about the types of drugs and their symptoms. Based on the knowledge obtained, there are ten types of drugs that drug users dominantly use, and there are 27 types of drug symptoms.
In the knowledge acquisition stage, an expert from the Indonesian National Narcotics Agency (in Mataram, Indonesia) shares knowledge about drug use, including those related to symptoms and the types of drugs used by drug users. The knowledge gained at this stage serves as a knowledge base in building expertise from machine learning.

B. Expert System Design
The expert system design stage is a process for modeling the data that has been collected and designing an application system that is planned according to programming problems and the acquisition of knowledge obtained. This stage in computer science is known as planning the use case diagram design, data flow diagram (DFD) design, database design, and flowchart to be built on the application program. The programming stage is the implementation stage of the system design plan into a computer programming language [23]. This research uses the PHP and MySQL programming languages. The computer application program that is built is a cloud application program. Application development with PHP programming language and MYSQL database makes application programs can run via the web. By being stored on the server computer, the application program is ubiquitous. The ubiquitous application program means that the application program can be accessed from anywhere and at any time [24].

C. Machine Learning Testing
The machine learning testing phase is the functional testing phase of the built application or black-box testing. Black-box testing is a test that no longer involves programming code or programming languages. In short, black-box testing on the expert system in this study is to determine whether the expert system built is under the list of desired system requirements.

D. Accuracy Test
Testing accuracy in machine learning is to determine the level of expertise of the expert system built in this study. It means that it is known how much accuracy the expert system has built-in diagnosing users' types of narcotics.

A. Knowledge Acquisition
The knowledge acquisition stage is the stage of acquiring the required knowledge data. The acquired knowledge acquisition data is useful in solving programming logic in diagnosing users and the types of drugs used by drug users.   After modeling the acquired knowledge acquisition data or knowledge representation (as shown in Table III) the next step is to implement it into the certainty factor algorithm. The certainty factor uses a value between 0.2 and 1.0 to assume a level of confidence in the data. A simulation of the calculation of the certainty factor was carried out based on the weight of symptoms arising from the type of drug used by drug users with weights of 0.8 and 1.0 according to the opinion of the drug expert (see Table IV). So, on the drug symptom weighted score given to the certainty factor, a score of 0 indicates that drug users do not experience these symptoms. If a drug user experiences symptoms, then the weighted score given for the frequently experienced symptoms is 0.8 and the most frequently experienced is 1.0, according to the drug expert's decision.
This study's knowledge base of machine learning expertise is the symptoms, types of drugs, and CF rules obtained from drug experts (see Table V). The knowledge base is an essential component that contains the knowledge possessed by competent experts in the related field (i.e., narcotics in this study). Furthermore, the knowledge base is the basis for decision-making in an expert system, where this decisionmaking is related to the process of retrieving previously collected and stored knowledge. Fig. 2 shows the interactions that occur between system users and the developed expert system. This study has a database that stores records of users, patients, symptoms, and types of drugs, including diagnostic data, so it is necessary to design a data workflow model to realize a structured program.  The Data Flow Diagram (DFD) in Fig. 3 and Fig. 4 illustrates where the data flow comes from and where the data processing on the expert system is built.

B. Expert System Design
The context diagram in Fig. 3 shows the data flow of the system globally. In contrast, the overview diagram in Fig. 4 shows a more detailed data flow that the system performs and its engagement with external data.
The flow diagram in Fig. 5 shows a series of flow relationships in the expert system built in this study or shows the overall process sequence in building an expert system in this study.
The flow diagram contains a more detailed description of how each step of the procedure is actually carried out in building an expert system on machine learning that can diagnose users and the types of drugs used by users.

C. Machine Learning Testing
Expertise testing of machine learning is carried out using case samples from a patient. For example, in one case, a drug patient had symptoms of shortness of breath, depression, chills, anxiety and restlessness, and irritability. Symptoms of drug patients who have symptoms of shortness of breath, depression, chills, anxiety and restlessness, and irritability are symptoms of drug users: (1) Cocaine, (2) Cannabis, (3) Heroin, and (4)   Based on the value of manual calculations, the largest CF value is taken, which is 0.953 or 95% with the type of marijuana drug. It means the patient is using a type of marijuana drug. A case example is tested on an expert system application program (or on machine learning). If the patient's symptoms in the case sample (with the same symptoms) are entered into the expert system built in this study, the result of the process is as shown in Fig. 6.
Expert system testing on machine learning shows that the expert system has succeeded in correctly identifying the user and the type of drug used by the user. In order to know how accurate the machine learning expertise is, this study also tested several other patients by comparing the results with the urine test results at the Indonesian National Narcotic Agency laboratory in Mataram, Indonesia.   Fig. 7 describes it as follows: You are probably using a type of drug with a 95% certainty. Another narrative in Fig. 7 is: another name for cannabis is cannabis sativa. Cannabis sativa is a cultivated plant that contains fiber and narcotic substances in its seeds. This drug makes user experience euphoria, namely a prolonged feeling of pleasure for no reason. The cure is psychotherapy, which helps the patient strengthen the motivation to stop using it.
Expert system testing on machine learning shows that the expert system has succeeded in correctly identifying the user and the type of drug used by the user. In order to know how accurate the machine learning expertise is, this study also tested several other patients by comparing the results with the urine test results at the Indonesian National Narcotic Agency laboratory.

D. Accuracy Test of Machine Learning
The accuracy test of machine learning in this study is to determine the expert performance of the application system built-in diagnosing users and the types of drugs used.
Testing the level of accuracy of machine learning expertise is to compare the suitability of the results with the urine test results from patients at the Indonesian National Narcotics Agency. In a trial of 30 times on 30 patients, there were 30 results of machine learning tests that can correctly identify drug users and as many as 24 machine learning test results that can detect the types of drugs used by drug users. It means that the test results on the data of 30 drug patients show that an expert system on machine learning built using the Certainty Factor method has expertise in diagnosing drug users up to 80 percent. The accuracy rate of up to 80 percent is obtained from the calculation results of 24 divided by 30 and multiplied by 100%.
The implication of this research result is that the expert system built in this study can be a tool (choice) to replace or complete the testing system for drug users through urine testing in the laboratory.
The drawback of the results of this study is that machine learning expertise in this study is only limited to simple machine learning, as is the case with simple machine learning which was built on previous research by Zhongheng Zhang (2016), which used the KNN method in building learning machines. Furthermore, the machine learning expertise generated from this research is only limited to the expertise possessed in accordance with the knowledge obtained (symptoms, types of drug abuse, rule base, and calculation of certainty factor) under study. Therefore, further research needs to build machine learning that can increase its expertise based on more new data and use another method.