WO2019196278A1 - 天气数据获取方法及装置、计算机装置及可读存储介质 - Google Patents

天气数据获取方法及装置、计算机装置及可读存储介质 Download PDF

Info

Publication number
WO2019196278A1
WO2019196278A1 PCT/CN2018/099549 CN2018099549W WO2019196278A1 WO 2019196278 A1 WO2019196278 A1 WO 2019196278A1 CN 2018099549 W CN2018099549 W CN 2018099549W WO 2019196278 A1 WO2019196278 A1 WO 2019196278A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
weather data
weather
value
elasticnet
Prior art date
Application number
PCT/CN2018/099549
Other languages
English (en)
French (fr)
Inventor
阮晓雯
徐亮
肖京
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019196278A1 publication Critical patent/WO2019196278A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01WMETEOROLOGY
    • G01W1/00Meteorology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/18Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01WMETEOROLOGY
    • G01W1/00Meteorology
    • G01W2001/006Main server receiving weather information from several sub-stations

Definitions

  • the present application relates to the field of data processing technologies, and in particular, to a weather data acquisition method and apparatus, a computer apparatus, and a readable storage medium.
  • the traditional weather data capture is only the process of obtaining weather data from the network, and the process of judging and processing the specific content of the weather data is lacking, so the data obtained is not ideal.
  • a first aspect of the present application provides a weather data acquisition method, the method comprising:
  • the regression fitting is performed using the ElasticNet algorithm to fill the outliers of the rejection.
  • a second aspect of the present application provides a weather data acquiring apparatus, the apparatus comprising:
  • a crawling unit for capturing weather data from a webpage
  • a parsing unit configured to parse missing values in the weather data
  • a first padding unit for performing regression fitting using an ElasticNet algorithm to fill the missing value
  • a detecting unit configured to detect an outlier in the weather data by using a Moving-zscore algorithm, and reject the outlier
  • the second padding unit is configured to perform regression fitting by using the ElasticNet algorithm to fill the abnormal value of the culling.
  • a third aspect of the present application provides a computer apparatus comprising a memory and a processor, the memory storing at least one computer readable instruction, the processor executing the at least one computer readable instruction to implement The method of obtaining weather data.
  • a fourth aspect of the present application provides a non-volatile readable storage medium having stored thereon at least one computer readable instruction, wherein the at least one computer readable instruction
  • the weather data acquisition method is implemented when executed by a processor.
  • the present application extracts weather data from a webpage; parses missing values in the weather data; performs regression fitting using the ElasticNet algorithm to fill the missing values; and uses the Moving-zscore algorithm to detect outliers in the weather data, and rejects The abnormal value; the regression fitting is performed by using the ElasticNet algorithm, and the abnormal value of the culling is filled.
  • the present application can obtain weather data with high reliability and high accuracy.
  • FIG. 1 is a schematic diagram of an application environment of a weather data acquisition method of the present application.
  • FIG. 2 is a flow chart of a preferred embodiment of a weather data acquisition method of the present application.
  • Figure 3 is a detailed flow chart of step 201 of Figure 2.
  • FIG. 4 is a structural diagram of a preferred embodiment of a weather data acquisition device of the present application.
  • FIG. 5 is a detailed structural view of the gripping unit of Figure 4.
  • FIG. 6 is a schematic diagram of a preferred embodiment of a computer device of the present application.
  • the weather data acquisition method of the present application is applied to one or more computer devices.
  • the computer device is a device capable of automatically performing numerical calculation and/or information processing according to an instruction set or stored in advance, and the hardware thereof includes but is not limited to a microprocessor and an application specific integrated circuit (ASIC). , Field-Programmable Gate Array (FPGA), Digital Signal Processor (DSP), embedded devices, etc.
  • ASIC application specific integrated circuit
  • FPGA Field-Programmable Gate Array
  • DSP Digital Signal Processor
  • embedded devices etc.
  • FIG. 1 is a schematic diagram of an application environment of a weather data acquisition method of the present application.
  • the weather data acquisition method is applied to a computer device 1 .
  • the computer device 1 is communicably connected to a web server 3 via a network 2, and the web server 3 is connected to a webpage library 4, and the webpage library 4 is connected. Store multiple web pages.
  • the computer device 1 captures weather data on the webpage in the webpage library 4 through the web server 3, and fills and corrects the captured weather data to obtain weather data with high reliability and high accuracy.
  • FIG. 2 is a flow chart of a preferred embodiment of a weather data acquisition method of the present application.
  • the weather data acquisition method specifically includes the following steps:
  • Step 201 Grab weather data from a webpage.
  • the weather data is time series data.
  • the weather data may include real-time weather data, forecasted weather data, and historical weather data.
  • the weather data may include humidity, temperature, air pressure, precipitation, water vapor pressure, wind speed, wind direction, and sunshine hours.
  • the weather data may include daily average temperature, average air pressure, maximum temperature, minimum temperature, average relative humidity, minimum relative humidity, precipitation, average wind speed, sunshine hours, and average water vapor pressure.
  • the weather data can be captured from weather information websites (such as China Weather Network, Sina Weather, Sohu Weather, etc.) to improve the reliability of the weather data. It can be understood that the weather data can be captured from any webpage.
  • weather information websites such as China Weather Network, Sina Weather, Sohu Weather, etc.
  • Weather data for a predetermined area can be captured.
  • the predetermined area may include a province, a city, a region, and the like. For example, grab weather data from Shenzhen.
  • the predetermined time may include a year, a month, a day, and the like. For example, grab daily weather data for January-February 2018.
  • the weather data can be captured by a web crawler.
  • a web crawler is an application that automatically extracts the content of web page data. Web crawlers usually start with a URL (also called a seed URL) of one or several initial web pages, obtain the URL of the initial web page, and fetch the web page according to specific algorithms and strategies (such as depth-first search strategy). In the process, the new URL is continuously extracted from the current web page and placed in the corresponding queue until the stop condition is satisfied.
  • the URL is an abbreviation of Uniform Resource Locator, which is a uniform resource locator.
  • the weather data can be captured by using an open API interface of the weather information website (for example, an API interface opened by the China Weather Network).
  • the API is an abbreviation of application interface, which can realize mutual communication between computer software through an API interface.
  • the open API interface of the weather information website can return data in JSON format or XML format.
  • the weather data can be captured by a web crawler using an open API interface of the weather information website. See Figure 3 for the specific process of crawling the weather data through the web crawler using the open API interface of the weather information website.
  • FIG. 3 is a detailed flow chart of step 201 of Figure 2. Referring to FIG. 3, the following steps may be specifically included:
  • Step 301 Generate a seed URL for the API interface of the weather information website and a subsequent URL.
  • the seed URL is the basis and premise for the web crawler to do everything.
  • the seed URL can be one or more.
  • the structural characteristics of the URL of the weather information website can be analyzed, and the subsequent URLs are obtained according to the structural characteristics of the URL. For example, when the weather data of different areas is captured, the location information of the URL corresponding to the different areas is different, and the location information in the URL is modified to obtain the subsequent URL (ie, the URL corresponding to another area). .
  • Step 302 Send an HTTP request to an API interface of the weather information website, requesting access to the API interface.
  • the HTTP request can be sent to the API interface of the weather information website in GET mode.
  • an HTTP response is returned to inform that the weather data can be acquired.
  • Step 303 Analyze and identify the data content provided by the weather information website to view the data content.
  • the weather information website provides data content in a specific format, and needs to analyze and identify the data content in a specific format provided by the weather information website to view the data content.
  • the data format provided by the API interface of the weather information website is in JSON format.
  • JSON is a data exchange format that uses a grammar convention similar to C.
  • the data content of the JSON format is analyzed and identified to view the data content.
  • Step 304 Determine whether the data content is a predetermined information content.
  • the data content is a predetermined information content. If the data content is not the predetermined information content, the data content is discarded, otherwise the next step is performed.
  • Step 305 If the data content is a predetermined information content, the data content is captured.
  • a depth-first search strategy may be used for the state space search when the data content is captured.
  • Step 306 save the captured data content as the weather data to the local.
  • a database can be created on the computing device to save the weather data to the database.
  • the traditional web crawler first sets one or more portal URLs.
  • a new URL is extracted from the current webpage into the queue, so as to obtain the webpage content corresponding to the URL. , save the content of the webpage to the local, and then extract the effective address as the next entry URL until the crawl is completed.
  • traditional web crawlers download a large number of irrelevant web pages.
  • Step 202 parsing missing values in the weather data.
  • some weather data may not be crawled due to an abnormality, resulting in missing values of the captured weather data.
  • the weather data that should be captured in a certain preset time period is not captured due to the abnormality, and the weather data of the corresponding time period is missing.
  • the data content in the web page may be missing in itself, resulting in missing values in the captured weather data.
  • the weather data may be processed into a matrix in which the row label is time information and the column label is weather information. It is determined whether there is data in the matrix that the column information field is empty. If there is data in the matrix where the column information field is empty, the data whose column information field is empty is a missing value in the weather data.
  • Step 203 Perform regression fitting using the ElasticNet algorithm to fill the missing value.
  • the ElasticNet regression fitting method is used to fill in missing values for weather data.
  • the ElasticNet algorithm is a linear regression algorithm.
  • h ⁇ (x i ) is the predicted value for x i
  • y i is the actual observed value
  • the ElasticNet loss function is defined as:
  • L1 regular term and L2 regular terms are given certain weights ⁇ 1 and ⁇ 2 , which can use the advantage of the L1 regular term to remove some features, and use the L2 regular term to reduce the coefficient, and the whole remains stable.
  • the ⁇ 1 and ⁇ 2 coefficients can be adjusted to assign the weights of the L1 regular term and the L2 regular term.
  • ⁇ 1 the elastic network regression becomes a Ridge linear regression.
  • ⁇ 2 the elastic network regression becomes Lasso linear regression; when ⁇ 1 and ⁇ 2 are both 0, it becomes a normal linear regression.
  • ElasticNet elastic network regression is an extended version of linear regression.
  • the filling of missing values is done by predicting missing values. Since the weather data has a temporal connection, each moment is closely related to the neighboring historical moments, so the neighboring historical data can be used to predict the missing current time data, and the predicted value is used to fill the missing value.
  • a set of data sets [x tiw , x ti-w+1 , ..., x ti-1 ] is obtained (for example, for time t, tw to t-1 can be obtained)
  • a set of data sets [x tw , x t-w+1 ,..., x t-1 ]) in time, that is, 24 sets of data sets are obtained:
  • the 24 sets of data sets obtained above are used as training data, and the training data is divided.
  • the last number of each group constitutes a set y, and the numbers other than the last number of each set constitute a set x.
  • the data set train can be obtained as follows:
  • the set y is:
  • Each set of values of x corresponds to each set of values of y.
  • the x and y of the training data are entered into the ElasticNet model, and the x values of each group are used to fit the y value to train the ElasticNet model.
  • the ElasticNet model will output a value, which is used as the missing x t+1 value.
  • the training data composed of the data set x and the data set y can be obtained, wherein the data set x is:
  • the data set y is:
  • the dataset x and dataset y are entered into the ElasticNet model to train the ElasticNet model. After the training is completed, input [10,11,14,13] as input data into the trained ElasticNet model to obtain the output value, which is filled with this value [3,3,4,5,7,9,10,10 Missing value (ie, None) in , 11, 14, 13, and None].
  • Step 204 Detect an outlier in the weather data by using a Moving-zscore algorithm, and reject the outlier.
  • the outliers in the weather data are data that do not conform to the law of weather data changes, and the outliers deviate significantly from other data.
  • the Moving-zscore algorithm also uses a time window.
  • the time window is defined as before, that is, a period of time adjacent to a given time.
  • the temperature for 29 consecutive moments is:
  • step 205 the regression fitting is performed by using the ElasticNet algorithm, and the abnormal value of the culling is filled.
  • the outlier is the new missing value in the weather data.
  • Outliers that are excluded from weather data can be filled using the ElasticNet regression fit method. For details, see step 103.
  • the weather data acquisition method of the present application captures weather data from a webpage; parses missing values in the weather data; performs regression fitting using an ElasticNet algorithm to fill the missing values; and uses a Moving-zscore algorithm to detect the weather data.
  • the abnormal value is eliminated, and the abnormal value is eliminated; the regression fitting is performed by using the ElasticNet algorithm, and the abnormal value of the culling is filled.
  • High reliability and high accuracy weather data can be obtained by the weather data acquisition method of the present application.
  • FIG. 4 is a structural diagram of a preferred embodiment of a weather data acquisition device of the present application.
  • the weather data acquiring apparatus 10 may include a crawling unit 401, a parsing unit 402, a first padding unit 403, a detecting unit 404, and a second padding unit 405.
  • the crawling unit 401 is configured to capture weather data from a webpage.
  • the weather data is time series data.
  • the weather data may include real-time weather data, forecasted weather data, and historical weather data.
  • the weather data may include humidity, temperature, air pressure, precipitation, water vapor pressure, wind speed, wind direction, and sunshine hours.
  • the weather data may include daily average temperature, average air pressure, maximum temperature, minimum temperature, average relative humidity, minimum relative humidity, precipitation, average wind speed, sunshine hours, and average water vapor pressure.
  • the weather data can be captured from weather information websites (such as China Weather Network, Sina Weather, Sohu Weather, etc.) to improve the reliability of the weather data. It can be understood that the weather data can be captured from any webpage.
  • weather information websites such as China Weather Network, Sina Weather, Sohu Weather, etc.
  • Weather data for a predetermined area can be captured.
  • the predetermined area may include a province, a city, a region, and the like. For example, grab weather data from Shenzhen.
  • the predetermined time may include a year, a month, a day, and the like. For example, grab daily weather data for January-February 2018.
  • the weather data can be captured by a web crawler.
  • a web crawler is an application that automatically extracts the content of web page data. Web crawlers usually start with a URL (also called a seed URL) of one or several initial web pages, obtain the URL of the initial web page, and fetch the web page according to specific algorithms and strategies (such as depth-first search strategy). In the process, the new URL is continuously extracted from the current web page and placed in the corresponding queue until the stop condition is satisfied.
  • the URL is an abbreviation of Uniform Resource Locator, which is a uniform resource locator.
  • the weather data can be captured using an open API interface of the weather information website (such as the API interface open by China Weather Network).
  • the API is an abbreviation of application interface, which can realize mutual communication between computer software through an API interface.
  • the open API interface of the weather information website can return data in JSON format or XML format.
  • the weather data can be captured by a web crawler using an open API interface of the weather information website. See Figure 3 for the specific process of crawling the weather data through the web crawler using the open API interface of the weather information website.
  • the parsing unit 402 is configured to parse missing values in the weather data.
  • some weather data may not be crawled due to an abnormality, resulting in missing values of the captured weather data.
  • the weather data that should be captured in a certain preset time period is not captured due to the abnormality, and the weather data of the corresponding time period is missing.
  • the data content in the web page may be missing in itself, resulting in missing values in the captured weather data.
  • the weather data may be processed into a matrix in which the row label is time information and the column label is weather information. It is determined whether there is data in the matrix that the column information field is empty. If there is data in the matrix where the column information field is empty, the data whose column information field is empty is a missing value in the weather data.
  • the first padding unit 403 is configured to perform regression fitting by using an ElasticNet algorithm to fill the missing value.
  • the ElasticNet regression fitting method is used to fill in missing values for weather data.
  • the ElasticNet algorithm is a linear regression algorithm.
  • h ⁇ (x i ) is the predicted value for x i
  • y i is the actual observed value
  • the ElasticNet loss function is defined as:
  • L1 regular term and L2 regular terms are given certain weights ⁇ 1 and ⁇ 2 , which can use the advantage of the L1 regular term to remove some features, and use the L2 regular term to reduce the coefficient, and the whole remains stable.
  • the ⁇ 1 and ⁇ 2 coefficients can be adjusted to assign the weights of the L1 regular term and the L2 regular term.
  • ⁇ 1 the elastic network regression becomes a Ridge linear regression.
  • ⁇ 2 the elastic network regression becomes Lasso linear regression; when ⁇ 1 and ⁇ 2 are both 0, it becomes a normal linear regression.
  • ElasticNet elastic network regression is an extended version of linear regression.
  • the filling of missing values is done by predicting missing values. Since the weather data has a temporal connection, each moment is closely related to the neighboring historical moments, so the neighboring historical data can be used to predict the missing current time data, and the predicted value is used to fill the missing value.
  • a set of data sets [x tiw , x ti-w+1 , ..., x ti-1 ] is obtained (for example, for time t, tw to t-1 can be obtained)
  • a set of data sets [x tw , x t-w+1 ,..., x t-1 ]) in time, that is, 24 sets of data sets are obtained:
  • the 24 sets of data sets obtained above are used as training data, and the training data is divided.
  • the last number of each group constitutes a set y, and the numbers other than the last number of each set constitute a set x.
  • the data set train can be obtained as follows:
  • the set y is:
  • Each set of values of x corresponds to each set of values of y.
  • the x and y of the training data are entered into the ElasticNet model, and the x values of each group are used to fit the y value to train the ElasticNet model.
  • the ElasticNet model will output a value, which is used as the missing x t+1 value.
  • the training data composed of the data set x and the data set y can be obtained, wherein the data set x is:
  • the data set y is:
  • the dataset x and dataset y are entered into the ElasticNet model to train the ElasticNet model. After the training is completed, input [10,11,14,13] as input data into the trained ElasticNet model to obtain the output value, which is filled with this value [3,3,4,5,7,9,10,10 Missing value (ie, None) in , 11, 14, 13, and None].
  • the detecting unit 404 is configured to detect an abnormal value in the weather data by using a Moving-zscore algorithm, and reject the abnormal value.
  • the outliers in the weather data are data that do not conform to the law of weather data changes, and the outliers deviate significantly from other data.
  • the Moving-zscore algorithm also uses a time window.
  • the time window is defined as before, that is, a period of time adjacent to a given time.
  • the temperature for 29 consecutive moments is:
  • the second padding unit 405 is configured to perform regression fitting by using an ElasticNet algorithm to fill the abnormal value of the culling.
  • the outlier is the new missing value in the weather data.
  • the second padding unit 405 performs regression fitting using the ElasticNet algorithm, and the specific method for filling the culled outliers is referred to the first padding unit 403, and details are not described herein again.
  • the weather data acquisition method device of the present application captures weather data from a webpage; parses missing values in the weather data; performs regression fitting using an ElasticNet algorithm to fill the missing values; and uses the Moving-zscore algorithm to detect the weather data.
  • the outlier value is eliminated, and the abnormal value is eliminated; the regression fitting is performed by using the ElasticNet algorithm to fill the abnormal value of the rejection.
  • the weather data acquisition device of the present application can obtain weather data with high reliability and high accuracy.
  • the weather data acquisition method of the present application captures weather data from a webpage; parses missing values in the weather data; performs regression fitting using an ElasticNet algorithm to fill the missing values; and uses a Moving-zscore algorithm to detect the weather data.
  • the abnormal value is eliminated, and the abnormal value is eliminated; the regression fitting is performed by using the ElasticNet algorithm, and the abnormal value of the culling is filled.
  • High reliability and high accuracy weather data can be obtained by the weather data acquisition method of the present application.
  • FIG. 5 is a detailed structural view of the gripping unit 401 of FIG. 4.
  • the crawling unit 401 can capture the weather data through a web crawler by using an API interface opened by the weather information website.
  • the fetching unit 401 may include: a generating subunit 4011, a requesting subunit 4012, an analyzing subunit 4013, a judging subunit 4014, a fetching subunit 4015, and a storing subunit 4016.
  • a generating subunit 4011 is configured to generate a seed URL for the API interface of the weather information website and a subsequent URL.
  • the seed URL is the basis and premise for the web crawler to do everything.
  • the seed URL can be one or more.
  • the structural characteristics of the URL of the weather information website can be analyzed, and the subsequent URLs are obtained according to the structural characteristics of the URL. For example, when the weather data of different areas is captured, the location information of the URL corresponding to the different areas is different, and the location information in the URL is modified to obtain the subsequent URL (ie, the URL corresponding to another area). .
  • the requesting subunit 4012 is configured to send an HTTP request to the API interface of the weather information website to request access to the API interface.
  • the HTTP request can be sent to the API interface of the weather information website in GET mode.
  • an HTTP response is returned to inform that the weather data can be acquired.
  • the analyzing subunit 4013 is configured to analyze and identify the data content provided by the weather information website to view the data content.
  • the weather information website provides data content in a specific format, and needs to analyze and identify the data content in a specific format provided by the weather information website to view the data content.
  • the data format provided by the API interface of the weather information website is in JSON format.
  • JSON is a data exchange format that uses a grammar convention similar to C.
  • the data content of the JSON format is analyzed and identified to view the data content.
  • the determining subunit 4014 is configured to determine whether the data content is a predetermined information content.
  • the data content is a predetermined information content. If the data content is not the predetermined information content, the data content is discarded, otherwise the next step is performed.
  • the capture subunit 4015 is configured to capture the data content if the data content is a predetermined information content.
  • a depth-first search strategy may be used for the state space search when the data content is captured.
  • the storage subunit 4016 is configured to save the captured data content as the weather data to the local.
  • a database can be created on the computing device to save the weather data to the database.
  • the traditional web crawler first sets one or more portal URLs.
  • a new URL is extracted from the current webpage into the queue, so as to obtain the webpage content corresponding to the URL. , save the content of the webpage to the local, and then extract the effective address as the next entry URL until the crawl is completed.
  • the crawling unit 401 utilizes the API interface opened by the weather information website to capture the weather data through the web crawler, thereby avoiding downloading irrelevant web pages and realizing efficient weather data capture.
  • FIG. 6 is a schematic diagram of a preferred embodiment of a computer device of the present application.
  • the computer device 1 includes a memory 20, a processor 30, and computer readable instructions 40, such as a weather data acquisition program, stored in the memory 20 and executable on the processor 30.
  • computer readable instructions 40 such as a weather data acquisition program
  • the steps in the foregoing weather data acquisition method embodiment are implemented, such as steps 201-205 shown in FIG. 2.
  • the processor 30, when executing the computer readable instructions 40 implements the functions of the various modules/units in the apparatus embodiments described above, such as units 401-405 in FIG.
  • the computer readable instructions 40 may be partitioned into one or more modules/units that are stored in the memory 20 and executed by the processor 30, To complete this application.
  • the one or more modules/units may be a series of computer readable instruction segments capable of performing a particular function for describing the execution of the computer readable instructions 40 in the computer device 1.
  • the computer readable instructions 40 may be divided into the capture unit 401, the parsing unit 402, the first padding unit 403, the detecting unit 404, and the second padding unit 405 in FIG. .
  • the computer device 1 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. It will be understood by those skilled in the art that the schematic diagram 6 is merely an example of the computer device 1 and does not constitute a limitation of the computer device 1. It may include more or less components than those illustrated, or may combine some components, or different. The components, such as the computer device 1, may also include input and output devices, network access devices, buses, and the like.
  • the processor 30 may be a central processing unit (CPU), or may be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
  • the general purpose processor may be a microprocessor or the processor 30 may be any conventional processor or the like, and the processor 30 is a control center of the computer device 1, and connects the entire computer device 1 by using various interfaces and lines. Various parts.
  • the memory 20 can be used to store the computer readable instructions 40 and/or modules/units by running or executing computer readable instructions and/or modules/units stored in the memory 20, and The various functions of the computer device 1 are realized by calling data stored in the memory 20.
  • the memory 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be Data (such as audio data, phone book, etc.) created according to the use of the computer device 1 is stored.
  • the memory 20 may include a high-speed random access memory, and may also include a non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a secure digital (Secure Digital, SD).
  • a non-volatile memory such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SMC), and a secure digital (Secure Digital, SD).
  • SMC smart memory card
  • SD Secure Digital
  • Card flash card, at least one disk storage device, flash device, or other volatile solid state storage device.
  • the modules/units integrated by the computer device 1 can be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by computer-readable instructions, which may be stored in a non-volatile manner. In reading a storage medium, the computer readable instructions, when executed by a processor, implement the steps of the various method embodiments described above. Wherein, the computer readable instructions comprise computer readable instruction code, which may be in the form of source code, an object code form, an executable file or some intermediate form or the like.
  • the non-transitory readable medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read only memory (ROM, Read-Only Memory), Random Access Memory (RAM), electrical carrier signals, telecommunications signals, and software distribution media.
  • ROM Read Only memory
  • RAM Random Access Memory
  • the contents of the non-volatile readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, Volatile readable media does not include electrical carrier signals and telecommunication signals.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Environmental & Geological Engineering (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Algebra (AREA)
  • Evolutionary Biology (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Operations Research (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Atmospheric Sciences (AREA)
  • Biodiversity & Conservation Biology (AREA)
  • Ecology (AREA)
  • Environmental Sciences (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种天气数据获取方法,所述方法包括:从网页中抓取天气数据;解析所述天气数据中的缺失值;利用ElasticNet算法进行回归拟合,填补所述缺失值;利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。本申请还提供一种天气数据获取装置、计算机装置及可读存储介质。本申请可以获得高可靠性、高准确率的天气数据。

Description

天气数据获取方法及装置、计算机装置及可读存储介质
本申请要求于2018年04月11日提交中国专利局,申请号为201810322422.9发明名称为“天气数据获取方法及装置、计算机装置及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据处理技术领域,具体涉及一种天气数据获取方法及装置、计算机装置和可读存储介质。
背景技术
天气数据在我们的日常生活中起着越来越重要的作用。例如,对于沿海地区和从事海上作业的人们来说,可以通过天气预报了解未来是否有台风或暴雨,减少不必要的损失。如何获得可靠的天气数据成为了一个巨大的挑战。
传统的天气数据抓取仅仅是从网络上获取天气数据,缺少对天气数据的具体内容进行判定和处理的过程,因而获得的数据并不理想。
发明内容
鉴于以上内容,有必要提出一种天气数据获取方法及装置、计算机装置和可读存储介质,其可以获得高可靠性、高准确率的天气数据。
本申请的第一方面提供一种天气数据获取方法,所述方法包括:
从网页中抓取天气数据;
解析所述天气数据中的缺失值;
利用ElasticNet算法进行回归拟合,填补所述缺失值;
利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
本申请的第二方面提供一种天气数据获取装置,所述装置包括:
抓取单元,用于从网页中抓取天气数据;
解析单元,用于解析所述天气数据中的缺失值;
第一填补单元,用于利用ElasticNet算法进行回归拟合,填补所述缺失值;
检测单元,用于利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
第二填补单元,用于利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
本申请的第三方面提供一种计算机装置,所述计算机装置包括存储器和处理器,所述存储器存储有至少一条计算机可读指令,所述处理器执行所述至少一条计算机可读指令以实现所述天气数据获取方法。
本申请的第四方面提供一种非易失性可读存储介质,所述非易失性可读存储介质上存储有至少一条计算机可读指令,其特征在于,所述至少一条计算机可 读指令被处理器执行时实现所述天气数据获取方法。
本申请从网页中抓取天气数据;解析所述天气数据中的缺失值;利用ElasticNet算法进行回归拟合,填补所述缺失值;利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。本申请可以获得高可靠性、高准确率的天气数据。
附图说明
图1是本申请天气数据获取方法的应用环境示意图。
图2是本申请天气数据获取方法较佳实施例的流程图。
图3是图2中步骤201的细化流程图。
图4为本申请天气数据获取装置较佳实施例的结构图。
图5是图4中抓取单元的细化结构图。
图6为本申请计算机装置较佳实施例的示意图。
具体实施方式
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
优选地,本申请的天气数据获取方法应用在一个或者多个计算机装置中。所述计算机装置是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。
图1是本申请天气数据获取方法的应用环境示意图。
参阅图1所示,所述天气数据获取方法应用于计算机装置1中,所述计算机装置1通过网络2与网络服务器3通信连接,所述网络服务器3与网页库4相连,所述网页库4存储多个网页。所述计算机装置1通过网络服务器3抓取网页库4中网页上的天气数据,并对抓取的天气数据进行填补和修正,获得高可靠性、高准确率的天气数据。
图2是本申请天气数据获取方法较佳实施例的流程图。
参阅图2所示,所述天气数据获取方法具体包括以下步骤:
步骤201,从网页中抓取天气数据。
所述天气数据为时间序列数据。所述天气数据可以包括实时的天气数据、预报的天气数据和历史的天气数据。
所述天气数据可以包括湿度、气温、气压、降水量、水汽压、风速、风向、日照时数。在一具体实施例中,所述天气数据可以包括每日的平均气温、平均气压、最高气温、最低气温、平均相对湿度、最小相对湿度、降水量、平均风速、日照时数、平均水汽压。
可以从天气信息网站(例如中国天气网、新浪天气、搜狐天气等)抓取所述天气数据,以提高天气数据的可靠性。可以理解,可以从任意网页中抓取所述天气数据。
可以抓取预定区域的天气数据。所述预定区域可以包括省、市、地区等。例如,抓取深圳市的天气数据。
可以抓取预定时间的天气数据。所述预定时间可以包括年、月、日等。例如,抓取2018年1-2月每日的天气数据。
可以通过网络爬虫抓取所述天气数据。网络爬虫是一个可以自动提取网页数据信息内容的应用程序。网络爬虫通常是从一个或者是若干个初始网页的URL(也称种子URL)开始,获取初始网页的URL,依照特定的算法和策略(例如深度优先搜索策略),在对网页进行抓取的过程中,不断地从当前的网页中抽取新的URL放入到相应的队列中,直到满足停止条件为止。URL为Uniform Resource Locator的缩写,即统一资源定位符。
可以利用天气信息网站开放的API接口(例如中国天气网开放的API接口)抓取所述天气数据。API是应用程序接口(application interface)的缩写,通过API接口可以实现计算机软件之间的相互通信。天气信息网站开放的API接口可以返回JSON格式或者XML格式的数据。
在一具体实施例中,可以利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据。利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据的具体过程参见图3。
图3是图2中步骤201的细化流程图。参阅图3所示,具体可以包括以下步骤:
步骤301,生成面向所述天气信息网站的API接口的种子URL以及后续的URL。
种子URL是网络爬虫进行一切工作的基础和前提。种子URL可以是一个也可以是多个。
可以对天气信息网站的URL的结构特点进行分析,根据URL的结构特点得到后续的URL。例如,在对不同区域的天气数据进行抓取时,分析得到不同区域所对应的URL的位置信息不同,修改URL中的位置信息,即可得到后续的URL(即另一区域所对应的URL)。
步骤302,向所述天气信息网站的API接口发送HTTP请求,请求访问所述API接口。
可以以GET方式向所述天气信息网站的API接口发送HTTP请求。当天气信息网站同意获取其提供的天气数据时,返回HTTP响应,以告知可以进行获取天气数据的操作。
步骤303,对所述天气信息网站提供的数据内容进行分析和识别,以查看所述数据内容。
天气信息网站提供特定格式的数据内容,需要对天气信息网站提供的特定格式的数据内容进行分析和识别,来查看所述数据内容。例如,所述天气信息网站的API接口提供的数据格式为JSON格式。JSON是一种数据交换格式,使用了类似于C语言的语法习惯。对该JSON格式的数据内容进行分析和识别,来查看所述数据内容。
步骤304,判断所述数据内容是否为预定信息内容。
为了得到特定的天气数据,需要判断所述数据内容是否为预定信息内容。若所述数据内容是否不是预定信息内容,则舍弃该数据内容,否则执行下一步骤。
步骤305,若所述数据内容为预定信息内容,则抓取所述数据内容。
数据抓取的最终目的是将网络数据内容抓取到本地。对于JSON格式的数据内容,在抓取所述数据内容时可以采用深度优先搜索策略进行状态空间搜索。
步骤306,将抓取的数据内容作为所述天气数据保存到本地。
可以在计算设备上创建数据库,将所述天气数据保存到所述数据库中。
传统的网络爬虫都是首先设定一个或者多个入口URL,在抓取网页的过程中,按照抓取的策略,从当前网页上提取出新的URL放入队列,以便获取URL对应的网页内容,将网页内容保存到本地,然后,再提取有效地址作为下一次的入口URL,直到爬行完毕。随着网页数量的剧增,传统的网络爬虫会下载大量的无关网页。利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据,可以避免下载无关网页,实现高效的天气数据抓取。
步骤202,解析所述天气数据中的缺失值。
在从网页中抓取天气数据的过程中,可能会因为发生异常,使部分天气数据没有抓取,导致抓取的天气数据存在缺失值。例如,在抓取天气数据的过程中,由于异常使某一预设时间段应抓取的天气数据没有抓取,导致该对应时间段的天气数据缺失。
或者,网页中的数据内容可能本身就有缺失,造成抓取到的天气数据存在缺失值。
具体地,可以将所述天气数据处理成行标签为时间信息、列标签为天气信息的矩阵。判断所述矩阵中是否存在列信息字段为空的数据,若所述矩阵中存在列信息字段为空的数据,则该列信息字段为空的数据为所述天气数据中的缺失值。
步骤203,利用ElasticNet算法进行回归拟合,填补所述缺失值。
本申请中,用ElasticNet回归拟合方法来填补对于天气数据中的缺失值。
(1)ElasticNet原理
ElasticNet算法是一种线性回归算法。
设h θ为线性回归函数:
h θ(x i)=θ 01x 12x 2+…+θ ix i+…+θ nx n
h θ(x i)为对x i的预测值,y i为实际观测值。
普通线性回归损失函数为:
Figure PCTCN2018099549-appb-000001
而ElasticNet损失函数定义为:
Figure PCTCN2018099549-appb-000002
它同时引入了L1正则项
Figure PCTCN2018099549-appb-000003
和L2正则项
Figure PCTCN2018099549-appb-000004
给它们赋予一定的权重α 1和α 2,既能用到L1正则项的优势来去除部分特征,同时用到 L2正则项来缩减系数,整体保持了稳定。
在引入正则项后,利用梯度下降法对参数进行调整的表达式如下:
Figure PCTCN2018099549-appb-000005
α 1和α 2系数可以调节,来分配L1正则项和L2正则项的权重,当α 1为0时弹性网络回归就变成了Ridge线性回归,当α 2为0时弹性网络回归就变成了Lasso线性回归;当α 1和α 2同时为0时就成了普通线性回归。ElasticNet弹性网络回归是线性回归的拓展版。
(2)缺失值的填补
缺失值的填补是通过对缺失的值进行预测来完成的。由于天气数据存在时序上的联系,每个时刻都和邻近的历史时刻联系紧密,所以可以利用邻近的历史数据来对缺失的当前时刻数据进行预测,用预测值来填补缺失值。
假设t+1时刻的数据x t+1发生缺失,则所述利用ElasticNet算法进行回归拟合,填补所述缺失值包括:
选取t+1时刻之前的24个时刻t-i,i=0,1,2,…,23,选取时间窗大小w。时间窗为给定时刻之前邻近的一段时间。例如,设给定时刻为t=10,时间窗大小w取4,时间窗就是t=6到t=9这段时间。对于所述24个时刻中的每一个时刻t-i,得到一组数据集[x t-i-w,x t-i-w+1,…,x t-i-1](例如,对于时刻t,可以得到t-w到t-1时间内的一组数据集[x t-w,x t-w+1,…,x t-1]),即得到24组数据集:
[x t-w,x t-w+1,…,x t-1],
[x t-w-1,x t-w,…,x t-2],
[x t-w-2,x t-w-1,…,x t-3],
[x t-w-23,x 1,…,x t-24]。
以上述得到的24组数据集作为训练数据,对训练数据进行划分,每一组最后一个数组成集合y,每一组最后一个数以外的其他数组成集合x。根据上述划分可以得到数据集train,如下所示:
[[x t-w,x t-w+1,…,x t-2],[x t-1]],
[[x t-w-1,x t-w,…,x t-3],[x t-2]],
[[x t-w-2,x t-w-1,…,x t-4],[x t-3]],
[[x t-w-23,x 1,…,x t-25],[x t-24]]。
则集合x为:
[[x t-w,x t-w+1,…,x t-2],
[x t-w-1,x t-w,…,x t-3],
[x t-w-2,x t-w-1,…,x t-4],
[x t-w-23,x 1,…,x t-25]]。
集合y为:
[[x t-1],[x t-2],[x t-3],…,[x t-24]]。
x的每一组值都和y的每一组值一一对应。
将训练数据的x和y输入ElasticNet模型中,用每一组的x值去拟合y值,训练出ElasticNet模型。
以[x t-w+1,x t-w+1,…,x t]作为输入数据输入到训练好的ElasticNet模型中,ElasticNet模型会输出一个值,将这个值作为缺失的x t+1值。
举例说明:
有时间序列数据[3,3,4,5,7,9,10,10,11,14,13,None],最后一个值出现缺失。
取时间窗大小w=4,可以得到数据集x和数据集y组成的训练数据,其中,数据集x为:
[3,3,4,5],[3,4,5,7],[4,5,7,9],[5,7,9,10],[7,9,10,10],[9,10,10,11],[10,10,11,14];
数据集y为:
[7,9,10,10,11,14,13]。
将数据集x和数据集y输入ElasticNet模型,对ElasticNet模型进行训练。训练完成后,以[10,11,14,13]作为输入数据输入到训练好的ElasticNet模型中,得到输出值,以该值填补[3,3,4,5,7,9,10,10,11,14,13,None]中的缺失值(即None)。
步骤204,利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值。
天气数据中的异常值为不符合天气数据变化规律的数据,异常值明显偏离其他数据。
Moving-zscore算法也用到了时间窗。时间窗的定义同前,即为给定时刻之前邻近的一段时间。
设天气数据为X=[x 0,x 1,x 2,…,x t′],利用Moving-zscore算法检测所述天气数据中的异常值包括如下步骤:
(1)选取时间窗大小w′,针对时间点w′至时间点t′中的每个时间点i′,i′=w′,w′+1,…,t′,计算所述时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,所述时间点i′对应的时间窗的长度为w′;
(2)根据每个时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,计算所述时间点i′对应的天气数据x i′的mz值mz i′,得到mz列表:
[mz w′,mz w′+1,mz w′+2,…,mz t′],
其中:
Figure PCTCN2018099549-appb-000006
(3)求mz列表的第α分位数作为阈值,得到mz α_percentage,α为预设值;
(4)如果mz i′大于mz α_percentage,则对应第i′时刻的天气数据x i′为异常值。
例如,29个连续时刻的气温为:
[3,3,4,5,4,6,7,6,7,8,9,8,17,8,7,9,10,11,12,12,13,12,14,14,15,16,16,17,16]。
取时间窗大小w′=4,也就是从第5个数“4”开始计算mz值,对于第5个数,其时间窗内的数为[3,3,4,5],均值为3.75,标准差为0.829,则mz值为(4-3.75)/0.829=0.302(四舍五入保留小数点后三位)。
按照同样的方法,依次计算出第5个数后面所有的mz值,得到mz列表:
[0.302,2.828,2.713,0.447,1.147,3.0,2.828,0.447,12.728,0.662,0.927,0.246,0.063,2.236,1.859,1.342,2.110,0.0,4.041,1.508,2.110,2.065,1.508,2.111,0.0]。
再取mz列表的0.995分位数作为阈值,得到11.685。
可以发现,列表中只有12.728是大于这个阈值的,所以12.728是异常mz值,同时12.728对应原数据列表中的17,所以17就是异常值,需要将其剔除掉。
步骤205,利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
剔除的异常值即所述天气数据中新的缺失值。对于天气数据中剔除的异常值,可以用ElasticNet回归拟合的方法来填补。具体方法参见步骤103。
本申请天气数据获取方法从网页中抓取天气数据;解析所述天气数据中的缺失值;利用ElasticNet算法进行回归拟合,填补所述缺失值;利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。通过本申请天气数据获取方法可以获得高可靠性、高准确率的天气数据。
图4为本申请天气数据获取装置较佳实施例的结构图。
参阅图4所示,所述天气数据获取装置10可以包括:抓取单元401、解析单元402、第一填补单元403、检测单元404、第二填补单元405。
抓取单元401,用于从网页中抓取天气数据。
所述天气数据为时间序列数据。所述天气数据可以包括实时的天气数据、预报的天气数据和历史的天气数据。
所述天气数据可以包括湿度、气温、气压、降水量、水汽压、风速、风向、日照时数。在一具体实施例中,所述天气数据可以包括每日的平均气温、平均气压、最高气温、最低气温、平均相对湿度、最小相对湿度、降水量、平均风速、日照时数、平均水汽压。
可以从天气信息网站(例如中国天气网、新浪天气、搜狐天气等)抓取所述天气数据,以提高天气数据的可靠性。可以理解,可以从任意网页中抓取所述天气数据。
可以抓取预定区域的天气数据。所述预定区域可以包括省、市、地区等。例如,抓取深圳市的天气数据。
可以抓取预定时间的天气数据。所述预定时间可以包括年、月、日等。例如,抓取2018年1-2月每日的天气数据。
可以通过网络爬虫抓取所述天气数据。网络爬虫是一个可以自动提取网页数据信息内容的应用程序。网络爬虫通常是从一个或者是若干个初始网页的URL(也称种子URL)开始,获取初始网页的URL,依照特定的算法和策略(例如深度优先搜索策略),在对网页进行抓取的过程中,不断地从当前的网页中抽取新的URL放入到相应的队列中,直到满足停止条件为止。URL为Uniform Resource Locator的缩写,即统一资源定位符。
可以利用天气信息网站开放的API接口(例如中国天气网开放的API接 口)抓取所述天气数据。API是应用程序接口(application interface)的缩写,通过API接口可以实现计算机软件之间的相互通信。天气信息网站开放的API接口可以返回JSON格式或者XML格式的数据。
在一具体实施例中,可以利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据。利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据的具体过程参见图3。
解析单元402,用于解析所述天气数据中的缺失值。
在从网页中抓取天气数据的过程中,可能会因为发生异常,使部分天气数据没有抓取,导致抓取的天气数据存在缺失值。例如,在抓取天气数据的过程中,由于异常使某一预设时间段应抓取的天气数据没有抓取,导致该对应时间段的天气数据缺失。
或者,网页中的数据内容可能本身就有缺失,造成抓取到的天气数据存在缺失值。
具体地,可以将所述天气数据处理成行标签为时间信息、列标签为天气信息的矩阵。判断所述矩阵中是否存在列信息字段为空的数据,若所述矩阵中存在列信息字段为空的数据,则该列信息字段为空的数据为所述天气数据中的缺失值。
第一填补单元403,用于利用ElasticNet算法进行回归拟合,填补所述缺失值。
本申请中,用ElasticNet回归拟合方法来填补对于天气数据中的缺失值。
(1)ElasticNet原理
ElasticNet算法是一种线性回归算法。
设h θ为线性回归函数:
h θ(x i)=θ 01x 12x 2+…+θ ix i+…+θ nx n
h θ(x i)为对x i的预测值,y i为实际观测值。
普通线性回归损失函数为:
Figure PCTCN2018099549-appb-000007
而ElasticNet损失函数定义为:
Figure PCTCN2018099549-appb-000008
它同时引入了L1正则项
Figure PCTCN2018099549-appb-000009
和L2正则项
Figure PCTCN2018099549-appb-000010
给它们赋予一定的权重α 1和α 2,既能用到L1正则项的优势来去除部分特征,同时用到L2正则项来缩减系数,整体保持了稳定。
在引入正则项后,利用梯度下降法对参数进行调整的表达式如下:
Figure PCTCN2018099549-appb-000011
α 1和α 2系数可以调节,来分配L1正则项和L2正则项的权重,当α 1为0时弹性网络回归就变成了Ridge线性回归,当α 2为0时弹性网络回归就变成了Lasso线性回归;当α 1和α 2同时为0时就成了普通线性回归。ElasticNet弹性网络回归是线性回归的拓展版。
(2)缺失值的填补
缺失值的填补是通过对缺失的值进行预测来完成的。由于天气数据存在时序上的联系,每个时刻都和邻近的历史时刻联系紧密,所以可以利用邻近的历史数据来对缺失的当前时刻数据进行预测,用预测值来填补缺失值。
假设t+1时刻的数据x t+1发生缺失,则所述利用ElasticNet算法进行回归拟合,填补所述缺失值包括:
选取t+1时刻之前的24个时刻t-i,i=0,1,2,…,23,选取时间窗大小w。时间窗为给定时刻之前邻近的一段时间。例如,设给定时刻为t=10,时间窗大小w取4,时间窗就是t=6到t=9这段时间。对于所述24个时刻中的每一个时刻t-i,得到一组数据集[x t-i-w,x t-i-w+1,…,x t-i-1](例如,对于时刻t,可以得到t-w到t-1时间内的一组数据集[x t-w,x t-w+1,…,x t-1]),即得到24组数据集:
[x t-w,x t-w+1,…,x t-1],
[x t-w-1,x t-w,…,x t-2],
[x t-w-2,x t-w-1,…,x t-3],
[x t-w-23,x 1,…,x t-24]。
以上述得到的24组数据集作为训练数据,对训练数据进行划分,每一组最后一个数组成集合y,每一组最后一个数以外的其他数组成集合x。根据上述划分可以得到数据集train,如下所示:
[[x t-w,x t-w+1,…,x t-2],[x t-1]],
[[x t-w-1,x t-w,…,x t-3],[x t-2]],
[[x t-w-2,x t-w-1,…,x t-4],[x t-3]],
[[x t-w-23,x 1,…,x t-25],[x t-24]]。
则集合x为:
[[x t-w,x t-w+1,…,x t-2],
[x t-w-1,x t-w,…,x t-3],
[x t-w-2,x t-w-1,…,x t-4],
[x t-w-23,x 1,…,x t-25]]。
集合y为:
[[x t-1],[x t-2],[x t-3],…,[x t-24]]。
x的每一组值都和y的每一组值一一对应。
将训练数据的x和y输入ElasticNet模型中,用每一组的x值去拟合y值,训练出ElasticNet模型。
以[x t-w+1,x t-w+1,…,x t]作为输入数据输入到训练好的ElasticNet模型中,ElasticNet模型会输出一个值,将这个值作为缺失的x t+1值。
举例说明:
有时间序列数据[3,3,4,5,7,9,10,10,11,14,13,None],最后一个值出现缺失。
取时间窗大小w=4,可以得到数据集x和数据集y组成的训练数据,其 中,数据集x为:
[3,3,4,5],[3,4,5,7],[4,5,7,9],[5,7,9,10],[7,9,10,10],[9,10,10,11],[10,10,11,14];
数据集y为:
[7,9,10,10,11,14,13]。
将数据集x和数据集y输入ElasticNet模型,对ElasticNet模型进行训练。训练完成后,以[10,11,14,13]作为输入数据输入到训练好的ElasticNet模型中,得到输出值,以该值填补[3,3,4,5,7,9,10,10,11,14,13,None]中的缺失值(即None)。
检测单元404,用于利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值。
天气数据中的异常值为不符合天气数据变化规律的数据,异常值明显偏离其他数据。
Moving-zscore算法也用到了时间窗。时间窗的定义同前,即为给定时刻之前邻近的一段时间。
设天气数据为X=[x 0,x 1,x 2,…,x t′],利用Moving-zscore算法检测所述天气数据中的异常值包括如下步骤:
(1)选取时间窗大小w′,针对时间点w′至时间点t′中的每个时间点i′,i′=w′,w′+1,…,t′,计算所述时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,所述时间点i′对应的时间窗的长度为w′;
(2)根据每个时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,计算所述时间点i′对应的天气数据x i′的mz值mz i′,得到mz列表:
[mz w′,mz w′+1,mz w′+2,…,mz t′],
其中:
Figure PCTCN2018099549-appb-000012
(3)求mz列表的第α分位数作为阈值,得到mz α_percentage,α为预设值;
(4)如果mz i′大于mz α_percentage,则对应第i′时刻的天气数据x i′为异常值。
例如,29个连续时刻的气温为:
[3,3,4,5,4,6,7,6,7,8,9,8,17,8,7,9,10,11,12,12,13,12,14,14,15,16,16,17,16]。
取时间窗大小w′=4,也就是从第5个数“4”开始计算mz值,对于第5个数,其时间窗内的数为[3,3,4,5],均值为3.75,标准差为0.829,则mz值为(4-3.75)/0.829=0.302(四舍五入保留小数点后三位)。
按照同样方法,依次计算出第5个数后面所有的mz值,得到mz列表:
[0.302,2.828,2.713,0.447,1.147,3.0,2.828,0.447,12.728,0.662,0.927,0.246,0.063,2.236,1.859,1.342,2.110,0.0,4.041,1.508,2.110,2.065,1.508,2.111,0.0]。
再取mz列表的0.995分位数作为阈值,得到11.685。
可以发现,列表中只有12.728是大于这个阈值的,所以12.728是异常mz值,同时12.728对应原数据列表中的17,所以17就是异常值,需要将其剔除掉。
第二填补单元405,用于利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
剔除的异常值即所述天气数据中新的缺失值。第二填补单元405利用ElasticNet算法进行回归拟合,填补剔除的所述异常值的具体方法参考第一填补单元403,此处不再赘述。
本申请天气数据获取方法装置从网页中抓取天气数据;解析所述天气数据中的缺失值;利用ElasticNet算法进行回归拟合,填补所述缺失值;利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。通过本申请天气数据获取装置可以获得高可靠性、高准确率的天气数据。
本申请天气数据获取方法从网页中抓取天气数据;解析所述天气数据中的缺失值;利用ElasticNet算法进行回归拟合,填补所述缺失值;利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。通过本申请天气数据获取方法可以获得高可靠性、高准确率的天气数据。
图5是图4中抓取单元401的细化结构图。
抓取单元401可以利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据。参阅图5所示,抓取单元401可以包括:生成子单元4011、请求子单元4012、分析子单元4013、判断子单元4014、抓取子单元4015、存储子单元4016。
生成子单元4011,用于生成面向所述天气信息网站的API接口的种子URL以及后续的URL。
种子URL是网络爬虫进行一切工作的基础和前提。种子URL可以是一个也可以是多个。
可以对天气信息网站的URL的结构特点进行分析,根据URL的结构特点得到后续的URL。例如,在对不同区域的天气数据进行抓取时,分析得到不同区域所对应的URL的位置信息不同,修改URL中的位置信息,即可得到后续的URL(即另一区域所对应的URL)。
请求子单元4012,用于向所述天气信息网站的API接口发送HTTP请求,请求访问所述API接口。
可以以GET方式向所述天气信息网站的API接口发送HTTP请求。当天气信息网站同意获取其提供的天气数据时,返回HTTP响应,以告知可以进行获取天气数据的操作。
分析子单元4013,用于对所述天气信息网站提供的数据内容进行分析和识别,以查看所述数据内容。
天气信息网站提供特定格式的数据内容,需要对天气信息网站提供的特定格式的数据内容进行分析和识别,来查看所述数据内容。例如,所述天气信息网站的API接口提供的数据格式为JSON格式。JSON是一种数据交换格式,使用了类似于C语言的语法习惯。对该JSON格式的数据内容进行分析和识别,来查看所述数据内容。
判断子单元4014,用于判断所述数据内容是否为预定信息内容。
为了得到特定的天气数据,需要判断所述数据内容是否为预定信息内容。 若所述数据内容是否不是预定信息内容,则舍弃该数据内容,否则执行下一步骤。
抓取子单元4015,用于若所述数据内容为预定信息内容,则抓取所述数据内容。
数据抓取的最终目的是将网络数据内容抓取到本地。对于JSON格式的数据内容,在抓取所述数据内容时可以采用深度优先搜索策略进行状态空间搜索。
存储子单元4016,用于将抓取的数据内容作为所述天气数据保存到本地。
可以在计算设备上创建数据库,将所述天气数据保存到所述数据库中。
传统的网络爬虫都是首先设定一个或者多个入口URL,在抓取网页的过程中,按照抓取的策略,从当前网页上提取出新的URL放入队列,以便获取URL对应的网页内容,将网页内容保存到本地,然后,再提取有效地址作为下一次的入口URL,直到爬行完毕。随着网页数量的剧增,传统的网络爬虫会下载大量的无关网页。抓取单元401利用天气信息网站开放的API接口,通过网络爬虫抓取所述天气数据,可以避免下载无关网页,实现高效的天气数据抓取。
图6为本申请计算机装置较佳实施例的示意图。
所述计算机装置1包括存储器20、处理器30以及存储在所述存储器20中并可在所述处理器30上运行的计算机可读指令40,例如天气数据获取程序。所述处理器30执行所述计算机可读指令40时实现上述天气数据获取方法实施例中的步骤,例如图2所示的步骤201-205。或者,所述处理器30执行所述计算机可读指令40时实现上述装置实施例中各模块/单元的功能,例如图4中的单元401-405。
示例性的,所述计算机可读指令40可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器20中,并由所述处理器30执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机可读指令段,该指令段用于描述所述计算机可读指令40在所述计算机装置1中的执行过程。例如,所述计算机可读指令40可以被分割成图4中的抓取单元401、解析单元402、第一填补单元403、检测单元404、第二填补单元405,各单元具体功能参见实施例二。
所述计算机装置1可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。本领域技术人员可以理解,所述示意图6仅仅是计算机装置1的示例,并不构成对计算机装置1的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述计算机装置1还可以包括输入输出设备、网络接入设备、总线等。
所称处理器30可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或 者该处理器30也可以是任何常规的处理器等,所述处理器30是所述计算机装置1的控制中心,利用各种接口和线路连接整个计算机装置1的各个部分。
所述存储器20可用于存储所述计算机可读指令40和/或模块/单元,所述处理器30通过运行或执行存储在所述存储器20内的计算机可读指令和/或模块/单元,以及调用存储在存储器20内的数据,实现所述计算机装置1的各种功能。所述存储器20可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作***、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机装置1的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器20可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
所述计算机装置1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,也可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性可读存储介质中,该计算机可读指令在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机可读指令包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述非易失性可读介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。需要说明的是,所述非易失性可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在某些司法管辖区,根据立法和专利实践,非易失性可读介质不包括电载波信号和电信信号。
在本申请所提供的几个实施例中,应该理解到,所揭露的计算机装置和方法,可以通过其它的方式实现。例如,以上所描述的计算机装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。计算机装置权利要求中陈述的多个单元或计算机装置也可以由同一个单元或计算机装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种天气数据获取方法,其特征在于,所述方法包括:
    从网页中抓取天气数据;
    解析所述天气数据中的缺失值;
    利用ElasticNet算法进行回归拟合,填补所述缺失值;
    利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
    利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
  2. 如权利要求1所述的方法,其特征在于,所述从网页中抓取天气数据包括:
    生成面向天气信息网站的API接口的种子URL以及后续的URL;
    向所述天气信息网站的API接口发送HTTP请求,请求访问所述API接口;
    对所述天气信息网站提供的数据内容进行分析和识别,以查看所述数据内容;
    判断所述数据内容是否为预定信息内容;
    若所述数据内容为预定信息内容,则抓取所述数据内容;
    将抓取的数据内容作为所述天气数据保存到本地。
  3. 如权利要求1所述的方法,其特征在于,假设t+1时刻的数据x t+1发生缺失,则所述利用ElasticNet算法进行回归拟合,填补所述缺失值包括:
    选取t+1时刻之前的24个时刻t-i,i=0,1,2,…,23,选取时间窗大小w,对于所述24个时刻中的每一个时刻t-i,得到一组数据集[x t-i-w,x t-i-w+1,…,x t-i-1],即得到24组数据集:
    [x t-w,x t-w+1,…,x t-1],
    [x t-w-1,x t-w,…,x t-2],
    [x t-w-2,x t-w-1,…,x t-3],
    [x t-w-23,x 1,…,x t-24];
    以所述24组数据集作为训练数据,对训练数据进行划分,每一组最后一个数组成集合y,每一组最后一个数以外的其他数组成集合x,集合x为:
    [[x t-w,x t-w+1,…,x t-2],
    [x t-w-1,x t-w,…,x t-3],
    [x t-w-2,x t-w-1,…,x t-4],
    [x t-w-23,x 1,…,x t-25]],
    集合y为:
    [[x t-1],[x t-2],[x t-3],…,[x t-24]];
    将训练数据的x值和y值输入ElasticNet模型中,用每一组的x值去拟合y值,训练ElasticNet模型;
    以[x t-w+1,x t-w+1,…,x t]作为输入数据输入到训练好的ElasticNet模型中,得到ElasticNet模型输出的一个值,将该值作为缺失的x t+1
  4. 如权利要求1所述的方法,其特征在于,设天气数据为X=[x 0,x 1,x 2,…,x t′],所述利用Moving-zscore算法检测所述天气数据中的异常值包括:
    (1)选取时间窗大小w′,针对时间点w′至时间点t′中的每个时间点i′,i′=w′,w′+1,…,t′,计算所述时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,所述时间点i′对应的时间窗的长度为w′;
    (2)根据每个时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,计算所述时间点i′对应的天气数据x i′的mz值mz i′,得到mz列表:
    [mz w′,mz w′+1,mz w′+2,…,mz t′],
    其中:
    Figure PCTCN2018099549-appb-100001
    (3)求mz列表的第α分位数作为阈值,得到mz α_percentage,α为预设值;
    (4)如果mz i′大于mz α_percentage,则对应第i′时刻的天气数据x i′为异常值。
  5. 如权利要求1-4中任一项所述的方法,其特征在于,所述天气数据包括湿度、气温、气压、降水量、水汽压、风速、风向、日照时数。
  6. 如权利要求1-4中任一项所述的方法,其特征在于,所述天气数据包括实时的天气数据、预报的天气数据和历史的天气数据。
  7. 如权利要求1-4中任一项所述的方法,其特征在于,所述解析所述天气数据中的缺失值包括:
    将所述天气数据处理成行标签为时间信息、列标签为天气信息的矩阵;
    判断所述矩阵中是否存在列信息字段为空的数据;
    若所述矩阵中存在列信息字段为空的数据,则该列信息字段为空的数据为所述天气数据中的缺失值。
  8. 一种天气数据获取装置,其特征在于,所述装置包括:
    抓取单元,用于从网页中抓取天气数据;
    解析单元,用于解析所述天气数据中的缺失值;
    第一填补单元,用于利用ElasticNet算法进行回归拟合,填补所述缺失值;
    检测单元,用于利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
    第二填补单元,用于利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
  9. 一种计算机装置,其特征在于,所述计算机装置包括存储器和处理器,所述存储器存储有至少一条计算机可读指令,所述处理器执行所述至少一条计算机可读指令以实现以下步骤:
    从网页中抓取天气数据;
    解析所述天气数据中的缺失值;
    利用ElasticNet算法进行回归拟合,填补所述缺失值;
    利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
    利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
  10. 如权利要求9所述的计算机装置,其特征在于,所述从网页中抓取天气数据包括:
    生成面向天气信息网站的API接口的种子URL以及后续的URL;
    向所述天气信息网站的API接口发送HTTP请求,请求访问所述API接口;
    对所述天气信息网站提供的数据内容进行分析和识别,以查看所述数据内容;
    判断所述数据内容是否为预定信息内容;
    若所述数据内容为预定信息内容,则抓取所述数据内容;
    将抓取的数据内容作为所述天气数据保存到本地。
  11. 如权利要求9所述的计算机装置,其特征在于,假设t+1时刻的数据x t+1发生缺失,则所述利用ElasticNet算法进行回归拟合,填补所述缺失值包括:
    选取t+1时刻之前的24个时刻t-i,i=0,1,2,…,23,选取时间窗大小w,对于所述24个时刻中的每一个时刻t-i,得到一组数据集[x t-i-w,x t-i-w+1,…,x t-i-1],即得到24组数据集:
    [x t-w,x t-w+1,…,x t-1],
    [x t-w-1,x t-w,…,x t-2],
    [x t-w-2,x t-w-1,…,x t-3],
    [x t-w-23,x 1,…,x t-24];
    以所述24组数据集作为训练数据,对训练数据进行划分,每一组最后一个数组成集合y,每一组最后一个数以外的其他数组成集合x,集合x为:
    [[x t-w,x t-w+1,…,x t-2],
    [x t-w-1,x t-w,…,x t-3],
    [x t-w-2,x t-w-1,…,x t-4],
    [x t-w-23,x 1,…,x t-25]],
    集合y为:
    [[x t-1],[x t-2],[x t-3],…,[x t-24]];
    将训练数据的x值和y值输入ElasticNet模型中,用每一组的x值去拟合y值,训练ElasticNet模型;
    以[x t-w+1,x t-w+1,…,x t]作为输入数据输入到训练好的ElasticNet模型中,得到ElasticNet模型输出的一个值,将该值作为缺失的x t+1
  12. 如权利要求9所述的计算机装置,其特征在于,设天气数据为X=[x 0,x 1,x 2,…,x t′],所述利用Moving-zscore算法检测所述天气数据中的异常值包括:
    (1)选取时间窗大小w′,针对时间点w′至时间点t′中的每个时间点 i′,i′=w′,w′+1,…,t′,计算所述时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,所述时间点i′对应的时间窗的长度为w′;
    (2)根据每个时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,计算所述时间点i′对应的天气数据x i′的mz值mz i′,得到mz列表:
    [mz w′,mz w′+1,mz w′+2,…,mz t′],
    其中:
    Figure PCTCN2018099549-appb-100002
    (3)求mz列表的第α分位数作为阈值,得到mz α_percentage,α为预设值;
    (4)如果mz i′大于mz α_percentage,则对应第i′时刻的天气数据x i′为异常值。
  13. 如权利要求9-12中任一项所述的计算机装置,其特征在于,所述天气数据包括湿度、气温、气压、降水量、水汽压、风速、风向、日照时数。
  14. 如权利要求9-12中任一项所述的计算机装置,其特征在于,所述解析所述天气数据中的缺失值包括:
    将所述天气数据处理成行标签为时间信息、列标签为天气信息的矩阵;
    判断所述矩阵中是否存在列信息字段为空的数据;
    若所述矩阵中存在列信息字段为空的数据,则该列信息字段为空的数据为所述天气数据中的缺失值。
  15. 一种非易失性可读存储介质,所述非易失性可读存储介质上存储有至少一条计算机可读指令,其特征在于,所述至少一条计算机可读指令被处理器执行时实现以下步骤:
    从网页中抓取天气数据;
    解析所述天气数据中的缺失值;
    利用ElasticNet算法进行回归拟合,填补所述缺失值;
    利用Moving-zscore算法检测所述天气数据中的异常值,剔除所述异常值;
    利用ElasticNet算法进行回归拟合,填补剔除的所述异常值。
  16. 如权利要求15所述的存储介质,其特征在于,所述从网页中抓取天气数据包括:
    生成面向天气信息网站的API接口的种子URL以及后续的URL;
    向所述天气信息网站的API接口发送HTTP请求,请求访问所述API接口;
    对所述天气信息网站提供的数据内容进行分析和识别,以查看所述数据内容;
    判断所述数据内容是否为预定信息内容;
    若所述数据内容为预定信息内容,则抓取所述数据内容;
    将抓取的数据内容作为所述天气数据保存到本地。
  17. 如权利要求15所述的存储介质,其特征在于,假设t+1时刻的数据x t+1发生缺失,则所述利用ElasticNet算法进行回归拟合,填补所述缺失值包括:
    选取t+1时刻之前的24个时刻t-i,i=0,1,2,…,23,选取时间窗大小w,对于所述24个时刻中的每一个时刻t-i,得到一组数据集 [x t-i-w,x t-i-w+1,…,x t-i-1],即得到24组数据集:
    [x t-w,x t-w+1,…,x t-1],
    [x t-w-1,x t-w,…,x t-2],
    [x t-w-2,x t-w-1,…,x t-3],
    [x t-w-23,x 1,…,x t-24];
    以所述24组数据集作为训练数据,对训练数据进行划分,每一组最后一个数组成集合y,每一组最后一个数以外的其他数组成集合x,集合x为:
    [[x t-w,x t-w+1,…,x t-2],
    [x t-w-1,x t-w,…,x t-3],
    [x t-w-2,x t-w-1,…,x t-4],
    [x t-w-23,x 1,…,x t-25]],
    集合y为:
    [[x t-1],[x t-2],[x t-3],…,[x t-24]];
    将训练数据的x值和y值输入ElasticNet模型中,用每一组的x值去拟合y值,训练ElasticNet模型;
    以[x t-w+1,x t-w+1,…,x t]作为输入数据输入到训练好的ElasticNet模型中,得到ElasticNet模型输出的一个值,将该值作为缺失的x t+1
  18. 如权利要求15所述的存储介质,其特征在于,设天气数据为X=[x 0,x 1,x 2,…,x t′],所述利用Moving-zscore算法检测所述天气数据中的异常值包括:
    (1)选取时间窗大小w′,针对时间点w′至时间点t′中的每个时间点i′,i′=w′,w′+1,…,t′,计算所述时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,所述时间点i′对应的时间窗的长度为w′;
    (2)根据每个时间点i′对应的时间窗内天气数据的均值μ i′和标准差σ i′,计算所述时间点i′对应的天气数据x i′的mz值mz i′,得到mz列表:
    [mz w′,mz w′+1,mz w′+2,…,mz t′],
    其中:
    Figure PCTCN2018099549-appb-100003
    (3)求mz列表的第α分位数作为阈值,得到mz α_percentage,α为预设值;
    (4)如果mz i′大于mz α_percentage,则对应第i′时刻的天气数据x i′为异常值。
  19. 如权利要求15-18中任一项所述的存储介质,其特征在于,所述天气数据包括湿度、气温、气压、降水量、水汽压、风速、风向、日照时数。
  20. 如权利要求15-18中任一项所述的存储介质,其特征在于,所述解析所述天气数据中的缺失值包括:
    将所述天气数据处理成行标签为时间信息、列标签为天气信息的矩阵;
    判断所述矩阵中是否存在列信息字段为空的数据;
    若所述矩阵中存在列信息字段为空的数据,则该列信息字段为空的数据 为所述天气数据中的缺失值。
PCT/CN2018/099549 2018-04-11 2018-08-09 天气数据获取方法及装置、计算机装置及可读存储介质 WO2019196278A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810322422.9 2018-04-11
CN201810322422.9A CN108563739B (zh) 2018-04-11 2018-04-11 天气数据获取方法及装置、计算机装置及可读存储介质

Publications (1)

Publication Number Publication Date
WO2019196278A1 true WO2019196278A1 (zh) 2019-10-17

Family

ID=63534572

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/099549 WO2019196278A1 (zh) 2018-04-11 2018-08-09 天气数据获取方法及装置、计算机装置及可读存储介质

Country Status (2)

Country Link
CN (1) CN108563739B (zh)
WO (1) WO2019196278A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111583133A (zh) * 2020-04-20 2020-08-25 国家卫星气象中心(国家空间天气监测预警中心) 一种自适应遥感图像像元缺值填补方法、装置、设备及介质
CN113268921A (zh) * 2021-05-13 2021-08-17 西安交通大学 凝汽器清洁系数预估方法、***、电子设备及可读存储介质
CN116362915A (zh) * 2023-05-31 2023-06-30 深圳市峰和数智科技有限公司 一种光伏电站气象数据补齐方法、装置及相关设备
CN116452369A (zh) * 2023-06-19 2023-07-18 深圳市峰和数智科技有限公司 一种光伏电站实时数据补齐方法、装置及相关设备

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109922515B (zh) * 2019-02-27 2022-03-18 努比亚技术有限公司 移动终端驻网的方法、移动终端和存储介质
CN111046027B (zh) * 2019-11-25 2023-07-25 北京百度网讯科技有限公司 时间序列数据的缺失值填充方法和装置
CN111339392B (zh) * 2020-03-27 2023-02-03 中国科学院大气物理研究所 一种基于气象要素的天空蓝指数确定方法及***
JP7472998B2 (ja) 2020-10-07 2024-04-23 日本電信電話株式会社 パラメータ推定装置、秘密パラメータ推定システム、秘密計算装置、それらの方法、およびプログラム
CN112580880B (zh) * 2020-12-23 2023-12-19 中国交通信息科技集团有限公司 一种容量预测方法、计算机处理器以及终端设备
CN114078126B (zh) * 2022-01-19 2022-04-26 江苏金恒信息科技股份有限公司 一种基于机器学习的废钢评级方法及装置
CN115359684A (zh) * 2022-08-16 2022-11-18 辽宁工程技术大学 一种基于Elastic-BiGRU结构的航空器轨迹预测方法
CN116432871A (zh) * 2023-06-13 2023-07-14 北京化工大学 一种基于AdaBoost算法的公交调度优化方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874651A (zh) * 2017-01-12 2017-06-20 天津大学 基于局部加权回归的室内空气数据预处理方法
CN106950614A (zh) * 2017-02-28 2017-07-14 中船重工鹏力(南京)大气海洋信息***有限公司 一种区域自动气象站小时雨量数据质量控制方法
CN107480341A (zh) * 2017-07-21 2017-12-15 河海大学 一种基于深度学习的大坝安全综合评判方法
CN107729678A (zh) * 2017-11-02 2018-02-23 中国科学院数学与***科学研究院 一种卫星太阳电池在轨运行剩余寿命的建模与分析方法
CN107783177A (zh) * 2016-08-25 2018-03-09 中国科学院遥感与数字地球研究所 一种用于地震监测的逐日亮温异常回归分析方法

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3860496B2 (ja) * 2002-03-28 2006-12-20 富士通株式会社 配車方法、および配車プログラム
CN102750363B (zh) * 2012-06-13 2014-10-29 天津市规划信息中心 一种城市地理信息数据仓库的构建方法
FR3019295B1 (fr) * 2014-03-27 2016-03-18 Snecma Procede d'estimation du caractere normal ou non d'une valeur mesuree d'un parametre physique d'un moteur d'aeronef
CN106548285B (zh) * 2016-11-04 2020-11-03 广西电网有限责任公司电力科学研究院 计及小水电出力的趸售电量预测方法
CN106779226B (zh) * 2016-12-23 2020-09-29 东北大学 一种基于混核机器学习的风机批功率预测方法
CN107862409B (zh) * 2017-11-06 2021-11-02 重庆大学 一种基于回归分析的变电站输变电设备大量缺失数据填补方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107783177A (zh) * 2016-08-25 2018-03-09 中国科学院遥感与数字地球研究所 一种用于地震监测的逐日亮温异常回归分析方法
CN106874651A (zh) * 2017-01-12 2017-06-20 天津大学 基于局部加权回归的室内空气数据预处理方法
CN106950614A (zh) * 2017-02-28 2017-07-14 中船重工鹏力(南京)大气海洋信息***有限公司 一种区域自动气象站小时雨量数据质量控制方法
CN107480341A (zh) * 2017-07-21 2017-12-15 河海大学 一种基于深度学习的大坝安全综合评判方法
CN107729678A (zh) * 2017-11-02 2018-02-23 中国科学院数学与***科学研究院 一种卫星太阳电池在轨运行剩余寿命的建模与分析方法

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111583133A (zh) * 2020-04-20 2020-08-25 国家卫星气象中心(国家空间天气监测预警中心) 一种自适应遥感图像像元缺值填补方法、装置、设备及介质
CN111583133B (zh) * 2020-04-20 2023-04-07 国家卫星气象中心(国家空间天气监测预警中心) 一种自适应遥感图像像元缺值填补方法、装置、设备及介质
CN113268921A (zh) * 2021-05-13 2021-08-17 西安交通大学 凝汽器清洁系数预估方法、***、电子设备及可读存储介质
CN113268921B (zh) * 2021-05-13 2022-12-09 西安交通大学 凝汽器清洁系数预估方法、***、电子设备及可读存储介质
CN116362915A (zh) * 2023-05-31 2023-06-30 深圳市峰和数智科技有限公司 一种光伏电站气象数据补齐方法、装置及相关设备
CN116362915B (zh) * 2023-05-31 2023-08-15 深圳市峰和数智科技有限公司 一种光伏电站气象数据补齐方法、装置及相关设备
CN116452369A (zh) * 2023-06-19 2023-07-18 深圳市峰和数智科技有限公司 一种光伏电站实时数据补齐方法、装置及相关设备
CN116452369B (zh) * 2023-06-19 2023-08-29 深圳市峰和数智科技有限公司 一种光伏电站实时数据补齐方法、装置及相关设备

Also Published As

Publication number Publication date
CN108563739A (zh) 2018-09-21
CN108563739B (zh) 2021-05-04

Similar Documents

Publication Publication Date Title
WO2019196278A1 (zh) 天气数据获取方法及装置、计算机装置及可读存储介质
JP2020527788A (ja) 疾患予測方法および装置、コンピューター装置及び可読記憶媒体
US10936906B2 (en) Training data acquisition method and device, server and storage medium
WO2020252917A1 (zh) 一种模糊人脸图像识别方法、装置、终端设备及介质
CN110598620B (zh) 基于深度神经网络模型的推荐方法和装置
CN110806954A (zh) 评估云主机资源的方法、装置、设备及存储介质
WO2021098831A1 (zh) 一种适用于嵌入式设备的目标检测***
CN113919443B (zh) 一种基于图像分析烟叶成熟度状态概率计算方法
US20170185913A1 (en) System and method for comparing training data with test data
CN111050280B (zh) 一种考勤定位判定方法、考勤方法与***及移动终端
WO2019214142A1 (zh) 电子装置、基于研报数据的预测方法、程序和计算机存储介质
CN109543117B (zh) 基于智能推荐的服务推送方法及终端设备
WO2019109798A1 (zh) 资源加载的方法、装置、终端及存储介质
CN109754077B (zh) 深度神经网络的网络模型压缩方法、装置及计算机设备
US20190340514A1 (en) System and method for generating ultimate reason codes for computer models
CN114492576A (zh) 一种异常用户检测方法、***、存储介质及电子设备
CN117196322B (zh) 智能风控方法、装置、计算机设备及存储介质
US20210042582A1 (en) System and method for monitoring health of crop to validate crop insurance claim
CN115309638A (zh) 协助模型优化的方法及装置
CN115879002A (zh) 一种训练样本生成方法、模型训练方法及装置
CN113569879B (zh) 异常识别模型的训练方法、异常账号识别方法及相关装置
CN111209414B (zh) 基于影像资料调用业务场景实现资料冷热分离存储的方法
CN109117873A (zh) 一种基于贝叶斯分类算法的用户行为分析方法
KR102244705B1 (ko) 학습데이터 생성을 위한 크라우드소싱 기반 유사 프로젝트의 작업 단가 역전 조정을 통한 작업자 유입 조절 방법
CN107729476A (zh) 一种机器数据在线处理方法及***

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18914055

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18914055

Country of ref document: EP

Kind code of ref document: A1