Ahmed Fizar
email: fizarbd@yahoo.com

Phd

An IoT-Big data based machine learning technique for forecasting water requirement in irrigation field

Keywords: Internet of Things (IoT), Irrigation, Ground Water, Machine learning, Multiple linear regression

Efficient water management is a major concern in rice cropping. Controlling the use of excessive water in irrigation field is essential for the protection of underground water that will also be the part of climate change adaptation. The sustainable use of water resources is the prior task in Bangladesh. Imbalances between demand and supply are the main region for degradation of surface and groundwater. The human readability of checking the water level on irrigation field is considerable for these circumstances. In this paper I discussed the procedure for monitoring of surface water level in irrigation field, continuous monitoring of weather condition like temperature, air pressure, sunlight, rainfall etc. by using sensor network. The aim is to create a machine learning mechanism for farmers that can be given a forecast of water demand of irrigation field by the collection of IoT based data. In turn, this will help the farmer to prepare them to give water and on the other hand it will be helpful to use appropriate ground water and also it can be used for predict energy utilization. In this research Multiple linear regression algorithm is used for this prediction. Data from the irrigation field of North-West part in Bangladesh is used here to find the result of prediction.

Introduction

Water management is important for the adaptation of climate change. Shortage of water resources are directly affects the vulnerability of ecosystems, socio-economic activities and human health. On the other hand climate change is likely to lead to major changes in water availability across Bangladesh with increasing water scarcity and droughts mainly in North-West part of this country.

It's assessed that as much as 50 per cent of irrigation water is wasted due to evaporation or runoff. This happens because most irrigation systems still rely upon simple human reading. However, Internet of Things technologies can provide "Smart" irrigation systems. It can be useable for monitoring soil conditions, surface water level in real time with low power, wireless sensor networks. The wireless sensor networks send the data to a central network gateway, and the network gateway sends the data to the cloud platform. The gateways have the ability to connect via both wired and cellular data connections, so that can be point them from anywhere. In the internet cloud platform machine learning applications can be used for sending the application result to the end users mobile phone or personal computer.

This research mainly focused on the utilization of ground water in weather-based irrigation field. Weather-based irrigation determines the amount of water needed by the landscape based on the current weather conditions, such as precipitation, solar radiation, temperature, relative humidity, and wind speed. Weather data is provided by IoT based land weather station. Data from the weather station matching with measuring the level of water by using distance sensor where mainly measure the level of water loss from the soil due to evaporation and plant transpiration. This water level data in millimeter will be as a class data with other weather perimeter. A machine learning technique multiple linear regression algorithm is used here for prediction of water loses due to this weather condition in near future.

2

Related works

In Bangladesh, mainly in the north-west part of this country, ground water is the main source of irrigation. Shahid & Hazarika (2010) investigated groundwater scarcity and drought in three northwestern districts of Bangladesh. They proposed a Cumulative Deficit approach from a threshold groundwater level has been used for the computation of severity of groundwater droughts. Their research shows that groundwater scarcity in 42% area is an every year in the region. The daily evapotranspiration from rice field will increase by an average of 31.3 mm and 0.33 mm/day respectively by the year of 2100 [START_REF] Shahid | Impact of climate change on irrigation water demand of dry season Boro rice in northwest Bangladesh[END_REF]. The main finding of this research is that climate change will increase the daily use of water for irrigation by an amount of 0.8 mm/day in the end of this century.

In (2003) shows that paddy soils throughout Bangladesh showed that arsenic levels were elevated in zones where arsenic in groundwater used for irrigation was high, and where these tube-wells have been in operation for the longest period of time. The finding of another research of Meharg ( 2004) is "Arsenic is sequestered in iron plaque on root surfaces in plants, regulated by phosphorus status, and that there is considerable varietal variation in arsenic sequestration and subsequently plant uptake, offers a hope for breeding rice for the new arsenic disaster in South-East Asiathe contamination of paddy soils with arsenic".

For reducing the wastage of ground water smart irrigation system is now the most priotize topic in agriculture research. [START_REF] Mathurkar | A review on smart sensors based monitoring system for agriculture[END_REF] focused on optimizing water management for agriculture through the physical and socioeconomic conditions that inspired the success of an "indigenous technology" which has for spanning exploited the potential for excess harvesting. Monda, Basu, & Bhadoria (2011) described a Precision Agriculture (PA) concept was initiated for site specific crop management as a grouping of locating system. By using this way of proper resource utilization and management, to a environmental friendly sustainable agriculture is possible that they focused. Nandurkar & Thool (2012) designed a sensing system is based on a "feedback control mechanism" with a integrated control unit which standardizes the flow of water on to the field in the real time based on the rapid temperature and moisture values. They also prepared a table that discover the amout of water needed by that crop. Roy & Ansari (2014) and Awasthi & Reddy (2013) developed the irrigation control system to avoid wastage of water and increase irrigation efficiency by using a PLC based irrigation system with the help of soil moisture sensor, water level sensor, and GSM controller. Their system can be used for sending message to farmer on mobile through GSM network for controlling actions. 3 For example, in the built-in data set stackloss from observations of a chemical plant operation, if we assign stackloss as the dependent variable, and assign Air.Flow (cooling air flow), Water. Temp (inlet water temperature) and Acid.Conc. (acid concentration) as independent variables, the multiple linear regression model is:

Multiple linear regression algorithm

Methodology

Hardware specifications

To read real-time data is typical of a weather station, using different sensors, and capable of communicating via LoRa. After a review of all known hardware available on the market, all the components strictly necessary to the solution were defined, which in turn fulfilled the requirements of the above: The hardware chosen was:

Core System controller

In terms of the core system within the Weather Station solution, it is composed by the Feather32u4, which that takes a specialized role in the system where it performs control functions through software, with processing power, enabling the sensory devices to gather data from the environment, using specific libraries. This system also has built-in communication capabilities.

Data Acquisition

The weather shield is an integrated module with several built-in sensors capable of collecting data, such as temperature, humidity, luminosity, barometric pressure and altitude. Along these sensors, the weather shield also enables the integration of three more different sensors to collect data regarding wind direction, wind speed and amount of rain. Based on the proposed model, it becomes clear the connection between the controller and the Weather Shield. This connection is established with the I2C protocol that allow this digital integrated circuit to communicate with one or more masters. It is used this type of protocol because it's only intended short distance communications within a single device and only requires two signals to exchange information. The software controller uses the library "Wire.h" that is dedicated to the I2C logic protocol. The embedded software requires the "SparkFunHTU21D.h" and "SparkFunMPL3115A2.h" libraries in order to call all the functions responsible for activating and reading the sensors signals coupled to the weather shield.

Data Communication

Like as expected in the proposed system model, the controller will send data to the outstation, based on the information collected from the weather shield module. For this it makes use of the "SPI.h" library to run the communication with the radio module RFM9x LoRa 868/915. The LoRa radio must communicate with the LoRa gateway, specified by the system, and for that will interact with the "featherLora.h" library. The data will be collected according to the time windows described, already considered in the project. At the end of each time window will be sent the package with the message containing the information collected. In data sharing with outstation it was established to send an acknowledge information packet like a result of the incoming data from the different sensors. The typical message to be sent from one gateway to another is based on the type message as described in the following example:

Example of the message send in the package: \\!TC/18/HU/85/LU/0.56/ WD/90/WC/5.55

The following table outlines the type and content of the information sent in each package:

Result and analysis

The following result has been found from this testing dataset: The intercept shows the estimated mean Y value when all Xs are 0. We can associate with increase some values of wind direction, speed or other values water level adjusting or controlling the for Luminous or humidity. The hypothesis test that the slope for WD or others is 0.

The collinearity between WD and and WC means that we should not directly interpret the slope, as the effect of WD on DM adjusting for WC. The high correlation between two values suggests that these two effects are somewhat bounded together.

Here confint values shows the slope for the level of 95%.

Conclusion

This IoT based machine learning works was my sample hands-on experience with real time data. Behind this task, it has a lot of preparation for a big part: it involved data understanding, sorting and reframing. That is beyond of this research work. A sample small scale data just used here to show the result for predicting data model. It is definitely challenging to work with this type big data. And finally, as I tried to understand the different correlation relationships between the parameters and the forecasts, I surprisingly also got a better understanding of prediction from the information of weather perimeters and IoT data collection point of view.

  Many machine learning techniques have been developed for learning rules and relationships automatically from various agricultural data sets. McQueen, Garner, Nevill-Manning & Witten (1995) and Ozdogan, Yang, Allez & Cervantes (2010) described a project that is applying a range of machine learning strategies to problems in agriculture and horticulture. They experimented and described some software requirements on real-world data sets. They also explored the value of archived data that enable comparison of images through time.[START_REF] Ozdogan | A new methodology to map irrigated areas using multi-temporal MODIS and ancillary data: An application example in the continental US[END_REF] presented a dryland irrigation mapping methodology that relies on remotely sensed inputs from the MODerate Resolution Imaging Spectroradiometer (MODIS) instrument. They proposed different steps for mapping expected patterns where the dividing of majority of irrigated areas is concentrated in the dry lowland valleys. Image processing is an effective tool for analysis of the agriculture data sets[START_REF] Vibhute | Applications of image processing in agriculture: a survey[END_REF]. This paper focussed on the survey of application of image processing in agriculture field such as imaging techniques, weed detection and fruit grading.A machine learning technique Support Vector Machines (SVMs) was used for classified various crop types in a complex cropping system in the Phoenix Active Management Area (Zheng, Myint, Thenkabail & Aggarwal 2015). They used "Landsat timeseries Normalized Difference Vegetation Index (NDVI)" data using training datasets selected by two different approaches: stratified random approach and intelligent selection approach using local knowledge. For weather prediction[START_REF] Radhika | Atmospheric temperature prediction using support vector machines[END_REF], long-term prediction of lake water levels[START_REF] Khan | Application of support vector machine in lake water level prediction[END_REF], SVM is the most promising technique for better expectation. SVM can also be used for time series application in many application areas from financial market prediction to electric utility load forecasting to medical and other scientific fields[START_REF] Sapankevych | Time series prediction using support vector machines: a survey[END_REF]).

A

  multiple linear regression (MLR) model that describes a dependent variable y by independent variables x1, x2, ..., xp (p > 1) is expressed by the equation as follows, where the numbers α and βk (k = 1, 2, ..., p) are the parameters, and ϵ is the error term.

4 . 5 Figure 1 -

 451 Figure 1 -Architecture model with the set specifications.

  Multiple R-squared: Approximately 79% variation in water level (Distance in Millimetre-DM) can be explained by this model. (Wind direction -WD, Wind Speed-WC, Humidity-HU, Luminous-LU and Temperature-TC) F-statistics: These tests are null hypothesis and all the model coefficients are 0. Residual standard error gives the idea of how far observed water level -DM (Yvalues) are from the predicted or fitted DM(the Y-hats). This gives us an idea of a typical size of residual or error e= y -y'.

  are at risk of arsenic poisoning-related diseases because the ground water in these wells is contaminated with arsenic. Alam, M. G. M., et al.(2002) reviews the arsenic infection of ground water, hydrological systems, groundwater potential and utilization and environmental pollution in Bangladesh. They discussed the main actions required to ensure the sustainable development of water resources in Bangladesh.[START_REF] Safiuddin | Groundwater arsenic contamination in Bangladesh: causes, effects and remediation[END_REF] also highlighted the causes and mechanism of arsenic contamination and presented several measures to remedy the arsenic contamination in groundwater. Another survey by Meharg & Rahman, M

	annual diesel consumption for groundwater extraction is of the order of 4.6 billion
	liters, costing USD 4.0 billion in aggregate.
	40 million people
	their research finding Qureshi, Ahmed, Krupnik (2014) shows that 35,322 deep
	tubewells, 1,523,322 shallow tubewells and 170,570 low lift pumps are working in
	Bangladesh to provide water for irrigation. About 79% of the total cultivated area in
	Bangladesh is irrigated by groundwater, whereas the remaining is irrigated by surface
	water. More than 90% of the pumps within Bangladesh are run by diesel engines. The
	remaining 10% use electricity. Despite subsidies on electricity, diesel pumps are pre-
	ferred by farmers due to low capital cost and mobility ease within small and frag-
	mented farm lands. Each year, on average, about 980 million kWh of electricity is
	used by electric tubewells with an estimated subsidized cost of USD 50 million. The

Table 1 -

 1 Communication package.

	TC	Temperature
	HU	Humidity
	LU	Luminosity
	WD	Wind Direction
	WC	Wind Speed


Jianshui Bi
email: bijianshui@sjtu.edu.cn

Hongming Cai
email: hmcai@sjtu.edu.cn

Bo Zhou
email: zhou_bo1@hoperun.com

Lihong Jiang
email: jianglh@sjtu.edu.cn

Method of Domain Specific Code Generation Based on Knowledge Graph for Quantitative Trading

Keywords: code generation, knowledge graph, quantitative trading

Quantitative methods have been adopted by more and more individual investors for investment activities. Many third party platforms have been developed to help users complete the process of backtesting, which fills the gap between the trading strategy code and the trading strategy model. However, using a quantitative platform for backtesting has a high threshold for users who do not have programming experience. There is still a huge gap between the description and the code of trading strategy. Code generation allows developers to focus more on business related design and implementation, thereby increasing the efficiency of software development. The import of domain knowledge can improve the accuracy of requirement parsing to improve the quality of constructed code model. The general knowledge base is often incomplete in terms of domain specific terms and relationships, and the construction of domain knowledge graphs requires more domain related data. In this paper, encyclopedia data and the financial report data are used to extract domain terms and relations. And then a domain knowledge graph for quantitative trading is constructed to realize the automatic generation of quantitative trading strategy code.

Introduction

Quantitative trading takes the advantage of mathematical models instead of artificial subjective judgments, thus avoiding the adverse effects of human emotions in financial products trading. In addition to institutional investors, more and more individual investors have begun to invest through quantitative methods. The key step in establishing a quantitative trading model is to validate the effectiveness of the proposed model. Historical data are used to simulate the model performance in history. This process is often referred to the backtesting of a quantitative trading strategy. There are many third party backtesting platform providers at present, which provides the historical market data and the transaction simulation program package. Users can write code of trading strategy on the platform, which will be processed based on historical market data using the trading simulated engine provided by the platform. Then an evaluation report is generated to tell users the performance of the strategy in history, including the rate of return, the sharp ratio, etc., which is supposed to improve the strategy for users. These platforms enable users not need to obtain historical transaction data in advance, nor to deal with the logic of analog transactions, and to calculate the transaction results, greatly reducing the threshold for users to develop quantitative trading strategies.

However, the existing quantitative trading backtesting platform usually requires users to follow certain rules defined by the platform. Strategies are supposed to be written to code in a specific programming language. Users without engineering background usually have a high learning cost to be skilled in a programming language. And because different platforms are implemented based on different frameworks, the code of trading strategies between different platforms is often difficult to migration.

Code generation is to generate computer programs by some mechanisms, thus allowing software engineers to program at a higher level of abstraction, which can improve the quality of the code. Code generated quality only depends on the code template, code model and the data file. Developers can focus more on business related design and implementation, which improves software development efficiency. Code generation can also reduce the difficulty for code migration in different frameworks. It takes the business logic into the language independent model, and code for different frameworks can be generated by providing code templates for different frames based on the same business logic model.

Code generation is usually based on different forms of requirements descriptions, and requirements descriptions are highly relevant to application domains. Domain terms need to be identified in natural language requirement descriptions. Domain knowledge graphs, as a collection of domain terms and relationships, can be used for text requirement descriptions identification. This paper uses the domain specific data of open knowledge base and open data as the data source to build the knowledge graph in the field of financial analysis. By the analysis of the user's strategy description text based on the domain knowledge, the strategy code in backtesting platform can be generated. Therefore, users can focus more on the strategy, instead of the policy of written code about the specific platform. Users can develop quantitative trading strategies to guide investment activities without programming skills, which reduces the threshold for users to use the quantitative trading backtesting platform.

The paper is presented as follows: Section 2 describes the related work; Section 3 provides an overview of framework; Section 4 describes the proposed method for the domain knowledge graph construction for quantitative trading; Section 5 presents the method and the example of generate code for a specific backtesting platform; and Section 6 gives the conclusion of this paper.

Related Work

Code generation usually takes different forms of requirement description as input.

Through the analysis and modeling of requirement description, combining code template or code generation rule, the program source code is generated. Requirement description is usually based on the specific application domains, including a large number of terms in the field of text description. The identification of domain terms is a prerequisite for accurate identification of requirements in the domain text, as well the relationship between domain terms and program execution logic. As a collection of domain terms and relationships, domain knowledge graphs can play an important role in the identification of text requirement descriptions. Alkhader Y et al. [START_REF] Alkhader | Experimenting With Extracting Software Requirements Using NLP Approach[C]// International Conference on Information and Automation[END_REF] used the natural language description of the requirements document as input, automatically generate the corresponding UML class diagram design. After processing with natural language related technology to generate requirements documents described in XML format, it is necessary for requirements engineers to use domain knowledge to manually eliminate redundancy and solve similarity problems. Popescu D et al. [START_REF] Popescu | Reducing Ambiguities in Requirements Specifications Via Automatically Created Object-Oriented Models[C]// Innovations for Re-quirement Analysis[END_REF] transformed the constraint grammar representation requirements specification statements into object oriented analysis model based on domain terms, to help identify the manual review of ambiguity and inconsistency. The grammar and part of speech rules are used to recognize the domain terms.

Bolloju N et al. [START_REF] Bolloju | A knowledge-based object modeling advisor for developing quality object models[END_REF] introduced the knowledge based model quality and model ontology to evaluate the quality of object model, so that the model constructed has better semantic quality. Li G et al. [START_REF] Li | An Engineerable Ontology Based Approach for Requirements Elicitation in Process Centered Problem Domain[END_REF] proposed an engineering process that enables domain ontologies to guide the requirements elicitation process. Kong D et al. [START_REF] Kong | RESEARCH ON A VELOCITY-BASED AUTOMATIC CODE GENERATION TECHNOLOGY[END_REF] using the dom4j analytical framework and the Velocity template engine, automatic generation of database definition language, database manipulation language and the specific operation page code for information management system. Wei Y et al. [START_REF] Wei | Backstage Management System Code Generator Based on J2EE and Maven[END_REF] used predefined code templates to generate project code that meets the specific J2EE MVC framework based on FreeMarker. Lopata A et al. [START_REF] Lopata | Knowledge-Based MDA Approach[C]// Business Information Systems Workshops[END_REF] proposed that import enterprise model and enterprise meta model as knowledge data source in the model driven architecture development process.

As a collection of domain terms and relationships, domain knowledge graphs have important applications in the fields of natural language processing and other fields. The extraction of domain terms and relationships is the core work of domain knowledge graph construction. Hua B et al. [START_REF] Hua | Extracting Information Method Term from Chinese Academic Literature[END_REF] used a rule-based approach to identify sentences containing technical terms from academic literature. Technical terms were extracted based on combining the rules and the vocabulary lists. Song P et al. [START_REF] Song | A New Method for Knowledge Unit Automatic Extraction Using Definitions of Terms[END_REF] used dependency parsing and automatic annotation of semantic roles to formulate extraction rules and weights, and extract knowledge units automatically from the term definition sentences.

The goal of relation extraction is to extract the fact between entities, and the relation extraction problem is usually abstracted into a two classification problem, that is, to determine whether the selected two entities have the relation. Perera R et al. [START_REF] Perera | A Multi-strategy Approach for Lexicalizing Linked Open Data[M]// Computational Linguistics and Intelligent Text Processing[END_REF] put forward the characteristics of words, semantic features and other dimensions for the application of relation extraction. Chen C et al. [START_REF] Chen | REV: extracting entity relations from world wide web[C]// International Conference on Ubiquitous Information Management and Communication[END_REF] proposed to use iterative methods to extract patterns of specific relationships based on predefined entity relationships, and then further extract relationships.

In this section, we present a brief overview of importing domain knowledge in code generation process, as well the term extraction and relation extraction in knowledge graph construction.

3

Overview of Framework The input in strategy code generation phase is the strategy description written in natural language following some rules, and the output is the strategy code for a specific quantitative trading backtesting platform which is determined by the code template and the comparison table which is shown in Fig. 2. The method of domain specific code generation based on domain knowledge graph for quantitative trading mainly has the following steps:

1. Term Extraction: In this step, the domain terms of financial analysis for quantitative trading need to be extraction for later relation extraction. Encyclopedia data are used as the data source to extract domain terms by defined rules according to the features different from common words. 2. Relation Extraction: In this step, the relation between domain terms needs to be extraction for domain knowledge graph construction. We use some domain specific text in open data in addition to encyclopedia data to establish the relation between domain terms extracted in above step. 3. Description Parsing: In this step, the quantitative trading strategy written in natural language need to be parsed. The domain terms are identified based on domain knowledge graph. And the domain knowledge in the domain knowledge graph is used to construct the strategy platform independent model. 4. Code Generation: In this step, the quantitative strategy code can be executed in a specific quantitative trading backtesting platform will be generated based on the strategy model and the code template related to the specific backtesting platform.

In this section, we give a brief overview of the framework we proposed in this paper. We use encyclopedia data and domain specific data in open data to extract domain terms and the relation between domain terms. And a domain knowledge graph for quantitative trading is constructed to provide domain knowledge in domain specific code generation.

Domain knowledge graph construction

In this section, we describe the method of constructing a domain knowledge graph in financial analysis for quantitative trading, including the domain terms exaction and the term relation extraction.

Domain Terms Extraction

To construct a domain knowledge graph, we need to extract the terms in the domain firstly. This paper builds a knowledge graph that applies to financial analysis, so it is necessary to extract the terms in the field of financial analysis. There are some entries to summarize the relevant terms in the encyclopedic data and domain terms can be extracted from them. For example, financial ratios entry in Wikipedia and Baidu encyclopedia includes inventory turnover rate and total asset turnover ratio, and financial analysis entry in Baidu encyclopedia contains price earnings ratio, price to book ratio, etc. An example of financial ratio entry in Wikipedia is shown in Fig. 3. These domain terms in summary entries usually have common characteristics. For example, in the field of financial analysis, domain terms usually associated with formula. At the same time the related domain terms also has some domain independent common characteristics. For example, if the word contains hyperlinks to the other entry, the word is more likely to be a term. In this paper, these features are used to define rules for extracting domain terms of financial analysis from relevant summary entries. And These domain terms will be used for subsequent relation extraction and domain knowledge graph construction.

Term Relation Extraction

In the previous section, the extraction of domain specific terms has been completed. This section describes the method of extracting the relationships between domain terms based on the domain terms extracted from the previous section. The data source of relation extraction mainly includes two parts, one is the entry pages in the encyclopedia, and the other is the other open data related to the field as a supplement.

For the term entry page in the encyclopedia, we use pattern matching method to extract relations between domain terms. An example of same as relation in price earnings ratio entry in Wikipedia is shown in Fig. 4. For example, price earnings ratio entry has the following statement in Baidu encyclopedia, also known as market price earnings ratio, pe ratio, and PER. The price earnings ratio, market price earnings ratio, pe ratio, and PER are the same meaning in the field of financial analysis can be represented by three tuples are as follows:

• < price earnings ratio, same_as, market price earnings ratio > • < price earnings ratio, same_as, pe ratio > • < price earnings ratio, same_as, PER > For the extraction of relation between domain terms, the formula of field terms can be obtained by matching the patterns of specific computational symbols. For example, with the term quick ratio, the Baidu encyclopedia describes the entry as equation [START_REF] Alkhader | Experimenting With Extracting Software Requirements Using NLP Approach[C]// International Conference on Information and Automation[END_REF].

Quick Ratio = Quick Assets / Current Liabilities (1)
The segmentation of the formula to a symbol of operation, we can get the relationship in three domain terms about quick ratio, quick assets and current liabilities, and the quick ratio is equal to the quick assets divided by current liabilities. This relationship can be represented by a set of tuples:

• < quick ratio, f1_dividend, quick assets > • < quick ratio, f1_divider, current liabilities >

The f1 in the above tuples means that the tuples are number 1 group statements for the quick ratio term. In this relation, quick assets is as the dividend in quick ratio calculation, and the current liabilities is as the divider in the quick ratio calculation. The relationship can be expressed as quick ratio equal to the quick assets divided by the current liabilities.

For the domain terms extracted from the above mentioned method, the relations are extracted from the corresponding entries in the encyclopedia. The relationship between domain terms can be obtained to establish a domain specific knowledge graph.

However, the encyclopedia data usually depends on the manual editing, which means the cover of the specific domain terms may not be very complete. This paper uses other open data related to this domain, in order to enhance the degree of coverage of the domain terms. XBRL (Extensible Business Reporting Language) format of standard financial report has been more and more accepted by the exchange and the listed company. The calculation link library including in the XBRL format financial report can be used as a supplement for encyclopedia of data to domain term relation extraction.

XML format is used in extensible business reporting language format of financial report to describe the calculation relation. We defined rules to transform XML format description to our three tuple format in domain knowledge graph.

The following is an example of an extensible business reporting language format of financial report:

• < arcrole = http://www.xbrl.org/2003/arcrole/summation-item from = "gross profit" to = "sales revenue" order = "1" weight = "1" />

• < arcrole = http://www.xbrl.org/2003/arcrole/summation-item from = "gross profit" to = "cost of sales" order = "2" weight = "-1" />

The http://www.xbrl.org/2003/arcrole/summation-item means the items described in the code are the total sum of the relationship. In this relationship, the gross profit is the summary item, while the sales revenue and the cost of sales are the add items. The order attribute means that in this relationship, sales revenue is the first and cost of sales is the second. The weight attribute means that in this relationship, the weight of sales revenue is 1 and the weight of cost of sales is -1. The code fragment represents the relationship between gross profit, sales revenue and cost of sales, follows the equation ( 2).

Gross Profit = Sales Revenue -Cost of Sales (2)

Converting the above relation into a three tuple format expresses as follows:

• < gross profit, f1_minuend, sales revenue > • < gross profit, f1_subtrahend, cost of sales > Fig. 5 shows a part of constructed domain knowledge graph for quantitative trading.

The relation between domain terms in constructed domain knowledge graph can be represented by tuples. The net operating profit rate is equal to the net profit divided by operating income as an example, the following tuples can be used to be the representation of the relationship.

• < net operating profit rate, f1_dividend, net profit > • < net operating profit rate, f1_divider, operating income > Two tuples above mean that the net operating profit rate can be obtained by the calculation of the net profit and the operating income, the net profit for the dividend, the operating income for the divider, namely the net operating profit rate is equal to the operating income divided by the net profit. And f1 means it is the first groups related to the operating net profit rate. The same entity tends to have multiple sets of relational representations, such as price earnings ratio, which can be calculated either by stock prices and earnings per share, or by market capitalization and net profit.

For the total income equals to the summary of operating income, profit and loss from fair value changes, non-business income and investment income, the following four tuples can be expressed:

• < total income, f1_addend, operating income > • < total income, f1_addend, profit and loss from fair value changes > • < total income, f1_addend, non-business income > • < total income, f1_addend, investment income > This section presents the method of constructing domain knowledge graph for quantitative trading using the encyclopedia data and the domain specific data, including the method of term extraction and the method of relation extraction.

Domain specific code generation

In this section, we describe the method and the example of generating code for a specific backtesting platform, including the strategy description parsing and the backtesting platform code generation.

Strategy Description Parsing

The user's strategy description can be parsed based the domain terms in the domain knowledge graph constructed above. The strategy description needs to include the start date and the end date of the backtesting, trading target, and the execution logic of the strategy. A description of the user strategy logic condition needs to be followed by certain priority order rules.

In the following strategy description as an example, the trading target is ticker 000540, if the net operating profit rate is more than 20% and the current stock price is less than 10 yuan, or the moving average of the stock price in 5 days is more than the moving average in 10 days, open (buy); otherwise close (sell). The start date of backtesting is January 1, 2016, and the end date of backtesting is December 31, 2016.

The generated strategy model is illustrated as Fig. 6. In the phase of data initialization, the backtesting start time (20160101), end time (20161231), and trading target (000540) are initialized. And the moving average of the stock price in 5 days, the moving average in 10 days and the net operating profit rate which required for the net profit and operating income (or further the total cost, total income, and operating income) need to be extracted in this phase as well. Then the data will be used in the strategy simulation stage to determine the conditions of strategy by calculation. And in the phase of the strategy simulation, by modeling strategy logic, based on the extracted data in the initialization phase, the target backtesting platform uses historical market data to calculate whether the stock price or other data meets the strategy opening or closing conditions. Between the start date and the end date, the backtesting platform will simulate the trading according to the strategy conditions by calling the logic of the strategy. Then the backtesting platform will generate a report about the strategy performance in the period determined by the start date and the end date by processing the simulated trading record. The report usually includes indicators such as return rate, sharp ratio, etc., which provides a reference for the users to improve the strategy.

Backtesting Platform Code Generation

The section above describes the method to transform the user requirement descriptions of quantitative trading strategies to platform independent model based on the constructed domain knowledge graph for generating backtesting platform strategy code. This section will describe the method of generating strategy code which can be executed by the backtesting platform based on the platform independent model and the platform specific code template.

For specific quantitative trading backtesting platform, code templates are written using the FreeMarker template language defined by the FreeMarker template engine.

The code to specify the trading target, start date, end date of backtesting and extract the data in the initialization phase should be included in the templates. And the templates should also include the code to generate the logic code of the strategy according to the strategy logic model. The platform should also give a comparison table to define the transform relation between the term in domain knowledge graph and the data field name in the platform. The FreeMarker engine is used to generate code that can be executed by a specific quantitative trading backtesting platform, based on the strategy model which is constructed by parsing strategy descriptions. Fig. 7 shows the generated code of data initialization, including the trading target, start date, end date and the moving average of the stock price. Fig. 8 presents the generated strategy code and Fig. 9 gives an example of trading strategy backtesting report generated by a backtesting platform. This section we describe the method and the example of generating code for a specific backtesting platform. And the method of strategy description parsing and the backtesting platform code generation are presented in detail.

Conclusion

The third party backtesting platform providers make it is possible for individual investors to develop quantitative trading strategies without establishing a complete backtesting framework. However, it is difficult for users to migrate the strategy code because of the difference between these platforms. And there is also a huge gap between the description and the code of trading strategy especially for investors without programming skills.

Code generation is usually used to enhance the efficiency of application development. We use code generation related technologies in this paper to generated quantitative strategy code. In previous research, domain knowledge is rarely used in the code generation process. This paper uses the relevant data of open knowledge base and open data as the data source, and constructs a domain knowledge graph in the field of financial analysis to analyze user's strategy description text. Then quantitative trading strategy code in the backtesting platform is generated to reduce the threshold for users to use the backtesting platform. It allows users to focus more on research and development of quantitative trading strategies, while the development of the strategy can be easier migrated among different platforms. This paper has constructed the domain knowledge graph of financial analysis applying in Chinese listed companies. While the construction of knowledge graph depends on the financial statements of listed companies to disclose China criteria, because of different national accounting rules and legal differences, which may not be applied to the process of financial analysis of foreign companies directly.

In the future research, we will apply domain knowledge graph in more fields, such as intelligent agriculture, where knowledge graph could be used for agricultural product tracking.

Fig. 1

 1 Fig.1gives an overview of domain knowledge graph construction framework, while Fig.2gives the framework of strategy code generation based on the domain knowledge graph. The input in knowledge graph construction phase is the Wikipedia and Baidu encyclopedia data as the data source for term extraction and relation extraction, while XBRL (Extensible Business Reporting Language) format report data as the data source for relation extraction, and the output is the domain knowledge graph for quantitative trading, including the domain terms and the relations between domain terms. The input in strategy code generation phase is the strategy description written in natural language following some rules, and the output is the strategy code for a specific quantitative trading backtesting platform which is determined by the code template and the comparison table which is shown in Fig.2.

Fig. 1 .

 1 Fig. 1. Framework of domain knowledge graph construction.

Fig. 2 .

 2 Fig. 2. Framework of strategy code generation.

Fig. 3 .

 3 Fig. 3. An example of financial ratio entry in Wikipedia.

Fig. 4 .

 4 Fig. 4. An example of same as relation in price earnings ratio entry in Wikipedia.

Fig. 5 .

 5 Fig. 5. A part of constructed domain knowledge graph for quantitative trading.

Fig. 6 .

 6 Fig. 6. An example of generated strategy model.

Fig. 7 .

 7 Fig. 7. An example of generated data initialization code.

Fig. 8 .

 8 Fig. 8. An example of generated strategy logic code.

Fig. 9 .

 9 Fig. 9. An example of backtesting platform generated report.

Acknowledgement

This research is supported by Key R&D Project of Zhejiang Province under Grand No.2017C02036.


Behailu Negash

Tomi Westerlund

Pasi Liljeberg

Hannu Tenhunen

Rethinking 'Things' -Fog Layer Interplay in IoT: a Mobile Code Approach

Keywords: Internet of Things, Architecture, Interoperability, Fog computing, Scalability, DoS-IL, Programmability

A client-server architecture style is one of the common approaches enabling separation of concerns in distributed systems. In the Internet of Things architecture, this approach exists in different configuration of sensors, actuators, gateways in the Fog layer and servers in the Cloud. This configuration affects the degree of interoperability, scalability and other functional and non-functional system requirements. In this paper, we reflect on best practices in the web and REST style to address IoT challenges; one of the constraints in REST, Code on Demand, is used for IoT to enhance the flexibility and interoperability of resource constrained clients at the perception layer. Scripts written in a domain specific language,DoS-IL, are organized and stored at the Fog layer for sensor and actuators nodes to request and execute the incoming script. A generic application layer protocol and RESTful server are presented along with experimental results.

Introduction

The growing number of cheaper, smaller and embedded devices connected to the Internet is fueling the development of what is known as the Internet of Things (IoT). IoT is expected to bring billions of devices online enabling a wide range of possibilities for everyday life. This has two main perspectives merged as one: the connectivity of the devices and the application running on top of it. In contrast to the development of the current Internet and the World Wide Web, IoT is developing as one it is creating confusion in naming and its vision [START_REF] Minerva | Towards a definition of the internet of things (IoT)[END_REF]. This paper reflects on previous approaches and techniques used to address the challenges faced during the development of the Internet and the Web to learn from and adapt it for IoT. The World Wide Web is planned to be a virtual space where people can interact and information can be stored [START_REF] Berners-Lee | Www: past, present, and future[END_REF]. This is enabled by the underlying interoperable connectivity provided by the Internet. However, before reaching such level of scale and interoperablity, both the Web and the Internet has passed through competing heterogeneous platforms and protocols. The lack of interoperability is even worse in the Internet of Things; diverse communication protocols, architecture, data format and middleware exist. This limits the level of connectivity possible in IoT, and hence the application running over it are usually vertical silos. To bridge the silos and build a global system, a clear IoT vision is required to move forward.

The IoT vision is still evolving and there are contributions from academia, industry and government institutions [START_REF] Minerva | Towards a definition of the internet of things (IoT)[END_REF]. Singh et al. [START_REF] Singh | A survey of internet-of-things: Future vision, architecture, challenges and services[END_REF] summarize the IoT vision in three parts; the Internet vision, Things vision and Semantic vision. In general, an IoT vision can be put as smart objects capable of sharing meaningful information over the Internet. This is inline to the vision of the Web, to be shared information space for machines and people [START_REF] Berners-Lee | Www: past, present, and future[END_REF]. The main contribution of this paper is towards the realization of this vision via the extended architecture and tools discussed here. We start with a general discussion of the nature of the web as the largest distributed system and learn from it. Distributed systems is a general name used to refer to systems that run in multiple separate boundaries, physical or logical, and communicate to accomplish their task. Part of these systems naturally demand for physical separation of its components on to multiple devices -the Web and IoT are typical ones; a server component provides service for a client connected through the Internet. The role of the server in formatting (HTML), and locating (URL) the information requested, and the standard of the communication (HTTP) are the driving reasons for the success of the Web.

An architectural enhancement to the original design of the web came through REST (Representational State Transfer) architecture style [START_REF] Fielding | Architectural Styles and the Design of Network-based Software Architectures[END_REF]. One of the optional constraints put in this style is the code on demand (COD) approach. COD is the process of sending a code for a client to execute, which is a specific case of mobile code pattern [START_REF] Fuggetta | Understanding code mobility[END_REF]. In this paper, we explore mobile code style for the Internet of Things through a semantically organized set of scripts and a novel server in the Fog layer to enable interoperability and enhance the scaling of IoT towards its vision. Devices embedded in physical objects send requests to the server in the Fog layer for instructions on how to present their sensor data or alter built-in actuators. An IoT-lite ontology [START_REF] Bermudez-Edo | Iot-lite: A lightweight semantic model for the internet of things[END_REF] is used to annotate the devices in our experiment and DoS-IL (Domain Specific IoT Language) [START_REF] Negash | Dos-il: A domain specific internet of things language for resource constrained devices[END_REF], an IoT domain specific language is used for the scripts. In summary, the main contributions of this paper are:

-Semantically organized domain specific scripts -An abstract application layer protocol for communication -REST like uniform interface and a service bundled together The rest of the paper is organized in the following manner. Section 2 present the challenges in the Internet of Things, a motivation for this work and state of the art in this area, followed by details of the main work of the paper in Section 3. The results of the implementation and evaluation of the performance are reported in Section 4. The final section concludes the paper with the summary of results and discussion of planned continuation of the work.

This research aims to address some of the challenges facing the IoT, such as reconfiguration, interoperability and scalability. To clarify on these difficulties and motivate the work, we consider a simplified IoT use case in a remote patient monitoring in a smart home system and highlight the integration challenges and proposed potential solutions for such systems. There exist multiple challenges to reach an Internet scale and interplay with the state of the art method. Most IoT systems exist as vertical silos forming boundaries of device architecture, programming approach, network protocol and data formats among others. Each application works independently and is connected to the Internet allowing users to interact remotely. The majority of these devices are battery powered, has small memory and limited processing power. Moreover, the network interface associated usually has lower bandwidth and follow different protocols. Looking at the 'things' vision of IoT [START_REF] Singh | A survey of internet-of-things: Future vision, architecture, challenges and services[END_REF], one expects to have a seamless integration across these boundaries with proper authentication. Similarly, the 'Internet' vision promises to deliver an Internet scale system of smart systems. Some of the challenges, such as scale and heterogeneity, hindering the realization of this vision are presented by Zorzi et al. [START_REF] Zorzi | From today's intranet of things to a future internet of things: a wireless-and mobility-related view[END_REF] along with a proposed solution from protocol perspective. Another work presented in [START_REF] Li | A sdn-based architecture for horizontal internet of things services[END_REF] shows a horizontal architecture for IoT to help manage the challenge of interoperability and ease of programmability using a software defined networking scheme. At the highest level of abstraction of the systems, the data format and semantic knowledge of the exchanged information has to match for the systems to interoperate. Moreover, the architecture of the systems is a key component for integration. There has been many contributions from industry, academia and public projects to close the gap and hide the heterogeneity. An open survey shows some of these challenges and solutions [START_REF]IoT developer suvey[END_REF]. One of the proposed solutions is IoT-A [START_REF]Internet of things -architecture, IoT-A[END_REF] -a project aimed to address these challenges with a reference architecture. Another approach is using middleware to bridge the gap in such systems. Razzaque et al. [START_REF] Razzaque | Middleware for internet of things: A survey[END_REF] present a survey of some of the middleware proposals. In the following sections, we highlight our approach in addressing this challenges and present the experimental results obtained.

Enabling code on demand

The introduction of Representational State Transfer (REST) as an architectural style in the web simplified the development and consumption of services in distributed systems across the globe. One of the constraints in REST in the area of mobile code architecture style is Code on demand (COD) [START_REF] Fielding | Architectural Styles and the Design of Network-based Software Architectures[END_REF]. It enables a client node to extend its feature through an executable code sent from the server. Code on Demand is one of the ways code mobility is achieved. Fuggetta et al. [START_REF] Fuggetta | Understanding code mobility[END_REF] discuss some of the benefits and uses of mobile code. Our approach resembles the case of remote device control and configuration in [START_REF] Fuggetta | Understanding code mobility[END_REF], where we allow the reconfiguration of devices in the perception layer with DoS-IL [START_REF] Negash | Dos-il: A domain specific internet of things language for resource constrained devices[END_REF]. A script stored in the gateways at the Fog layer will be sent to a device on demand to be executed. The result of the execution is also transferred to the gateway via a generic application layer protocol running over heterogeneous network interfaces. To allow this, the overall architecture of the system and its details are discussed in the following subsections.

System architecture

Architecture plays a critical role in achieving the desired functional and nonfunctional requirements of a system. Currently there are two main approaches of connecting devices to a gateway, regardless of the communication protocol: writing the program to read sensors, format, process and send it, or make a service to listen and handle incoming requests. This is similar to push and pull form of communication. In both cases, the node is rich in feature, it has the resources needed as well as the know how to manage it. The role of the gateway in the Fog layer is to provide connectivity and handle incoming or pulled data from the perception layer. In these approaches, maintenance of the application becomes a challenge after deployment. Moreover, the approaches are not scalable to the Internet level as in the case of the Web. For the second case, the nodes are usually resource constrained (processing power, battery or memory) to run a service that is available at anytime. Our approach is different in that the nodes at the perception layer still contain the resources (sensors, actuators or tags), but lack the know how which is the main point of functional or non-functional changes. This know how is written and stored in the Fog layer and sent to the node on a GET request. Figure 1 shows a generic three tier deployment architecture of an IoT system and the different components mapped on it.

Script organization

The scripts that are stored in the server are written using a domain specific language called DoS-IL. Each one of these scripts has a name and address that is resolved from the domain knowledge represented via an extended annotation Fig. 2. IoT-lite ontology modified for the server using IoT-lite ontology [START_REF] Bermudez-Edo | Iot-lite: A lightweight semantic model for the internet of things[END_REF] as shown in Figure 2 . Devices have unique names that gets resolved into a URL of the location of the script using a sparql query from the ontology. The ontology is formatted in RDF (Resource Description Format) and stored in the gateway representing part of the Fog layer. This enables easy replication and merging of the ontology in other gateways when necessary. To parse and query the ontology, rdflib -a python library is used for sparql parsing.

In a hierarchical Fog architecture, as proposed by the OpenFog consortium [START_REF]OpenFog Reference Architecture for Fog Computing[END_REF], the segments of the ontology can easily be replicated to multiple nodes for easy scaling of the system. This will be part of our future extension of this work towards demonstrating our proposal over distributed hierarchical gateways.

Generic Application layer

One of the components that contributed to the success of the World Wide Web, besides the addressing means and the markup language, is Hypertext Transfer Protocol (HTTP). As an application layer protocol, it runs over the standard TCP/IP protocol. However, in Internet of Things, the majority of the devices, especially those in the perception layer, use various low power communication protocols. Our semantic server is designed to handle incoming requests encoded with this generic application protocol over heterogeneous network standards.

An abstract class representing network interfaces is defined, which needs to be implemented for each supported network protocol. Request and response headers are only few bytes to work with networks of low bandwidth. The request header is two bytes long and it is organized as follow: first four bits indicate the version number, followed by two bits for the verb of the request (REST verbs), one bit to show what type of script format the client accepts and one status bit for notification of script changes. The second byte is for payload size, which is set to 0 for GET requests. In case of the response, the response code takes the first byte followed by the remaining packets in the message and the checksum -a total of three bytes. The response codes and the header formats are shown in detail in the source code repository [START_REF] Negash | ISSS implementation[END_REF].

IoT Semantic Script Server

A uniform interface is defined for the communication channel between the clients and the IoT Semantic Script Server (ISSS). Like a RESTful service, a GET request is used for the request of the configuration script while POST is used to send the data from the device for processing at the gateway. The method (GET or POST) is specified in the request header of the generic application layer protocol. Depending on the header, a specific request handler is passed the request to process it. Whenever a GET request is received, the request handler resolves the requested name from the IoT-lite ontology to a proper script location and fragment the script based on the available bandwidth. This server instantiates and listens to all the available network interfaces through the concrete implementations of the abstract class. Regardless of the underlying network protocol, the function of the server and the application layer protocol remains the same. The details of the implementation of our server and its components are shown in more details in the following section.

Demonstration and Evaluation

To validate our proposal beyond a conceptual point, we have developed a simplified scenario using our python based server implementation. Figure 3 shows the setup of our demonstrator system. As shown in Figure 3, the left side, Arduino Mega, is the client node representing the perception layer. The server, Intel Galileo Gen2, is shown in the right hand side running a Linux distribution running on SD card provided with the board. The source code of the server implementation is also available online [START_REF] Negash | ISSS implementation[END_REF]. To evaluate the performance of our service, the following parameters are used to measure the communication and computing overhead for 100 iterations. First, the round trip time of a simple message is recorded, shown in blue as round trip reference in Fig. 4. Then, we measured both the time taken to send as well as the total time taken to request and receive a script of size 527 bytes (shown in gray and red in Fig. 4). In summary, the total additional time of sending the script compared to the reference value (average of 73 ms) grow approximately six times to an average of 429 ms subject to the experimental setup. A second script is also tested and shown in yellow. Furthermore, Listing 1.1 shows how the script is fragmented and the response header; 100 for continue followed by the remaining packets, the checksum and part of the script. The time required to resolve name to url at the gateway is also analyzed. It takes longer on the first time of parsing the rdf (almost 238 ms) and subsequent calls take only few milliseconds (42 ms).

Conclusion and Future works

With the ever increasing number of network protocols, platforms and data formats used in the Internet of Things, the vision of realizing an integrated IoT system is getting difficult. This work refers back to the beginning of the World Wide Web to learn ways of overcoming heterogeneity and reach an Internet level of scaling. We implemented an IoT Semantic Script Server listening over a generic application protocol and organized it using a lightweight IoT ontology. An implementation of the generic network interface for nRF24L01 based network is developed and performance evaluation is carried out. The evaluation shows the fragmentation of the script for sending over a low bandwidth network, the round trip time and the performance of the process of resolving a device name to a script path. The initial version of the application layer protocol is also very light and optimized for code on demand approach. In summary, this paper introduced a novel architecture for IoT, with the help of a domain specific language, that enables both semantic and syntactic interoperability and facilitate the growth of IoT to an Internet scale. To further extend this work, we plan to make the service implementation to listen to multiple network interfaces and work with distributed script locations over multiple Fog gateways. Furthermore, we believe that inclusion of standards from some of the big consortium make our efforts comprehensive in pushing forward the integration effort of IoT. One of this standards considered for future works is the data format standard from the open interconnect consortium.

Fig. 1 .

 1 Fig. 1. High level deployment architecture of the proposed system

Fig. 3 .Fig. 4 .

 34 Fig. 3. Simplified demonstrator implementation


Yi Liu

Xin -2147-389x]

Li

Jianxin Wang
email: wangjx@bjfu.edu.cn

Feng Chen
email: chenfeng@cfda.gov.cn.

Junyu Wang
email: junyuwang@fudan.edu.cn

Yiwei Shi

Lirong Zheng

Pattern discovery from big data of food sampling inspections based on extreme learning machine

Keywords: food sampling inspection, big data, extreme learning machine, Logistic regression

Food sampling programs are implemented from time to time in local areas or throughout the country in order to guarantee food safety and to improve food quality. The hidden patterns in the accumulated huge amount of data and their potential values are worthy to research. In this paper, Extreme learning machine (ELM) is employed on real data sets collected from the food safety inspections of China in recent two years, in order to mine the relationship between food quality and food category, manufacturing site and season, inspection site and season, and many other attributes. Experimental results indicate that the ELM approach has better prediction precision and generalization ability than Logistic regression that was adopted in preceding work. The patterns obtained are helpful for making more effective food sampling plans and for more targeted food safety tracing.

Introduction

Food safety issues have aroused world-wide attention since it is closely related to public and household health and interests [START_REF] Ma | Research of food safety risk assessment methods based on big data[END_REF]. Most countries have implemented systems for food safety supervision and inspection, in order to reduce the quantity, strength, and impact of food safety incidents, and to improve the quality of food finally delivered to the end users [START_REF] Antunovic | Background to the preparation of the Croatian food safety strategy[END_REF]. However, food quality testing and food safety inspections are time-consuming, labor-intensive tasks, and they could sometimes be a heavy financial burden. Therefore, much research work has been done in order to improve inspection efficiency and effectiveness without increasing inspection quantity and strength, or even with reduced quantity and strength of food safety inspections [START_REF] Ma | Research of food safety risk assessment methods based on big data[END_REF][START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF]. In China, many food safety incidents have occurred in recent years [START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF]. To deal with these problems, China government has taken a lot of measures to guarantee food safety and quality, and all levels of food testing laboratories in China carry out every day a great deal of testing work. As a result, a large amount of food testing data is accordingly recorded and collected, and as a matter of fact, after years of accumulation, a huge data warehouse has come into being with rich information about food quality and safety and with many other properties. Initially, these accumulated data were only a matter of recording, and gradually they were utilized for inquiry and statistical purposes. The accumulated data, however, were found to be much more valuable than that [START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF], since the obtained patterns or rules underlying the data did provide us useful and helpful knowledge about the relationship among the attributes, which are able to help us make more effective and powerful inspection plans to expose more food safety problems, and hence to reduce consumption of time, labor, and financial burden.

Nevertheless, with the size of the data growing steadily in the course of food production, processing distribution and trading, the huge amount of data cannot be handled by conventional computing methods, which are by and by replaced by the technology of big data [START_REF] Li | Research of food safety event detection based on multiple data sources[END_REF]. After the technologies of cloud computing and internet of things, big data technologies are another profound revolution that have penetrated into a variety of areas and given rise to dramatic changes in these areas. Big data is an abstract concept, with the characteristics of great quantity, rich variety, semistructured and unstructured data, fast-growing, and that the traditional database management software cannot process it pragmatically with single-node computing resource. Consequently, distributed computing is the core method and key means in the bunch of big data technologies. Reference [START_REF] Sonka | Big data and the ag sector: More than lots of numbers[END_REF] examined the potential for big data application in the agriculture sector, including the variety and velocity characteristics in the sector and the integration of data and analysis that will be needed for successful implementation.

With the big data of food safety inspections accumulated, managed, preprocessed and analyzed, a variety of applications could be implemented, including dynamic and comprehensive food safety analysis, foodborne disease study, early warning and assessment of food safety, and so on. Fulfillments of these applications are helpful for boosting food quality level and improving food safety tracking. In order to implement these applications, however, a bunch of approaches are needed such as data preprocessing, statistical analysis, machine learning, and data mining [START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF][START_REF] Khosa | Defect detection in food ingredients using multilayer perceptron neural network[END_REF][START_REF] Khosa | Artificial neural network classifier for quality inspection of nuts[END_REF].

Before applying methods mentioned above, complex processes should be taken for data preparation, including data cleaning, data normalization, and missing data imputation. In most cases, the phenomenon of missing data is inevitable in a real data set, and therefore missing value imputation is an essential preprocessing step in data mining and machine learning. The imputation methods of kNNI [START_REF] Kung | An optimal -nearest neighbor for density estimation[END_REF] in recent years have been widely applied because of its easy operating. The result and hence the accuracy of kNNI, however, are dependent of the parameter k, which means that each k should be tried in order to get an optimal one. Moreover, the result of kNNI is a biased estimation since the neighbors of the targeted point with missing value may lie unevenly around the point. Two variations [START_REF] Zhang | Shell-neighbor method and its application in missing data imputation[END_REF], [START_REF] Wang | Imputation missing values with distance-and density-weighted and quadrant-based nearest neighbors[END_REF] of kNNI were proposed to overcome the defects of previous versions and they both perform satisfactory. Only after the preprocessing step, are the data sets of food safety inspections ready for further analyzing and mining.

The rest of the paper is organized as follows. Section 2 introduces research work related to this paper, including those on missing data imputation, Logistic regression, neural network, and extreme learning machine. In Section 3, the ELM framework is described in detail that is employed to mine the patterns hidden in the big data of food safety inspections. Section 4 presents the experiments on real data sets and the corresponding results. And Section 5 concludes the paper.

Related work

A variety of methods and technologies have been studied, tested and/or implemented to analyze and utilize the data collected from food safety inspections, and many exciting results and conclusions have been obtained. Khosa and Pasero [START_REF] Khosa | Defect detection in food ingredients using multilayer perceptron neural network[END_REF], [START_REF] Khosa | Artificial neural network classifier for quality inspection of nuts[END_REF] used an artificial neural network (ANN) as a classifier to predict at an early stage of processing or manufacturing whether important food ingredients, pine and pistachio nuts, are healthy. X-ray images of the nuts were used, and texture features were extracted from the images. In that work, the texture features and the sample labels were used as the training data, and the texture features were independently used as the basis for making predictions and classifications. As a result, the ANN classifier achieved false negative rates of 0% and 6.8% for the pine nuts and pistachio nuts, respectively. The results imply that food quality has good predictability and good describability, at least in certain cases.

Reference [START_REF] Ma | Research of food safety risk assessment methods based on big data[END_REF] focused on a safety risk assessment of dairy products for a single corporation, also in the background of big data. That work used a classic classifier, the support vector machine (SVM). However, instead of using a serial algorithm for the SVM, a parallel cascade SVM was implemented on the platform of Apache Hadoop [START_REF] Singh | A survey on platforms for big data analytics[END_REF], which is an open-source distributed computing framework that is typically used to process big data by distributing the data in a large-scale cluster platform. The results from [START_REF] Ma | Research of food safety risk assessment methods based on big data[END_REF] demonstrate that when the number of cluster nodes increases steadily, the saved run time decreases steadily compared with the runtime for a single node. The SVM has been a successful classifier in many cases and in many areas due to its good classification accuracy, generalizability and stability. Despite this success, SVM does not perform satisfactorily when the positive and negative samples have more detailed relationships.

Statistical methods are most frequently used to analyze the data obtained from food safety inspections, with [START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF] being a typical study. Based on the food sampling results of the city of Shenzhen, China, that study first investigated the annual and interannual changing tendency of 11 food categories and analyzed the data using the t-test. Then, a logistic regression model was constructed, and the quantitative relationships between food quality and four attributes (namely, food origin, inspection season, sales site, and food packaging) were established. Instead of the result category (qualified/unqualified), the concept of "exceeded percentage" was used to measure the degree of unqualified food. Logistic regression is a powerful classifier that can be applied to both continuous and discrete variables. Although that work is a good application of logistic regression to predict which food products are most likely to be unqual-ified, the data for both training and testing are simulated data sets, not real data sets, which indicates that the work remains unsatisfactory.

Logistic regression, like many other regression methods, is essentially linear regression; it is aided by some nonlinear transformations, and it can capture the nonlinear relationships between the dependent variable and causative (independent) variables. The ANNs in [START_REF] Ma | Research of food safety risk assessment methods based on big data[END_REF], [START_REF] Khosa | Artificial neural network classifier for quality inspection of nuts[END_REF] used a considerable number of nonlinear transformations to capture more detailed relationships. However, as demonstrated earlier, the learning speed of feed-forward ANNs is considerably slower than that of regression learning algorithms, which take the least squares method (LSM) as the core technique. Considering both the speed advantage of the LSM and the nonlinearity advantage of the ANN, Huang et al. proposed the ELM with a single layer of hidden nodes in their two pioneering works [START_REF] Huang | Universal approximation using incremental constructive feedforward networks with random hidden nodes[END_REF], [START_REF] Huang | Extreme learning machine: Theory and applications[END_REF]. Compared with its predecessor learning techniques, the ELM improves the training speed by hundreds of times by randomly setting the weights between the input nodes and hidden nodes and by computing the weights between the hidden nodes and output nodes using the LSM. Other researchers have supported their work, particularly the random assignment of weights, by mathematical proofs, such as in [START_REF] Cervellera | Low-discrepancy points for deterministic assignment of hidden weights in extreme learning machines[END_REF], which provides a geometric perspective.

After these pioneering studies, a variety of variations and improvements in the ELM were presented. Reference [START_REF] Li | Inverse-free extreme learning machine with optimal information updating[END_REF] proposed an inverse-free ELM that further improved the computational speed of the training process, as computing the inverse of a square matrix is the most time-consuming part of the LSM. Accounting for the architecture of the sub-network nodes, Y. Yang and Q. M. Jonathan Wu designed a variation of the ELM, ML-ELM, that exhibits competitive accuracy and speed compared with other conventional feature learning methods with sub-network nodes [START_REF] Yang | Extreme learning machine with subnetwork hidden nodes for regression and classification[END_REF], [START_REF] Yang | Multilayer extreme learning machine with subnetwork nodes for representation learning[END_REF].

The ELM has a notable defect, namely, that the number of hidden nodes must be manually assigned or assigned by other state-of-the-art methods. In fact, the optimal number of hidden nodes plays a decisive role in the ELM, as an insufficient number of hidden nodes could lead to underfitting, whereas an excessive number of hidden nodes could cause overfitting. Based on this observation, [START_REF] Mesquita | Pruning extreme learning machines using the successive projections algorithm[END_REF] presented an adaptive and automatic selection algorithm that can obtain a suitable or even an optimal number of hidden nodes for each learning case. This method can markedly reduce the degree of artificial participation and hence reduce the burden of human operators.

In addition, there are many applications of the ELM to different types of domains. The ELM was applied to predict soil moisture in an apple orchard [START_REF] Liu | Prediction of soil moisture based on extreme learning machine for an apple orchard[END_REF], taking both the weather factors and the time series of the soil moisture as inputs. Compared to the conventional method of the SVM, the ELM exhibits a higher prediction accuracy over a larger forecast range with a higher speed. Reference [START_REF] Zheng | Spectroscopy-based food classification with extreme learning machine[END_REF] proposed a new classification algorithm for food classification based on both spectroscopy and the ELM, and the experimental results indicated that the ELM is typically more precise and robust than its competitors, including k-nearest neighbor, partial least-squares discriminant analysis, back propagation ANNs, and least-squares support SVMs.

ELM approach specification

In this section, we will present in detail the ELM-based classifier for predicting whether a sample food to be inspected is qualified or not. Firstly, in sub-section 3.1, the cause variables are selected according to whether it is likely to affect the food quality. And then data preprocessing techniques are presented in sub-section 3.2.

After that in Sub-section 3.3, the main framework of the ELM method is described based on the discussion of the former two sub-sections.

Selecting relevant factors

According to the food safety inspection data, the result variable that we are most interested in is quite simple: it has binary values for whether the food is qualified or not. However, the causative variables are more complex and involve many factors. We eliminate the factors that are not related to the ability to predict the food quality, such as the sampling number and name of the manufacturer. After the elimination operation, 9 causative variables are retained, as listed in Table I.

Table 1. Causative (Dependent) Variables Selected for the Model*.

SELECTED FACTOR / VARIABLE Meaning of the variable

Food category There are 6 categories* in the inspection data Manufacturing date

The date when the product was manufactured Manufacturing site

The place where the product was manufactured Inspection date

The date when the product was sampled and inspected Inspection site

The place where the product was sampled and inspected * The 6 categories are T0, dairy products; T1, aquatic products; T2, infant formula; T3, meat products; T4, liquor; T5: edible oil.

Preprocessing technique

When all the factor variables are determined, the data are processed to eliminate the noise data. The missing values are completed with the imputation techniques proposed in [START_REF] Wang | Imputation missing values with distance-and density-weighted and quadrant-based nearest neighbors[END_REF] while considering the representative point and the densities of the points in each quadrant compared to the targeted point for the missing values. New causative variables can be generated based on the variables listed in Table I. For example, from the manufacturing date and inspection date, a new variable, the elapsed days, can be generated; this variable refers to the time span between the manufacturing time and inspection time. Another example is "Whether in the same province", which is generated from the two variables "Manufacturing site" and "Inspection site"; this variable indicates whether the two sites are in the same province or not.

To date, certain variables have not yet been useful for the models of either logistic regression or ELM, as they are category variables, not numeric variables. For exam-ple, the manufacturing date appears to be a numeric variable, but in fact, it is more likely to be a categorical variable because it implies the seasonal information of the manufacturing time. Thus, we transform the variable "Manufacturing date" into four variables, namely, "Spring", "Summer", "Autumn" and "Winter", with each having binary values of true or false. The four new variables are called dummy variables, and they are generated in the same manner as described in [START_REF] Changpetch | Model selection for poisson regression via association rules analysis[END_REF].

After the preprocessing stage, the data are ready for training, testing, and predicting using both the ELM method and its competitors.

Framework of ELM method

In this paper, we also use one-hidden-layered nodes, as shown in [START_REF] Mesquita | Pruning extreme learning machines using the successive projections algorithm[END_REF]- [START_REF] Zheng | Spectroscopy-based food classification with extreme learning machine[END_REF]. The structure of the network is illustrated in Fig. 1.

Input Random Weights

Learned Weights Output Fig. 1. Structure of the ELM. There is only one hidden layer and only one output node.

Each input node in Fig. 1 represents a causative variable. The causative variables selected and the variables generated by them are each represented by an input node. There are considerably more hidden nodes than input nodes; but it is not a fixed number. Instead, it varies according to the number of inputs and the structure of the training data based on the adaptive strategy given in [START_REF] Mesquita | Pruning extreme learning machines using the successive projections algorithm[END_REF]. As described in [START_REF] Huang | Extreme learning machine: Theory and applications[END_REF], the weights between the input nodes and the hidden nodes are set to random values (see Fig. 1), which implies that the output value of one hidden nodes may be proportional (or nearly proportional) to that of another hidden node. Therefore, at least one of them is useless to capture the relationship between the input and the output. The optimization algorithm in [START_REF] Mesquita | Pruning extreme learning machines using the successive projections algorithm[END_REF] first generates a large number of hidden nodes and then selects the nodes one by one, making the newly selected one least linear-correlated to the previously selected node. By taking into account the input data and the output data an optional number of hidden nodes can be obtained. We employ this optimization method to form the structure of ELM. The single output node represents the result of a record, which means whether a food sample is qualified.

The weights between the input nodes and hidden nodes are assigned randomly as described in [START_REF] Huang | Universal approximation using incremental constructive feedforward networks with random hidden nodes[END_REF], [START_REF] Huang | Extreme learning machine: Theory and applications[END_REF], and they are all set to be in the range [-1, 1]. However, all weights between the hidden nodes and output node are obtained by learning and computing based on the training data.

Suppose that the number of input nodes is n and the number of hidden nodes is h, the input of the jth hidden node is calculated as follows:

   n i j i j w G 1 ,  (1)
where β is a parameter that will be discussed later, j i w , is the weight between the ith input node and the jth hidden node.

Each hidden node processes its input by the following equation and then outputs the following:

(2)

Hi will always lie between -1 and 1, which makes its value distribution approximately symmetric about the y-axis. Equation ( 2) is often called the activation function, which is a highly nonlinear function. All activation functions in the hidden nodes together make the system capable of approximating nearly any nonlinear relationship between the input nodes and output node.

Parameter β in Equation (1) will affect the effectiveness of the system. If β is not sufficiently large, the relationship between the input and output will degenerate to a linear relationship. However, if β is excessively large, all the inputs of the hidden nodes will be transformed by the activation function into either -1 or 1. Thus, we set parameter β in this paper according to the following empirical formula:

n 10   (3)
where n is the number of input nodes.

In the step of the LSM for calculating the weights between the hidden nodes and output node, the inverse of a square matrix must be computed, which will not be executable if the matrix is irreversible. If this problem occurs, we will change the square matrix slightly and make it reversible by using the method suggested in [START_REF] Li | An extreme learning machine based on ridge regression for regression[END_REF], which overcomes a significant shortcoming of the ELM.

The overall framework of the ELM approach is shown in Fig. 2.

1 1 2     i G i

Experiments and results

The data sets used are publicly available from the State Food and Drug Administration of China. For these samples, the manufacturing date ranges from November 26, 2014 to September 1, 2016, whereas the inspection date ranges from October 29, 2015 to September 9, 2016.

The two methods applied to the data sets are logistic regression presented in [START_REF] He | The method of food safety sampling inspection based on dynamic weight[END_REF] and the ELM. The variable selection and data preprocessing are same for the two methods. For each category of food, all data are partitioned into training data and testing data. The training set and testing set are identical for the two methods. The testing results are listed in Table II. The data listed in Table II are shown in Fig. 3. Fig. 3 shows that the ELM has better accuracy than logistic regression for all food categories, although they perform nearly the same for certain categories, such as T4.

CONCLUSIONS

ELM is employed in this paper to describe the big data collected from the food safety inspections of China in recent two years. The trained model is used to predict the food quality and it performs better than Logistic regression that was implemented and tested on simulated data sets. Results from a series of experiments show that ELM is better in accuracy than Logistic regression for each of the 6 food categories. And both of the methods run very fast because they all take the advantage of optimized calculating steps. The success of the ELM owes much to the large number of hidden nodes and the nonlinear activation functions in them are able to capture the nonlinear components in the relationship between the inputs and the outputs. With the ELM model and the according prediction system, food samples can be taken no longer randomly; on the contrary, food products could be filtered by the prediction system and only those with least qualification probabilities will be selected for sampling test. Therefore, aided by the ELM prediction and classification system, more effective inspection plans can be made which mean less labor input and more food safety problems exposed.

Fig. 2 .

 2 Fig. 2. Overall framework of the ELM approach.

Fig. 3 .

 3 Fig. 3. Comparison of the experimental results from logistic regression and the ELM. The black bar represents the accuracy percentage of the logistic regression, whereas the white bar represents that of the ELM.

Table 2 .

 2 Comparison of Experimental Results.

	CATEGORY	Number	Number	Number	Accuracy	Accuracy
		of testing	of correct	of correct	of LR (%)	of ELM (%)
		cases	cases for	cases for
			LR	ELM
	T0	1376	1196	1212	86.9	88.1
	T1	873	777	791	89.0	90.6
	T2	1403	1260	1310	89.8	93.4
	T3	4058	3633	3656	89.5	90.1
	T4	2730	2615	2618	95.8	95.9
	T5	2063	1785	1798	86.5	87.2

ACKNOWLEDGMENTS

This work was supported by the National Science & Technology Pillar Program of China (2015BAK36B01), the National Natural Science Foundation of China (61402436), Shanghai Engineering Research Center of Product Traceability.