WO2019109798A1 - 资源加载的方法、装置、终端及存储介质 - Google Patents

资源加载的方法、装置、终端及存储介质 Download PDF

Info

Publication number
WO2019109798A1
WO2019109798A1 PCT/CN2018/116248 CN2018116248W WO2019109798A1 WO 2019109798 A1 WO2019109798 A1 WO 2019109798A1 CN 2018116248 W CN2018116248 W CN 2018116248W WO 2019109798 A1 WO2019109798 A1 WO 2019109798A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
url address
data
preset
sample
Prior art date
Application number
PCT/CN2018/116248
Other languages
English (en)
French (fr)
Inventor
陈岩
刘耀勇
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019109798A1 publication Critical patent/WO2019109798A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/147Network analysis or design for predicting network behaviour
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Definitions

  • the embodiments of the present application relate to the field of Internet technologies, and in particular, to a resource loading method, apparatus, terminal, and storage medium.
  • the client has the function of loading web resources according to a Uniform Resource Locator (URL) address.
  • URL Uniform Resource Locator
  • the client When the client needs to load the webpage resource, the client first generates a resource loading request, where the resource loading request carries a URL address; after receiving the resource loading request, the operating system loads the URL address through a communication connection with the URL address. Web resources; then, the operating system feeds back the web resources loaded to the client.
  • the resource loading method, device, terminal, and storage medium provided by the embodiments of the present application can solve the problem that the resource loading delay is large.
  • the technical solution is as follows:
  • a resource loading method comprising:
  • the state data is used to indicate an operating state of the operating system
  • the webpage resource is fed back to the client.
  • a resource loading device comprising:
  • a data obtaining unit configured to acquire state data, where the state data is used to indicate an operating state of the operating system
  • An address prediction unit configured to input the state data into a prediction model, to obtain a predicted uniform resource locator URL address, where the prediction model is determined according to sample state data and a sample URL address;
  • a resource storage unit configured to store the webpage resource stored by the predicted URL address into a preset space
  • a resource detecting unit configured to detect, when receiving a resource loading request generated by the client, whether the preset space stores the webpage resource requested by the resource loading request;
  • the resource feedback unit is configured to feed back the webpage resource to the client when the preset web space is requested by the resource loading request.
  • a terminal comprising a processor, a memory coupled to the processor, and program instructions stored on the memory, the processor implementing the program instructions to implement the present application
  • the resource loading method provided in the embodiment.
  • a computer readable storage medium having program instructions stored thereon, the program instructions being executed by a processor to implement the resource loading method provided in the embodiments of the present application.
  • FIG. 1 is a schematic structural diagram of a resource loading system according to an exemplary embodiment of the present application
  • FIG. 2 is a flowchart of a resource loading method provided by an exemplary embodiment of the present application.
  • FIG. 3 is a schematic diagram of a sample library provided by an exemplary embodiment of the present application.
  • FIG. 4 is a schematic diagram of a predicted URL address provided by an exemplary embodiment of the present application.
  • FIG. 5 is a schematic diagram of a predicted URL address provided by another exemplary embodiment of the present application.
  • FIG. 6 is a schematic diagram of a resource loading process provided by an exemplary embodiment of the present application.
  • FIG. 7 is a flowchart of a predictive model training process provided by an exemplary embodiment of the present application.
  • FIG. 8 is a structural block diagram of a resource loading apparatus according to an exemplary embodiment of the present application.
  • FIG. 9 is a structural block diagram of a resource loading apparatus according to another exemplary embodiment of the present application.
  • FIG. 10 is a structural block diagram of a terminal according to an embodiment of the present application.
  • Predictive Model A mathematical model used to predict URL addresses based on input data.
  • the predictive model is determined based on sample state data and sample URL addresses.
  • the sample URL address refers to the URL address of the historical access in the terminal.
  • the sample status data refers to the status data obtained when accessing the sample URL address.
  • sample status data and the sample URL address are stored in a sample library.
  • the sample library includes at least one set of samples, each set of samples including sample state data and sample URL addresses collected simultaneously.
  • the status data is used to indicate the operating status of the operating system.
  • the status data includes, but is not limited to, at least one of the following:
  • Data used to indicate whether to access the wireless network such as: 1 indicates that the operating system accesses the wireless network, and 0 indicates that the operating system is not connected to the wireless network.
  • Data used to indicate whether to access the wireless network such as: 1 indicates that the operating system accesses the wireless network, and 0 indicates that the operating system is not connected to the wireless network.
  • other data may also indicate whether to access data of the wireless network, which is not limited in this application.
  • Data used to represent applications running in the foreground such as: 1 for xx browsers, 2 for xx social applications, 3 for xx shopping applications, and so on.
  • the application may also be represented by other data, which is not limited in this application.
  • the data used to indicate the time period in which the current time is located for example, dividing the 24 hours of the day into 10 segments every 10 minutes, then obtaining 144 time segments, where i indicates that the current time period is the i-th
  • the time period, 1 ⁇ i ⁇ 144, i is an integer.
  • the time period may be divided according to other manners, and the durations of the different time periods may be the same or different, which is not limited in this implementation.
  • Data used to indicate whether the battery is in a charging state such as: 1 indicates that the battery is in a charging state, and 0 indicates that the battery is not in a charging state.
  • Data used to indicate the remaining capacity of the battery for example, the remaining power is expressed in percent, and any value in 1-100 is the remaining battery data.
  • the format of the status data is the format of the data of the input prediction model.
  • the status data is in the form of a vector.
  • the terminal stores an access record of the user access URL, and the terminal generates a sample according to the access record.
  • the access records stored in the terminal are shown in Table 1 below:
  • the access record of the user access URL stores a record for accessing the URL within the most recent preset time period.
  • the most recent preset duration is the last two weeks, the most recent one month, the last half year, and the like, which is not limited by the embodiment of the present application.
  • the terminal in combination with the access record shown in Table 1 above, the terminal generates a sample according to the access record described in Table 1 above. Schematically, the sample generated by the terminal is shown in Table 2 below:
  • Each application in the terminal is numbered, for example, the number of program A in Table 1 is 0, the number of program B is 1, and the number of program C is 2.
  • the URLs accessed by each terminal are numbered, and the maximum label value of the URL depends on the total number of URLs accessed in Table 1.
  • the data starting from the first row, the first column to the first row and the sixth column in the above table 2 can be used as a matrix, and the matrix is used to represent the sample.
  • the predictive model includes, but is not limited to, at least one of a Logistic Regression (LR) model and a Bayesian model.
  • LR Logistic Regression
  • Logistic regression model refers to a model built on a linear regression based on a logic function.
  • a logistic regression model is used to classify state data and URL addresses.
  • the Bayesian model is a time series prediction model with dynamic models as the research object.
  • the Bayesian model is used to predict the probability that a URL address is accessed.
  • Bayesian model is represented by the following mathematical model:
  • N(A) is the total number of state data A included in the sample library
  • N(B) is the total number of state data B included in the sample library
  • N(X) is the total number of state data X included in the sample library.
  • N is the number of groups of samples in the sample library, and each group of samples includes sample state data and sample URL addresses collected at the same time.
  • N(A, J) is the total number of groups in which the sample state data is A and the sample load address is J
  • N(B, J) is the sample state data of the same set of samples in the same set of samples, and the sample load address is J.
  • the total number of groups...N(X,J) is the total number of groups in which the sample state data is X and the sample load address is J in the same set of samples.
  • N(J) is the number of times the URL address in the sample library is J.
  • the prediction model can also be other models, such as: Deep Neural Network (DNN) model, Recurrent Neural Networks (RNN) model, embedding model, Gradient Boosting Decision Tree, GBDT) model, etc., this embodiment will not be enumerated here.
  • DNN Deep Neural Network
  • RNN Recurrent Neural Networks
  • embedding model Gradient Boosting Decision Tree, GBDT
  • the DNN model is a deep neural network model.
  • the DNN model includes an input layer, at least one hidden layer (or intermediate layer), and an output layer.
  • the input layer, the at least one hidden layer, and the output layer each include at least one neuron for processing the received data.
  • the number of neurons between different layers may be the same; or it may be different.
  • the RNN model is a neural network with a feedback structure.
  • the output of the neuron can be directly applied to itself at the next timestamp, ie, the input of the i-th layer neuron at time m, in addition to the output of the (i-1) layer neuron at that time, Its own output at time (m-1).
  • the embedding model is based on entity and relational distributed vector representations, and the relationship in each triple instance is treated as a translation from the entity header to the entity tail.
  • the instance of the triple includes the subject, the relationship, and the object, and the instance of the triple can be represented as (subject, relationship, object); the subject is the entity header, and the object is the entity tail.
  • Xiao Ming s father is Daming, and he is represented by a triad instance (Xiao Ming, Dad, Daming).
  • the GBDT model is an iterative decision tree algorithm consisting of multiple decision trees, and the results of all trees are added together as the final result.
  • Each node of the decision tree gets a predicted value, taking the age as an example.
  • the predicted value is the average of the ages of all the people belonging to the node corresponding to the age.
  • FIG. 1 is a schematic structural diagram of a resource loading system shown in an exemplary embodiment of the present application, the system including at least one terminal 110 and a server 120.
  • the terminal 110 has a communication function, and the terminal 110 includes, but is not limited to, at least one of a mobile phone, a tablet computer, a wearable device, an intelligent robot, a smart home device, a laptop portable computer, and a desktop computer.
  • An operating system 111 and a client 112 are installed in the terminal 110.
  • the operating system 111 includes, but is not limited to, any one of an IOS (iPhone OS) system, an Android (Android) system, and a window system.
  • IOS iPhone OS
  • Android Android
  • window system any one of an IOS (iPhone OS) system, an Android (Android) system, and a window system.
  • the client 112 When the client 112 needs to access the webpage resource, the client 112 generates a resource loading request, and the resource loading request carries the URL address of the webpage resource. Correspondingly, when receiving the resource loading request, the operating system 111 can load the corresponding webpage resource according to the URL address, and then feed back the webpage resource to the client.
  • the operating system 111 may also acquire state data of the current running state when the client requests access to the URL address, and store the state data and the URL address into the sample library.
  • the operating system 111 can also predict the URL address that the client 112 will access, and pre-store the webpage resource stored by the URL address from the server 120 to the preset space.
  • the terminal 110 is connected to the server 120 via a wireless network or a wired network.
  • the server 120 can be a separate server host; or it can be a server cluster composed of multiple server hosts.
  • the server 120 may be a physical server or a virtual cloud server.
  • the server 120 is configured to provide a webpage resource corresponding to the URL address requested by the client 112.
  • different URL addresses point to the same server 120; alternatively, different URL addresses point to different servers 120.
  • the number of the foregoing terminals 110 may be at least one, and the number of the servers 120 may be at least one, which is not limited in this embodiment.
  • a wireless network or a wired network uses standard communication techniques and/or protocols.
  • the network is usually the Internet, but can also be any network, including but not limited to a Local Area Network (LAN), a Metropolitan Area Network (MAN), a Wide Area Network (WAN), a mobile, a wired or a wireless. Any combination of networks, private networks, or virtual private networks).
  • data exchanged over a network is represented using techniques and/or formats including HyperText Mark-up Language (HTML), Extensible Markup Language (XML), and the like.
  • HTTP HyperText Mark-up Language
  • XML Extensible Markup Language
  • you can use such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), and Internet Protocol Security (IPsec).
  • Regular encryption techniques are used to encrypt all or some of the links.
  • the above described data communication techniques may also be replaced or supplemented using custom and/or dedicated data communication techniques.
  • the execution body of each step in the application is an operating system in the terminal, and the operating system may be the operating system 111 in the resource loading system shown in FIG. 1.
  • the resource loading method includes the following steps.
  • Step 201 Acquire status data, which is used to indicate an operating status of the operating system.
  • the operating system collects basic data every first preset duration, and preprocesses the basic data to obtain status data.
  • the first preset duration is set by the operating system by default; or the first preset duration is received by the operating system through the human-computer interaction interface.
  • the value of the first preset duration is not limited. Schematically, the first preset duration is 1 minute.
  • the operating system collects basic data when the client starts running in the foreground, and preprocesses the basic data to obtain status data.
  • the operating system collects basic data every second preset duration when the current time is within the preset time period, and preprocesses the basic data to obtain status data.
  • the preset time period is set by the operating system by default; or it is received by the operating system through the human-computer interaction interface. For example, during the user's sleep period (23:00 ⁇ 6:00), the user usually does not need to access the URL address through the client. At this time, the time period from 23:00 to 6:00 can be set as the preset time period. .
  • the second preset duration is set by the operating system by default; or the first preset duration is received by the operating system through the human-computer interaction interface.
  • the second preset duration may be the same as the first preset duration; or the second preset duration may be different from the first preset duration. This embodiment does not limit the value of the second preset duration. Schematically, the second preset duration is 1 minute.
  • pre-processing the underlying data refers to converting the format of the underlying data into a format of the data of the input predictive model.
  • the underlying data is unprocessed data that the operating system directly obtains from the currently running components.
  • the basic data includes, but is not limited to, the following: the program identifier of the application running in the foreground of the operating system, the current time, whether the charging circuit of the battery is activated, the remaining power of the battery, and the type of the network accessed by the operating system. At least one.
  • the program identifier may be the name of the application, the package name of the application, the icon information of the application, and the like, which is not limited in this embodiment.
  • the pre-processing the program identifier includes: converting the program identifier into the first state data according to the correspondence between the program identifier and the first state data.
  • the first status data refers to status data obtained after the program identification is converted, and the first status data is data indicating an application running in the foreground.
  • the program identifier is xx browser, the converted first state data is 1; the program identifier is xx social application, the converted first state data is 2; the program identifier is xx shopping application, and the converted first state data is Is 3.
  • the pre-processing the current time includes: determining which time period the current time belongs to, and converting the current time into the second state data according to the determination result.
  • the second status data refers to status data obtained after the current time is converted, and the second status data is data indicating the time period in which the current time is located. For example, if the 24 hours of the day are divided into 10 segments every 10 minutes, then 144 time segments are obtained, where i indicates that the current time period is the i-th time segment, 1 ⁇ i ⁇ 144, and i is an integer. . If the current time is 10:09, the time period belongs to the 60th time period, and the second status data is 60.
  • the pre-processing the current time further includes: detecting whether the current time belongs to the working time period, and converting the current time into the third status data according to the detection result.
  • the third state data refers to state data obtained after the current time conversion, and the third state data is data indicating whether the current time belongs to the working time period.
  • the working time period is set by the operating system by default; or, the working time period is received by the operating system through the human-computer interaction interface. For example, the working time is from 9:00 to 12:00 and 13:00 to 18:00 from Monday to Friday, and the current time is 10:29 on Thursday.
  • the current time belongs to the working time period, and the third status data. It is 1; if the current time is 10:29 on Saturday, the current time does not belong to the working time period, and the third status data is 0.
  • pre-processing the current time further includes: detecting whether the current time belongs to the rest time period, and converting the current time into the fourth status data according to the detection result.
  • the fourth state data refers to state data obtained after the current time conversion, and the fourth state data is data indicating whether the current time belongs to the rest period.
  • the rest period is set by the operating system by default; or, the rest period is received by the operating system through the human-computer interface.
  • the break period is Monday to Friday 00:00-9:00, 12:00-13:00, 18:00-00:00, Saturday and Sunday, and the current time is Thursday's 10: 29, the current time does not belong to the rest period, the fourth status data is 0; if the current time is 10:29 on Saturday, the current time belongs to the rest period, and the fourth status data is 1.
  • pre-processing whether the charging circuit of the battery is started includes: if the charging circuit of the battery is activated, determining that the battery is in a charging state, and determining the charging state as the fifth state data. Quantitative representation; if the charging circuit of the battery is not activated, it is determined that the battery is in an uncharged state, and the uncharged state is quantized in the fifth state data.
  • the fifth status data is data indicating whether or not the battery is in a charged state. For example, if the battery is in the charging state, the fifth state data is 1; when the battery is in the uncharged state, the fifth state data is 0.
  • pre-processing the remaining power includes: expressing the remaining power in a percentage index to obtain sixth state data.
  • the sixth state data is data indicating the remaining battery power. For example, when the remaining half of the battery is charged, the sixth status data is 50.
  • pre-processing the type of the network accessed by the operating system includes: quantizing the type of the network accessed by the operating system by the seventh state data.
  • the seventh status data is data indicating whether the operating system accesses the wireless network. For example, if the type of the network accessed by the operating system is a wireless network, the seventh status data is 1; if the type of the network accessed by the operating system is a data network, the seventh status data is 0.
  • step 202 the state data is input into the prediction model to obtain a predicted URL address.
  • the prediction model is determined based on sample status data and sample URL addresses.
  • the operating system locally stores a sample library, the sample library includes at least one set of samples, and each set of samples includes sample state data and sample URL addresses collected at the same time.
  • sample state data and sample URL addresses belonging to the same row in the sample library are a set of samples.
  • a predictive model for the logistic regression model as an example, if the status data includes data relevant to the current time represented by time period x 1, the data representing the current time belongs to the working time period x 2, indicating whether the state of charge of the battery is data x 3, indicating whether the wireless network access data x 4 and data applications running at the representation x 5; then x 1, x 2, x 3 , x 4 and x 5 input logic regression model, through logistic regression After the model is processed, the predicted URL address is obtained.
  • the number of predicted URL addresses output by each logistic regression model is one, and the predictive model may include multiple logistic regression models to obtain multiple predicted URL addresses.
  • a Bayesian model to predict the model as an example, if the status data includes data relevant to the current time represented by time period x 1, the data representing the current time belongs to the working time period x 2, indicating whether the battery is charging state data x 3, indicating whether the wireless network access data x 4 and data applications running at the representation x 5; then x 1, x 2, x 3 , x 4 and x 5 input Bayesian model, the After the Bayesian model is processed, the predicted URL address is obtained.
  • each Bayesian model may obtain a probability that each sample URL address in the sample library is accessed, and the predicted URL address obtained by the Bayesian model may be a sample URL address whose probability ranks in the top n bits.
  • n may be 10, 8, or the like.
  • Step 203 Store the webpage resource stored in the predicted URL address into the preset space.
  • the webpage resource stored by the predicted URL address is stored in the preset space in the form of a file. That is, a file is set in the operating system, and the file is used to record the storage address of the web resource.
  • the correspondence between the predicted URL address and the storage address of the webpage resource is recorded in the file.
  • the preset space is a space indicated by the file, and the space is a cache space.
  • the space size of the preset space may be preset, for example, the space size of the preset space is 120M.
  • the preset space is cleared; or when the stored time of the network resource stored in the preset space reaches a preset duration, Clear network resources that reach the preset duration.
  • the network resource is emptied according to the size of the resource stored in the preset space.
  • the preset size is 100M.
  • the preset space stores the resource 1, the resource 2, and the resource 3.
  • the three resources are stored.
  • the total size is 88M, and the size of the resource 4 is 20M.
  • the resource 4 needs to be stored in the preset space, after the resource 4 is stored in the preset space, when the next resource needs to be stored in the preset space, the resource 1 is The resource 4 is emptied from the preset space, and the resource 4 is stored in the preset space before the resource 4 is stored in the preset space. After the resource size in the preset space exceeds the preset size, the resource 1 and the resource 2 are cleared. And after the resource 3, the resource 4 is stored to the preset space.
  • Step 204 When receiving the resource loading request generated by the client, detecting whether the preset space stores the webpage resource requested by the resource loading request.
  • the client generates a resource loading request when receiving the URL address input by the user through the human-computer interaction interface, and the operating system receives the resource loading request; or the client receives the URL address through the human-computer interaction interface.
  • a resource load request is generated when the operation is triggered, and the operating system receives the resource load request.
  • the client is an application running in the foreground.
  • the operating system invokes a URL connection component in the operating system; and the URL connection component detects whether the preset space includes the webpage resource requested by the resource loading request.
  • the URL connection component has a function of establishing a communication connection with the URL address carried by the resource loading request.
  • the URL connection component is an object pre-created by the operating system, and is used to represent a communication connection between the application and the URL address.
  • the URL connection component is illustratively a URL Connection object in the operating system.
  • the method further includes detecting whether the preset space stores the resource loading request.
  • the function of the requested web resource does not require the operating system to create additional components, saving the resources of the operating system.
  • step 205 when detecting that the preset space stores the webpage resource requested by the resource loading request, step 205 is performed; when detecting that the preset space does not store the webpage resource requested by the resource loading request, the URL connection component is established by using the URL connection component. A communication connection with the URL address, and the webpage resource stored by the URL address is fed back to the client.
  • Step 205 When the preset space stores the webpage resource requested by the resource loading request, the webpage resource is fed back to the client.
  • the operating system passes the webpage resource from the URL connection component to the process corresponding to the client.
  • the client generates a resource loading request, and the resource loading request carries a URL address.
  • the operating system invokes the URL connection component to detect whether the preset space stores the webpage resource corresponding to the URL address.
  • the webpage resource is fed back to the client.
  • the webpage resource corresponding to the predicted URL address obtained by the operating system through the prediction model is stored in the preset space.
  • the resource loading method stores the webpage resource stored in the URL address in advance by predicting a URL address that each client may access by receiving a resource loading request sent by the client.
  • the operating system can directly feed the locally stored webpage resource to the client without downloading the webpage resource from the server indicated by the URL address.
  • the problem that the loading efficiency of the webpage resource is low when the network condition between the operating system and the URL address is poor is avoided; since the efficiency of loading the locally stored webpage resource by the client is high, the client can improve the loading of the webpage resource. s efficiency.
  • the logistic regression model or the Bayesian model is based on the user history to access the URL address, the state data of the operating system is established. Therefore, the logistic regression model or the Bayesian model is used to predict the current state data of the operating system.
  • the URL address that each client may access and the predicted URL address obtained are the URL addresses that the user needs to access. Therefore, the accuracy of the operating system to predict the URL address can be improved.
  • the operating system does not need to additionally create a new component to detect the webpage resource, thereby saving the consumption of the operating system. Resources.
  • the detecting whether the preset space stores the webpage resource requested by the resource loading request includes:
  • the URL connection component having a function of establishing a communication connection with a URL address carried by the resource loading request;
  • the prediction model is a logistic regression model, where the logistic regression model is used to classify state data and a URL address; the method further includes:
  • the prediction model is used to predict a corresponding predicted URL address based on the subsequently acquired state data.
  • the prediction model is a Bayesian model; the Bayesian model is used to predict a probability that a URL address is accessed; the method further includes:
  • the obtained status data predicts the corresponding predicted URL address.
  • the sample URL address is a URL address whose access duration is greater than a preset duration; and/or the sample URL address is a URL address whose access times are greater than a preset number of times.
  • the status data includes at least one of the following data:
  • the method further includes:
  • the method further includes:
  • the preset space is cleared
  • the network resource that reaches the preset duration is cleared.
  • the obtaining status data includes:
  • the format of the basic data is converted into a format of data of the input prediction model to obtain the status data.
  • the executor of each step may be a URL connection component in the operating system; or may be other components created in the operating system, which is not limited in this embodiment.
  • the webpage resource may be parsed to obtain the associated URL address, where the associated URL address refers to the predicted URL address.
  • Other URL addresses of the link store other webpage resources stored in the associated URL address to the preset space.
  • the webpage resource stored in the predicted URL address is a news webpage resource
  • the news webpage resource includes an associated URL address of at least one news
  • the webpage resource stored by the associated URL address may be a webpage resource that the user actually wants to access, and therefore, the operating system
  • the webpage resource stored by the associated URL address is also stored in the preset space.
  • the webpage resource corresponding to the associated URL address is stored in the preset space in the form of a file.
  • the associated URL may be included, and the user accesses the webpage resource by using the webpage resource stored in the associated URL address. Improve the efficiency of the web page resource that the client loads the associated URL address.
  • the preset space only saves the webpage resource of the predicted URL address predicted by the prediction model last time; or the preset space only saves the webpage resource of the predicted URL address predicted by the prediction model last time and the webpage
  • the web resource of the associated URL address in the resource Since the predicted URL address that was last predicted is determined based on the latest state data of the operating system, the accuracy of the predicted URL address is high. In this way, the probability that the webpage resource stored by the operating system is the webpage resource that the user desires to access is increased, and the storage resource can also be saved.
  • the operating system deletes the webpage resource whose storage duration is longer than the preset duration, so that the The storage space occupied by the preset space is large, which affects the normal operation of other applications.
  • the operating system may further update the logistic regression model according to the URL address carried by the resource loading request and the acquired state data.
  • the status data may be obtained when receiving a resource loading request generated by the client; or the status data may be obtained recently before receiving the resource loading request generated by the client.
  • the operating system updates the logistic regression model, including: using the state data as sample state data, using the URL address carried in the resource loading request as the sample URL address, training the prediction model, and obtaining the trained prediction model.
  • the trained prediction model is used to predict a corresponding predicted URL address based on the subsequently acquired state data.
  • the operating system trains the prediction model according to the sample state data and the sample URL address.
  • For the training process please refer to FIG. 7:
  • Step 701 Input at least one set of sample state data into the prediction model to obtain a training result.
  • Step 702 Determine a loss function value according to the training result and the sample URL address corresponding to each group of sample state data.
  • loss function is represented by the following data model:
  • N is the number of groups of samples in the sample library, and i is the sample of the i-th group.
  • h ⁇ (x) (i) is the training result obtained by the logistic regression model according to the i-th sample state data
  • y (i) is the i-th sample URL address corresponding to the i-th sample state data.
  • Step 703 Update the model parameters in the logistic regression model according to the loss function value by using a gradient descent algorithm to obtain the updated model parameters.
  • J( ⁇ ) is the loss function value
  • ⁇ j is the weight of the jth state data
  • x j i is the jth state data in the i-th sample state data.
  • the process of updating the model parameters in the logistic regression model according to the mathematical model of the gradient descent algorithm is represented by the following formula:
  • is the learning step size
  • is a constant
  • the value of ⁇ may be the operating system default setting; or it may be set by the user. This embodiment does not limit the value of ⁇ .
  • is 0.5.
  • the initial values of ⁇ 0 , ⁇ 1 , ⁇ 2 ... ⁇ 2n ⁇ may be set by default in the operating system.
  • Step 704 Detect whether a difference between the updated model parameter and the pre-update model parameter is less than a preset threshold.
  • Step 705 when the difference is less than the preset threshold, the training ends, and the trained logistic regression model is obtained.
  • the logistic regression model when the predictive model is a logistic regression model, the logistic regression model is trained in real time according to the URL address and the state data in the resource loading request; so that the logistic regression model can adapt to the user's habit of accessing the URL address, and the improved The accuracy of the URL address is predicted by a logistic regression model.
  • the operating system may further store the URL address carried by the resource loading request and the obtained state data to the sample library.
  • the updated sample library is obtained, and the Bayesian model is established according to the updated sample library when the URL address is predicted based on the acquired state data next time. That is, the operating system uses the state data as the sample state data, and uses the URL address carried in the resource loading request as the sample URL address to establish an updated prediction model, and the updated prediction model is used to predict the corresponding state data according to the next acquisition.
  • the predicted URL address is a Bayesian model
  • the Bayesian model can adapt to the user's habit of accessing the URL address, and the accuracy of predicting the URL address by the Bayesian model is improved.
  • the sample URL address in the sample library is a URL address whose access duration is greater than a preset duration; and/or, the sample URL address is a URL address whose access times are greater than a preset number of times.
  • the preset duration is set by default in the operating system; or, the preset duration is received through the human-computer interaction interface. This embodiment does not limit the value of the preset duration. Schematically, the preset duration is 2 minutes.
  • the preset number of times is set by default in the operating system; or, the preset number of times is received through the human-computer interaction interface.
  • the value of the preset number of times is not limited. Schematically, the preset number of times is 10 times.
  • the URL address whose access duration is greater than the preset duration is used as the sample URL address. And/or, the URL address whose access number is greater than the preset number of times is used as the sample URL address, so that the predicted URL address determined by the prediction model from the sample URL address is a probability that the URL address that the user desires to access is large, and the prediction model is improved. The accuracy of the predicted URL address output.
  • FIG. 8 is a structural block diagram of a resource loading apparatus provided by an embodiment of the present application.
  • the resource loading apparatus may be implemented as part or all of a resource loading apparatus by software, hardware, or a combination of both.
  • the apparatus may include a data acquisition unit 810, an address prediction unit 820, a resource storage unit 830, a resource detection unit 840, and a resource feedback unit 850.
  • the data obtaining unit 810 is configured to acquire state data, where the state data is used to indicate an operating state of the operating system;
  • An address prediction unit 820 configured to input the state data into a prediction model, to obtain a predicted uniform resource locator URL address, where the prediction model is determined according to sample state data and a sample URL address;
  • the resource storage unit 830 is configured to store the webpage resource stored by the predicted URL address into a preset space
  • the resource detecting unit 840 is configured to detect, when receiving the resource loading request generated by the client, whether the preset space stores the webpage resource requested by the resource loading request;
  • the resource feedback unit 850 is configured to feed back the webpage resource to the client when the preset space stores the webpage resource requested by the resource loading request.
  • the status data includes at least one of the following data:
  • the apparatus further includes: a parsing unit 860.
  • the parsing unit 860 is configured to parse the webpage resource stored in the predicted URL address into a preset space, and parse the webpage resource to obtain an associated URL address, where the associated URL address refers to the predicted URL address Other URL address;
  • the resource storage unit 830 is further configured to cache other webpage resources stored by the associated URL address to the preset space.
  • the resource detecting unit 840 is configured to:
  • the URL connection component having a function of establishing a communication connection with a URL address carried by the resource loading request;
  • the prediction model is a logistic regression model, and the logistic regression model is used to classify state data and a URL address; the device further includes: a model training unit 870.
  • the model training unit 870 is configured to use the state data as the sample state data, and use the URL address carried in the resource loading request as the sample URL address to train the prediction model to obtain a predicted prediction.
  • a model the trained prediction model is configured to predict a corresponding predicted URL address according to the subsequently acquired state data.
  • the prediction model is a Bayesian model; the Bayesian model is used to predict a probability that a URL address is accessed; and the apparatus further includes: a model establishing unit 880.
  • the model establishing unit 880 is configured to use the state data as the sample state data, and use the URL address carried in the resource loading request as the sample URL address to establish an updated prediction model, and the updated prediction The model is used to predict a corresponding predicted URL address based on the next acquired state data.
  • the sample URL address is a URL address whose access duration is greater than a preset duration; and/or the sample URL address is a URL address whose access times are greater than a preset number of times.
  • the resource storage unit 830 is further configured to: when the resource size of the stored network resource in the preset space reaches a preset size, clear the preset space;
  • the resource storage unit 830 further clears the network resource that reaches the preset duration when the stored length of the network resource stored in the preset space reaches a preset duration.
  • the data obtaining unit 810 is configured to collect basic data every first preset duration, where the basic data is unprocessed data acquired by the operating system from a currently running component; The format of the underlying data is converted into the format of the data of the input prediction model, and the state data is obtained.
  • the present application further provides a computer readable medium having program instructions stored thereon, and when the program instructions are executed by the processor, the resource loading method provided by the foregoing method embodiments is implemented.
  • the present application also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the resource loading method provided by the various method embodiments described above.
  • a terminal in the present application may include one or more of the following components: a processor 1010 and a memory 1020.
  • Processor 1010 can include one or more processing cores.
  • the processor 1010 interconnects various portions of the entire terminal using various interfaces and lines, by executing or executing instructions, programs, code sets or sets of instructions stored in the memory 1020, and invoking data stored in the memory 1020, executing the terminals.
  • Various functions and processing data may use at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA).
  • DSP digital signal processing
  • FPGA field-programmable gate array
  • PDA programmable logic array
  • a form of hardware is implemented.
  • the processor 1010 can integrate one or a combination of a central processing unit (CPU), a modem, and the like. Among them, the CPU mainly processes operating systems and applications, etc.; the modem is used to handle wireless communication. It can be understood that the above modem may also be integrated into the processor 1010 and implemented by a single chip.
  • the processor 1010 executes the program instructions in the memory 1020, the resource loading method provided by the foregoing various method embodiments is implemented.
  • the memory 1020 may include a random access memory (RAM), and may also include a read-only memory.
  • the memory 1020 includes a non-transitory computer-readable storage medium.
  • Memory 1020 can be used to store instructions, programs, code, code sets, or sets of instructions.
  • the memory 1020 may include a storage program area and an storage data area, wherein the storage program area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the various method embodiments described above, and the like; Data and the like created according to the use of the terminal can be stored.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种资源加载方法、装置、终端及存储介质,属于互联网技术领域。该方法包括:获取状态数据,该状态数据用于表示操作系统的运行状态(210);将该状态数据输入预测模型,得到预测URL地址(202);将预测URL地址所存储的网页资源存储至预设空间(203);在接收到客户端生成的资源加载请求时,检测预设空间是否存储有资源加载请求所请求的网页资源(204);在预设空间存储有资源加载请求所请求的网页资源时,将网页资源反馈至客户端(205)。所述方法可以解决在操作系统与URL地址之间的网络状况较差时,网页资源的加载效率较低的问题;由于客户端加载本地存储的网页资源的效率较高,而操作系统可以将用户可能访问的URL地址中的网页资源预先存储在本地,因此,可以提高客户端加载网页资源的效率。

Description

资源加载的方法、装置、终端及存储介质
本申请实施例要求于2017年12月05日提交的申请号为201711268145.X、发明名称为“资源加载的方法、装置、终端及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请实施例中。
技术领域
本申请实施例涉及互联网技术领域,特别涉及一种资源加载方法、装置、终端及存储介质。
背景技术
客户端具有根据统一资源定位符(Uniform Resource Locator,URL)地址加载网页资源的功能。
客户端在需要加载网页资源时,首先生成资源加载请求,该资源加载请求携带有URL地址;操作系统接收到该资源加载请求之后,通过与该URL地址之间的通信连接从该URL地址中加载网页资源;然后,操作系统将加载到的网页资源反馈至客户端。
发明内容
本申请实施例提供的资源加载方法、装置、终端及存储介质,可以解决资源加载延时较大的问题。所述技术方案如下:
一方面,提供了一种资源加载方法,所述方法包括:
获取状态数据,所述状态数据用于表示操作系统的运行状态;
将所述状态数据输入预测模型,得到预测统一资源定位符URL地址,所述预测模型是根据样本状态数据和样本URL地址确定的;
将所述预测URL地址所存储的网页资源存储至预设空间;
在接收到客户端生成的资源加载请求时,检测所述预设空间是否存储有所述资源加载请求所请求的网页资源;
在所述预设空间存储有所述资源加载请求所请求的网页资源时,将所述网页资源反馈至所述客户端。
另一方面,提供了一种资源加载装置,所述装置包括:
数据获取单元,用于获取状态数据,所述状态数据用于表示操作系统的运行状态;
地址预测单元,用于将所述状态数据输入预测模型,得到预测统一资源定位符URL地址,所述预测模型是根据样本状态数据和样本URL地址确定的;
资源存储单元,用于将所述预测URL地址所存储的网页资源存储至预设空间;
资源检测单元,用于在接收到客户端生成的资源加载请求时,检测所述预设空间是否存储有所述资源加载请求所请求的网页资源;
资源反馈单元,用于在所述预设空间存储有所述资源加载请求所请求的网页资源时,将所述网页资源反馈至所述客户端。
另一方面,提供了一种终端,所述终端包括处理器、与所述处理器相连的存储器,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现本申请实施例中提供的资源加载方法。
另一方面,一种计算机可读存储介质,其上存储有程序指令,所述程序指令被处理器执行时实现本申请实施例中提供的资源加载方法。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本 领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一个示例性实施例提供的资源加载系统的结构示意图;
图2是本申请一个示例性实施例提供的资源加载方法的流程图;
图3是本申请一个示例性实施例提供的样本库的示意图;
图4是本申请一个示例性实施例提供的预测URL地址的示意图;
图5是本申请另一个示例性实施例提供的预测URL地址的示意图;
图6是本申请一个示例性实施例提供的资源加载过程的示意图;
图7是本申请一个示例性实施例提供的预测模型训练过程的流程图;
图8是本申请一个示例性实施例提供的资源加载装置的结构框图;
图9是本申请另一个示例性实施例提供的资源加载装置的结构框图;
图10是本申请一个实施例提供的终端的结构框图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
首先,对本申请涉及的若干名词进行介绍。
预测模型:是一种用于根据输入的数据预测URL地址的数学模型。
可选地,预测模型是根据样本状态数据和样本URL地址确定的。其中,样本URL地址是指终端中历史访问的URL地址。样本状态数据是指在访问样本URL地址时获取到的状态数据。
可选地,样本状态数据和样本URL地址存储于样本库。样本库包括至少一组样本,每组样本包括同时采集到的样本状态数据和样本URL地址。
其中,状态数据用于表示操作系统的运行状态。
可选地,状态数据包括但不限于以下几种中的至少一种:
用于表示是否接入无线网络的数据,比如:1表示操作系统接入无线网络,0表示操作系统未接入无线网络。当然,也可以通过其它数据表示是否接入无线网络的数据,本申请对此不作限定。
用于表示前台运行的应用程序的数据,比如:1表示xx浏览器,2表示xx社交应用,3表示xx购物应用等。当然,也可以通过其它数据表示应用程序,本申请对此不作限定。
用于表示当前时间所处的时间段的数据,比如:将一天中的24小时每隔10分钟分为一段,则得到144个时间段,其中,i表示当前时间所处的时间段为第i个时间段,1≤i≤144,i为整数。当然,也可以按照其它方式划分时间段,不同的时间段之间的时长可以相同,也可以不同,本实施对此不作限定。
用于表示当前时间是否属于工作时间段的数据,比如:1表示当前时间属于工作时间段,0表示当前时间不属于工作时间段。
用于表示当前时间是否属于休息时间段的数据,比如:1表示当前时间属于休息时间段,0表示当前时间不属于休息时间段。
用于表示电池是否处于充电状态的数据,比如:1表示电池处于充电状态,0表示电池未处于充电状态。
用于表示电池的剩余电量的数据,比如:在以百分制的形式表示剩余电量,1-100中的任意数值为剩余电量数据。
可选地,状态数据的格式是输入预测模型的数据的格式。比如:状态数据为向量的格式。可选地,终端中存储有用户访问URL的访问记录,终端根据该访问记录生成样本。示意性的,终端中存储的访问记录如下表一所示:
表一
Wifi 应用程序 URL 时间戳 充电状态
On 程序A http://view.news.com/44.html 14975906969 On
Off 程序B http://img.g.com/203980x1200.jpg 14976007922 Off
On 程序C http://img.gmg.com/20390.jpg 14999028945 Off
示意性的,上表一的列“wifi”中的“on”表示为终端接入无线网络,“off”用于表示终端未接入无线网络;上表一的列“充电状态”中的“on”表示处于充电状态,“off”表示不处于充电状态,“应用程序”列中用于表示前台运行的应用程序,“URL”列表示被访问的URL,“时间戳”列用于表示访问对应的URL时的时间戳,其中,每个时间戳可以转化为年月日时分秒的格式,如:时间戳1497590695469可以转换为2017年6月16日13时24分55秒。
可选地,该用户访问URL的访问记录中存储有用于在最近预设时长内访问URL的记录。可选地,该最近预设时长为最近两周、最近一个月、最近半年等,本申请实施例对此不加以限定。
可选地,结合上述表一所示的访问记录,终端根据如上表一所述的访问记录对样本进行生成。示意性的,终端生成的样本如下表二所示:
表二
行列号 1 2 3 4 5 6
0 Wifi 应用程序 工作日 时间段 充电状态 URL
1 1 0 1 81 1 0
2 0 1 1 82 0 1
3 1 2 0 83 0 2
4
其中,终端中的每个应用程序都被标有编号,如:表一中的程序A的编号为0,程序B的编号为1,程序C的编号为2。可选地,每个终端访问的URL都被编有编号,URL的最大标号值取决于表一中访问的URL总数。
可选地,上述表二中第1行第1列至第1行第6列开始向下的数据可以作为一个矩阵,该矩阵用于表示该样本。
可选地,预测模型包括但不限于:逻辑回归(Logistic Regression,LR)模型和贝叶斯(Bayesian)模型中的至少一种。
逻辑回归模型是指在线性回归的基础上,套用一个逻辑函数建立的模型。可选地,本申请中,逻辑回归模型用于对状态数据和URL地址进行分类。
示意性地,逻辑回归模型通过如下数学模型表示:
Figure PCTCN2018116248-appb-000001
其中,x 1、x 2……x n是不同类型的状态数据;σ(z)=1/(e -z);θ 1、θ 2……θ 2n是逻辑回归模型的模型参数,θ 0、θ 1、θ 2……θ 2n可以是开发人员设置的,或者,也可以是根据样本状态数据和样本URL地址训练得到的。
贝叶斯模型是一种以动态模型为研究对象的时间序列预测模型。可选地,本申请中,贝叶斯模型用于预测URL地址被访问的概率。
示意性地,贝叶斯模型通过如下数学模型表示:
Figure PCTCN2018116248-appb-000002
P(A)=N(A)/N
P(B)=N(B)/N
……
P(X)=N(X)/N
P(A|J)=N(A,J)/N(J)
P(B|J)=N(B,J)/N(J)
……
P(X|J)=N(X,J)/N(J)
其中,A、B……X是不同类型的状态数据。N(A)为样本库中包括状态数据A的总数、N(B)为样本库中包括状态数据B的总数……N(X)为样本库中包括状态数据X的总数。N为样本库中样本的组数,每组样本包括同时采集到的样本状态数据和样本URL地址。N(A,J)为同一组样本中样本状态数据为A且样本加载地址为J的总组数、N(B,J)为同一组样本中样本状态数据为B且样本加载地址为J的总组数……N(X,J)为同一组样本中样本状态数据为X且样本加载地址为J的总组数。N(J)为样本库中URL地址为J的次数。
当然,预测模型还可以为其它模型,比如:深度神经网络(Deep Neural Network,DNN)模型、循环神经网络(Recurrent Neural Networks,RNN)模型、嵌入(embedding)模型、梯度提升决策树(Gradient Boosting Decision Tree,GBDT)模型等,本实施例在此不再一一列举。
DNN模型是一种深度神经网络模型。DNN模型包括输入层、至少一层隐层(或称,中间层)和输出层。可选地,输入层、至少一层隐层和输出层均包括至少一个神经元,神经元用于对接收到的数据进行处理。可选地,不同层之间的神经元的数量可以相同;或者,也可以不同。
RNN模型是一种具有反馈结构的神经网络。在RNN模型中,神经元的输出可以在下一个时间戳直接作用到自身,即,第i层神经元在m时刻的输入,除了(i-1)层神经元在该时刻的输出外,还包括其自身在(m-1)时刻的输出。
embedding模型是基于实体和关系分布式向量表示,将每个三元组实例中的关系看作从实体头到实体尾的翻译。其中,三元组实例包括主体、关系、客体,三元组实例可以表示成(主体,关系,客体);主体为实体头,客体为实体尾。比如:小明的爸爸是大明,则通过三元组实例表示为(小明,爸爸,大明)。
GBDT模型是一种迭代的决策树算法,该算法由多棵决策树组成,所有树的结果累加起来作为最终结果。决策树的每个节点都会得到一个预测值,以年龄为例,预测值为属于年龄对应的节点的所有人年龄的平均值。
图1是本申请的一个示例性实施例示出的资源加载系统的结构示意图,该系统包括至少一个终端110和服务器120。
终端110具有通信功能,终端110包括但不限于:手机、平板电脑、可穿戴式设备、智能机器人、智能家居设备、膝上型便携计算机和台式计算机中的至少一种。
终端110中安装有操作系统111和客户端112。
可选地,操作系统111包括但不限于:IOS(iPhone OS)系统、安卓(Android)系统、window系统中的任意一种。
客户端112在需要访问网页资源时,生成资源加载请求,该资源加载请求携带网页资源的URL地址。相应地,操作系统111在接收到该资源加载请求时,能够根据该URL地址加载对应的网页资源,然后,将该网页资源反馈至客户端。
可选地,本申请中,操作系统111还可以在客户端请求访问URL地址时,获取当前的运行状态的状态数据,将该状态数据和URL地址存储至样本库。
可选地,本申请中,操作系统111还可以预测客户端112将会访问的URL地址,并预 先将该URL地址存储的网页资源从服务器120存储至预设空间。
可选地,终端110通过无线网络或有线网络与服务器120相连。
服务器120可以为独立的一台服务器主机;或者,也可以是多台服务器主机构成的服务器集群。可选地,该服务器120可以是物理服务器,也可以是虚拟的云服务器。
服务器120用于提供客户端112请求访问的URL地址对应的网页资源。
可选地,不同的URL地址指向同一服务器120;或者,不同的URL地址指向不同的服务器120。
可选地,上述终端110的数量可以为至少一个,服务器120的数量也可以为至少一个,本实施例对此不作限定。
可选地,本申请中,无线网络或有线网络使用标准通信技术和/或协议。网络通常为因特网、但也可以是任何网络,包括但不限于局域网(Local Area Network,LAN)、城域网(Metropolitan Area Network,MAN)、广域网(Wide Area Network,WAN)、移动、有线或者无线网络、专用网络或者虚拟专用网络的任何组合)。在一些实施例中,使用包括超文本标记语言(HyperText Mark-up Language,HTML)、可扩展标记语言(Extensible Markup Language,XML)等的技术和/或格式来代表通过网络交换的数据。此外还可以使用诸如安全套接字层(Secure Socket Layer,SSL)、传输层安全(Trassport Layer Security,TLS)、虚拟专用网络(Virtual Private Network,VPN)、网际协议安全(Internet Protocol Security,IPsec)等常规加密技术来加密所有或者一些链路。在另一些实施例中,还可以使用定制和/或专用数据通信技术取代或者补充上述数据通信技术。
可选地,本申请中各步骤的执行主体为终端中的操作系统,该操作系统可以是图1所示的资源加载系统中的操作系统111。
示意性的,当操作系统与URL地址之间的网络状况较差时,操作系统加载网页资源的过程会很缓慢,此时,操作系统将网页资源反馈至客户端的时长较长,导致客户端加载网页资源的延时较大。
图2是本申请的一个示例性实施例示出的资源加载方法的流程图。以该方法应用在如图1所示的终端110中为例进行说明,该资源加载方法包括以下几个步骤。
步骤201,获取状态数据,该状态数据用于表示操作系统的运行状态。
可选地,操作系统每隔第一预设时长采集基础数据,并对该基础数据进行预处理得到状态数据。第一预设时长是操作系统默认设置的;或者,第一预设时长是操作系统通过人机交互接口接收到的。本实施例不对第一预设时长的取值作限定,示意性地,第一预设时长为1分钟。
可选地,操作系统在客户端开始在前台运行时采集基础数据,并对该基础数据进行预处理得到状态数据。
可选地,操作系统在当前时刻在预设时间段内时,每隔第二预设时长采集基础数据,并对该基础数据进行预处理得到状态数据。预设时间段是操作系统默认设置的;或者,是操作系统通过人机交互接口接收到的。比如:在用户的睡眠期间(23:00~6:00),该用户通常不需要通过客户端访问URL地址,此时,可以将23:00~6:00的时间段设置为预设时间段。第二预设时长是操作系统默认设置的;或者,第一预设时长是操作系统通过人机交互接口接收到的。第二预设时长可以与第一预设时长相同;或者,第二预设时长也可以与第一预设时长不同。本实施例不对第二预设时长的取值作限定,示意性地,第二预设时长为1分钟。
可选地,对基础数据进行预处理是指将基础数据的格式转换为输入预测模型的数据的格式。
可选地,基础数据是操作系统从当前运行的组件中直接获取到的、未经处理的数据。
可选地,基础数据包括但不限于以下几种:操作系统前台运行的应用程序的程序标识、当前时间、电池的充电电路是否启动、电池的剩余电量和操作系统接入的网络的类型中的至少一种。
其中,程序标识可以是应用程序的名称、应用程序的包名、应用程序的图标信息等,本实施例对此不作限定。
可选地,当基础数据包括前台运行的应用程序的程序标识时,对程序标识进行预处理包括:根据程序标识与第一状态数据之间的对应关系,将程序标识转化为第一状态数据。第一状态数据是指程序标识转化后得到的状态数据,第一状态数据是表示前台运行的应用程序的数据。比如:程序标识为xx浏览器,转化后的第一状态数据为1;程序标识为xx社交应用,转化后的第一状态数据为2;程序标识为xx购物应用,转化后的第一状态数据为3。
可选地,当基础数据包括当前时间时,对当前时间进行预处理包括:确定当前时间属于哪一个时间段,根据确定结果将当前时间转化为第二状态数据。第二状态数据是指当前时间转化后得到的状态数据,第二状态数据是表示当前时间所处的时间段的数据。比如:将一天中的24小时每隔10分钟分为一段,则得到144个时间段,其中,i表示当前时间所处的时间段为第i个时间段,1≤i≤144,i为整数。若当前时间为10:09,则所属的时间段为第60个时间段,第二状态数据为60。
可选地,当基础数据包括当前时间时,对当前时间进行预处理还包括:检测当前时间是否属于工作时间段,根据检测结果将当前时间转化为第三状态数据。第三状态数据是指当前时间转化后得到的状态数据,第三状态数据是表示当前时间是否属于工作时间段的数据。工作时间段是操作系统默认设置的;或者,工作时间段是操作系统通过人机交互接口接收到的。比如:工作时间段为周一至周五的9:00-12:00和13:00-18:00,且当前时间为周四的10:29,则当前时间属于工作时间段,第三状态数据为1;若当前时间为周六的10:29,则当前时间不属于工作时间段,第三状态数据为0。
可选地,当基础数据包括当前时间时,对当前时间进行预处理还包括:检测当前时间是否属于休息时间段,根据检测结果将当前时间转化为第四状态数据。第四状态数据是指当前时间转化后得到的状态数据,第四状态数据是表示当前时间是否属于休息时间段的数据。休息时间段是操作系统默认设置的;或者,休息时间段是操作系统通过人机交互接口接收到的。比如:休息时间段为周一至周五的00:00-9:00、12:00-13:00、18:00-00:00、周六和周日,且当前时间为周四的10:29,则当前时间不属于休息时间段,第四状态数据为0;若当前时间为周六的10:29,则当前时间属于休息时间段,第四状态数据为1。
可选地,当基础数据包括电池的充电电路是否启动时,对电池的充电电路是否启动进行预处理包括:若电池的充电电路启动,则确定电池处于充电状态,将充电状态以第五状态数据量化表示;若电池的充电电路未启动,则确定电池处于未充电状态,将未充电状态以第五状态数据量化表示。第五状态数据是表示电池是否处于充电状态的数据。比如:电池处于充电状态,则第五状态数据为1;电池处于未充电状态,则第五状态数据为0。
可选地,当基础数据包括电池的剩余电量时,对剩余电量进行预处理包括:将剩余电量以百分制分数表示,得到第六状态数据。第六状态数据是表示电池剩余电量的数据。比如:电池的剩余一半电量时,第六状态数据为50。
可选地,当基础数据包括操作系统接入的网络的类型时,对操作系统接入的网络的类型进行预处理包括:将操作系统接入的网络的类型以第七状态数据量化表示。第七状态数据是表示操作系统是否接入无线网络的数据。比如:操作系统接入的网络的类型为无线网络,则第七状态数据为1;操作系统接入的网络的类型为数据网络,则第七状态数据为0。
步骤202,将状态数据输入预测模型,得到预测URL地址。
预测模型是根据样本状态数据和样本URL地址确定的。
可选地,操作系统本地存储有样本库,该样本库包括至少一组样本,每组样本包括同 时采集到的样本状态数据和样本URL地址。
示意性地,参考图3所示的样本库,该样本库中,属于同一行的样本状态数据和样本URL地址为一组样本。
参考图4,以预测模型为逻辑回归模型为例,若状态数据包括表示当前时间所属的时间段的数据x 1、表示当前时间是否属于工作时间段的数据x 2、表示电池是否属于充电状态的数据x 3、表示是否接入无线网络的数据x 4和表示前台运行的应用程序的数据x 5;则将x 1、x 2、x 3、x 4和x 5输入逻辑回归模型,经过逻辑回归模型处理后,得到预测URL地址。
可选地,每个逻辑回归模型输出的预测URL地址的数量为1个,预测模型可以包括多个逻辑回归模型,从而得到多个预测URL地址。
参考图5,以预测模型为贝叶斯模型为例,若状态数据包括表示当前时间所属的时间段的数据x 1、表示当前时间是否属于工作时间段的数据x 2、表示电池是否属于充电状态的数据x 3、表示是否接入无线网络的数据x 4和表示前台运行的应用程序的数据x 5;则将x 1、x 2、x 3、x 4和x 5输入贝叶斯模型,经贝叶斯模型处理后,得到预测URL地址。
可选地,每个贝叶斯模型可以得到样本库中每个样本URL地址被访问的概率,贝叶斯模型得到的预测URL地址可以是概率排名在前n位的样本URL地址。本实施例不对n的数量作限定,示意性地,n可以为10、8等。
步骤203,将预测URL地址所存储的网页资源存储至预设空间。
可选地,预测URL地址所存储的网页资源以文件的形式存储至预设空间。即,操作系统中设置一个文件,该文件用于记录网页资源的存储地址。可选地,该文件中记录有预测URL地址与网页资源的存储地址之间的对应关系。
可选地,预设空间为文件指示的空间,该空间为缓存空间。
可选地,该预设空间的空间大小可以是预先设定的,如:该预设空间的空间大小为120M。可选地,当预设空间中已存储的网络资源的资源大小达到预设大小时,清空该预设空间;或,当预设空间中存储的网络资源的已存储时长达到预设时长时,清除达到预设时长的网络资源。
示意性的,以根据预设空间中存储的资源大小对网络资源进行清空为例进行说明,预设大小为100M,预设空间中存储有资源1、资源2以及资源3,该三个资源的总大小为88M,资源4的大小为20M,则当资源4需要存储至预设空间时,可以在资源4存储至预设空间后,下一个资源需要存储至预设空间时,将资源1至资源4从预设空间中清空,也可以在资源4存储至预设空间之前判断该资源4存储至预设空间后,预设空间中的资源大小超出预设大小,则清空资源1、资源2以及资源3后将资源4存储至预设空间。
步骤204,在接收到客户端生成的资源加载请求时,检测预设空间是否存储有资源加载请求所请求的网页资源。
可选地,客户端在通过人机交互接口接收到用户输入的URL地址时生成资源加载请求,操作系统接收到该资源加载请求;或者,客户端在通过人机交互接口接收到对URL地址的触发操作时生成资源加载请求,操作系统接收到该资源加载请求。
可选地,客户端为前台运行的应用程序。
可选地,操作系统调用操作系统中的URL连接组件;通过URL连接组件检测预设空间是否包括资源加载请求所请求的网页资源。
其中,URL连接组件具有与资源加载请求所携带的URL地址建立通信连接的功能。可选地,URL连接组件为操作系统预先创建的对象,用于表示应用程序与URL地址之间的通信连接,示意性地,该URL连接组件为操作系统中的URL Connection对象。
本实施例中,通过对已创建的URL连接组件进行改进,使其除了具有与资源加载请求所携带的URL地址建立通信连接的功能之外,还具有检测预设空间是否存储有资源加载请求所请求的网页资源的功能,无需操作系统额外创建新的组件,节省了操作系统的资源。
可选地,在检测出预设空间存储有资源加载请求所请求的网页资源时,执行步骤205; 在检测出预设空间未存储有资源加载请求所请求的网页资源时,通过URL连接组件建立与URL地址之间的通信连接,将该URL地址存储的网页资源反馈至客户端。
步骤205,在预设空间存储有资源加载请求所请求的网页资源时,将网页资源反馈至客户端。
可选地,操作系统将该网页资源从URL连接组件传递至客户端对应的进程。
示意性地,参考图6所示的资源加载过程,客户端生成资源加载请求,该资源加载请求携带有URL地址。操作系统接收到该资源加载请求之后,调用URL连接组件检测预设空间是否存储有该URL地址对应的网页资源;在存储有该网页资源时,将该网页资源反馈至客户端。其中,预设空间中存储有操作系统通过预测模型得到的预测URL地址对应的网页资源。
综上所述,本实施例提供的资源加载方法,通过在接收到客户端发送的资源加载请求之前,通过预测模型预测各个客户端可能访问的URL地址,预先将该URL地址存储的网页资源存储至本地的预设空间;使得操作系统在客户端请求该URL地址对应的网页资源时,可以直接将本地存储的网页资源反馈至客户端,而无需从URL地址指示的服务器处下载该网页资源,避免了在操作系统与URL地址之间的网络状况较差时,网页资源的加载效率较低的问题;由于客户端加载本地存储的网页资源的效率较高,因此,可以提高客户端加载网页资源的效率。
另外,由于逻辑回归模型或者贝叶斯模型是基于用户历史访问URL地址时,操作系统的状态数据的规律建立的,因此,通过逻辑回归模型或者贝叶斯模型根据操作系统当前的状态数据来预测各个客户端可能访问的URL地址,得到的预测URL地址是用户需要访问的URL地址的概率较大,因此,可以提高操作系统预测URL地址的准确性。
另外,通过使用操作系统中已创建的URL连接组件来检测预设空间是否包括资源加载请求所请求的网页资源,使得操作系统无需额外创建新的组件来检测网页资源,节省了操作系统所消耗的资源。
可选地,所述检测所述预设空间是否存储有所述资源加载请求所请求的网页资源,包括:
调用所述操作系统中的URL连接组件,所述URL连接组件具有与所述资源加载请求所携带的URL地址建立通信连接的功能;
通过所述URL连接组件检测所述预设空间是否包括所述资源加载请求所请求的网页资源。
可选地,所述预测模型为逻辑回归模型,所述逻辑回归模型用于对状态数据和URL地址进行分类;所述方法还包括:
将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,对所述预测模型进行训练,得到训练后的预测模型;所述训练后的预测模型用于根据后续获取到的状态数据预测对应的预测URL地址。
可选地,所述预测模型为贝叶斯模型;所述贝叶斯模型用于预测URL地址被访问的概率;所述方法还包括:
将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,建立更新后的预测模型,所述更新后的预测模型用于根据下一次获取到的状态数据预测对应的预测URL地址。
可选地,所述样本URL地址为访问时长大于预设时长的URL地址;和/或,所述样本URL地址为访问次数大于预设次数的URL地址。
可选地,所述状态数据包括以下几种数据中的至少一种:
用于表示是否接入无线网络的数据;
用于表示前台运行的应用程序的数据;
用于表示当前时间所处的时间段的数据;
用于表示当前时间是否属于工作时间段的数据;
用于表示当前时间是否属于休息时间段的数据;
用于表示电池是否处于充电状态的数据;
用于表示电池的剩余电量的数据。
可选地,所述将所述预测URL地址所存储的网页资源缓存储至预设空间之后,还包括:
对所述网页资源进行解析得到关联URL地址,所述关联URL地址是指所述预测URL地址所链接的其它URL地址;
将所述关联URL地址所存储的其它网页资源缓存至所述预设空间。
可选地,所述方法还包括:
当所述预设空间中已存储的网络资源的资源大小达到预设大小时,清空所述预设空间;
或,
当所述预设空间中存储的网络资源的已存储时长达到预设时长时,清除达到所述预设时长的所述网络资源。
可选地,所述获取状态数据,包括:
每隔第一预设时长采集基础数据,所述基础数据是所述操作系统从当前运行的组件中获取的未经处理的数据;
将所述基础数据的格式转换为输入预测模型的数据的格式,得到所述状态数据。
可选地,在本实施例中,各步骤的执行主体可以均为操作系统中的URL连接组件;或者,也可以为操作系统中的创建的其它组件,本实施例对此不作限定。
可选地,在步骤203之后,即,操作系统将预测URL地址所存储的网页资源存储至预设空间之后,还可以对网页资源进行解析得到关联URL地址,关联URL地址是指预测URL地址所链接的其它URL地址;将关联URL地址所存储的其它网页资源存储至预设空间。
比如:预测URL地址存储的网页资源为新闻网页资源,该新闻网页资源包括至少一条新闻的关联URL地址,而该关联URL地址存储的网页资源可能为用户实际想访问的网页资源,因此,操作系统还会将该关联URL地址存储的网页资源存储至预设空间。
可选地,关联URL地址对应的网页资源以文件的形式存储至预设空间。
在一些网页资源中可能包括关联URL地址,用户访问该网页资源的目的通常是访问该关联URL地址存储的网页资源,因此,本实施例通过将关联URL地址的网页资源存储至预设空间,可以提高客户端加载关联URL地址的网页资源的效率。
可选地,本申请中,预设空间仅保存预测模型最近一次预测到的预测URL地址的网页资源;或者,预设空间仅保存预测模型最近一次预测到的预测URL地址的网页资源和该网页资源中的关联URL地址的网页资源。由于最近一次预测到的预测URL地址是根据操作系统最近的状态数据确定出的,因此,该预测URL地址的准确性较高。这样,既可以提高操作系统存储的网页资源是用户期望访问的网页资源的概率,而且还可以节省存储资源。
可选地,在预测URL地址的网页资源,和/或,关联URL地址的网页资源占用的预设空间大于空间阈值时,操作系统将存储时长大于预设时长的网页资源删除,这样,可以避免预设空间占用的存储资源较大,影响其它应用程序正常运行的问题。
可选地,当预测模型为逻辑回归模型时,操作系统在接收到客户端生成的资源加载请求之后,还可以根据该资源加载请求携带的URL地址和获取到的状态数据更新该逻辑回归模型。
可选地,该状态数据可以是在接收到客户端生成的资源加载请求时获取到的;或者,该状态数据也可以是在接收到客户端生成的资源加载请求之前,最近一次获取到的。
操作系统更新逻辑回归模型,包括:将状态数据作为样本状态数据,将资源加载请求中携带的URL地址作为样本URL地址,对预测模型进行训练,得到训练后的预测模型。
训练后的预测模型用于根据后续获取到的状态数据预测对应的预测URL地址。
其中,操作系统根据样本状态数据和样本URL地址对预测模型进行训练,该训练过程请参考图7:
步骤701,将至少一组样本状态数据输入预测模型,得到训练结果。
本步骤的相关描述参见图4所示的计算过程,本实施例在此不作赘述。
步骤702,根据训练结果和每组样本状态数据对应的样本URL地址确定损失函数值。
示意性地,损失函数通过下述数据模型表示:
Figure PCTCN2018116248-appb-000003
Cos t(h θ(x (i)),y (i))=-y (i)log h θ(x (i))-(1-y (i))log(1-h θ(x (i))
其中,N为样本库中样本的组数,i为第i组样本。h θ(x) (i)为逻辑回归模型根据第i组样本状态数据得到的训练结果,y (i)为第i组样本状态数据对应的第i组样本URL地址。
步骤703,通过梯度下降算法根据损失函数值更新逻辑回归模型中的模型参数,得到更新后的模型参数。
示意性地,梯度下降算法通过下述数学模型表示:
Figure PCTCN2018116248-appb-000004
其中,J(θ)为损失函数值,θ j为第j种状态数据的权重,x j i为第i组样本状态数据中的第j种状态数据。
示意性地,根据梯度下降算法的数学模型更新逻辑回归模型中的模型参数的过程通过下述公式表示:
Figure PCTCN2018116248-appb-000005
其中,α为学习步长,α为常数,α的值可以是操作系统默认设置;或者,也可以是用户设置的。本实施例不对α的取值作限定,示意性地,α为0.5。
可选地,{θ 0、θ 1、θ 2……θ 2n}的初始值可以是操作系统中默认设置的。
步骤704,检测更新后的模型参数与更新前的模型参数之间的差值是否小于预设阈值。
步骤705,在该差值小于预设阈值时,训练结束,得到训练后的逻辑回归模型。
步骤706,在该差值大于或等于预设阈值时,继续从步骤701开始训练逻辑回归模型。
本实施例中,通过在预测模型为逻辑回归模型时,根据资源加载请求中的URL地址和状态数据实时对逻辑回归模型进行训练;使得该逻辑回归模型能够适应用户访问URL地址的习惯,提高了通过逻辑回归模型预测URL地址的准确性。
可选地,当预测模型为贝叶斯模型时,操作系统在接收到客户端生成的资源加载请求 之后,还可以将该资源加载请求携带的URL地址和获取到的状态数据存储至样本库,得到更新后的样本库,在下一次需要根据获取到的状态数据预测URL地址时,根据该更新后的样本库建立贝叶斯模型。即,操作系统将状态数据作为样本状态数据,将资源加载请求中携带的URL地址作为样本URL地址,建立更新后的预测模型,更新后的预测模型用于根据下一次获取到的状态数据预测对应的预测URL地址。
本实施例中,通过根据更新后的样本库建立贝叶斯模型,使得该贝叶斯模型能够适应用户访问URL地址的习惯,提高了通过贝叶斯模型预测URL地址的准确性。
可选地,本申请中,样本库中的样本URL地址为访问时长大于预设时长的URL地址;和/或,样本URL地址为访问次数大于预设次数的URL地址。
可选地,预设时长为操作系统中默认设置的;或者,预设时长为通过人机交互接口接收到的。本实施例不对预设时长的取值作限定,示意性地,预设时长为2分钟。
可选地,预设次数为操作系统中默认设置的;或者,预设次数为通过人机交互接口接收到的。本实施例不对预设次数的取值作限定,示意性地,预设次数为10次。
由于对于访问时长和/或访问次数较少的URL地址来说,用户期望访问该URL地址的概率较低,因此,本实施例中,通过将访问时长大于预设时长的URL地址作为样本URL地址;和/或,将访问次数大于预设次数的URL地址作为样本URL地址,使得预测模型从该样本URL地址中确定出的预测URL地址为用户期望访问的URL地址概率较大,提高了预测模型输出的预测URL地址的准确性。
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。
请参考图8,其示出了本申请一个实施例提供的资源加载装置的结构方框图,该资源加载装置可通过软件、硬件或者两者的结合实现成为资源加载设备的部分或者全部。该装置可以包括:数据获取单元810、地址预测单元820、资源存储单元830、资源检测单元840和资源反馈单元850。
数据获取单元810,用于获取状态数据,所述状态数据用于表示操作系统的运行状态;
地址预测单元820,用于将所述状态数据输入预测模型,得到预测统一资源定位符URL地址,所述预测模型是根据样本状态数据和样本URL地址确定的;
资源存储单元830,用于将所述预测URL地址所存储的网页资源存储至预设空间;
资源检测单元840,用于在接收到客户端生成的资源加载请求时,检测所述预设空间是否存储有所述资源加载请求所请求的网页资源;
资源反馈单元850,用于在所述预设空间存储有所述资源加载请求所请求的网页资源时,将所述网页资源反馈至所述客户端。
可选地,所述状态数据包括以下几种数据中的至少一种:
用于表示是否接入无线网络的数据;
用于表示前台运行的应用程序的数据;
用于表示当前时间所处的时间段的数据;
用于表示当前时间是否属于工作时间段的数据;
用于表示当前时间是否属于休息时间段的数据;
用于表示电池是否处于充电状态的数据;
用于表示电池的剩余电量的数据。
可选地,请参考图9,所述装置还包括:解析单元860。
解析单元860,用于将所述预测URL地址所存储的网页资源存储至预设空间之后,对所述网页资源进行解析得到关联URL地址,所述关联URL地址是指所述预测URL地址所链接的其它URL地址;
资源存储单元830,还用于将所述关联URL地址所存储的其它网页资源缓存至所述预设空间。
可选地,资源检测单元840,用于:
调用所述操作系统中的URL连接组件,所述URL连接组件具有与所述资源加载请求所携带的URL地址建立通信连接的功能;
通过所述URL连接组件检测所述预设空间是否包括所述资源加载请求所请求的网页资源。
可选地,所述预测模型为逻辑回归模型,所述逻辑回归模型用于对状态数据和URL地址进行分类;所述装置还包括:模型训练单元870。
模型训练单元870,用于将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,对所述预测模型进行训练,得到训练后的预测模型;所述训练后的预测模型用于根据后续获取到的状态数据预测对应的预测URL地址。
可选地,所述预测模型为贝叶斯模型;所述贝叶斯模型用于预测URL地址被访问的概率;所述装置还包括:模型建立单元880。
模型建立单元880,用于将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,建立更新后的预测模型,所述更新后的预测模型用于根据下一次获取到的状态数据预测对应的预测URL地址。
可选地,所述样本URL地址为访问时长大于预设时长的URL地址;和/或,所述样本URL地址为访问次数大于预设次数的URL地址。
可选地,资源存储单元830,还用于当所述预设空间中已存储的网络资源的资源大小达到预设大小时,清空所述预设空间;
或,
资源存储单元830,还当所述预设空间中存储的网络资源的已存储时长达到预设时长时,清除达到所述预设时长的所述网络资源。
可选地,所述数据获取单元810,用于每隔第一预设时长采集基础数据,所述基础数据是所述操作系统从当前运行的组件中获取的未经处理的数据;将所述基础数据的格式转换为输入预测模型的数据的格式,得到所述状态数据。
本申请还提供一种计算机可读介质,其上存储有程序指令,程序指令被处理器执行时实现上述各个方法实施例提供的资源加载方法。
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各个方法实施例提供的资源加载方法。
参考图10,其示出了本申请一个示例性实施例提供的终端的结构方框图。本申请中的终端可以包括一个或多个如下部件:处理器1010和存储器1020。
处理器1010可以包括一个或者多个处理核心。处理器1010利用各种接口和线路连接整个终端内的各个部分,通过运行或执行存储在存储器1020内的指令、程序、代码集或指令集,以及调用存储在存储器1020内的数据,执行终端的各种功能和处理数据。可选地,处理器1010可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器1010可集成中央处理器(Central Processing Unit,CPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统和应用程序等;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1010中,单独通过一块芯片进行实现。
可选地,处理器1010执行存储器1020中的程序指令时实现下上述各个方法实施例提供的资源加载方法。
存储器1020可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。可选地,该存储器1020包括非瞬时性计算机可读介质(non-transitory computer-readable storage medium)。存储器1020可用于存储指令、程序、代码、代码集或指令集。存储器1020可包括存储程序区和存储数据区,其中,存储程序区可存储用于实现操作系统的指令、用于至少一个功能的指令、用于实现上述各个方法实施例的指令等;存储数据区可存储根据终端的使用所创建的数据等。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种资源加载方法,其特征在于,应用于安装有操作系统的终端中,所述方法包括:
    获取状态数据,所述状态数据用于表示所述操作系统的运行状态;
    将所述状态数据输入预测模型,得到预测统一资源定位符URL地址,所述预测模型是根据样本状态数据和样本URL地址确定的;
    将所述预测URL地址所存储的网页资源存储至预设空间;
    在接收到客户端生成的资源加载请求时,检测所述预设空间是否存储有所述资源加载请求所请求的网页资源;
    在所述预设空间存储有所述资源加载请求所请求的网页资源时,将所述网页资源反馈至所述客户端。
  2. 根据权利要求1所述的方法,其特征在于,所述检测所述预设空间是否存储有所述资源加载请求所请求的网页资源,包括:
    调用所述操作系统中的URL连接组件,所述URL连接组件具有与所述资源加载请求所携带的URL地址建立通信连接的功能;
    通过所述URL连接组件检测所述预设空间是否包括所述资源加载请求所请求的网页资源。
  3. 根据权利要求1所述的方法,其特征在于,所述预测模型为逻辑回归模型,所述逻辑回归模型用于对状态数据和URL地址进行分类;所述方法还包括:
    将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,对所述预测模型进行训练,得到训练后的预测模型;所述训练后的预测模型用于根据后续获取到的状态数据预测对应的预测URL地址。
  4. 根据权利要求1所述的方法,其特征在于,所述预测模型为贝叶斯模型;所述贝叶斯模型用于预测URL地址被访问的概率;所述方法还包括:
    将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,建立更新后的预测模型,所述更新后的预测模型用于根据下一次获取到的状态数据预测对应的预测URL地址。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述样本URL地址为访问时长大于预设时长的URL地址;和/或,所述样本URL地址为访问次数大于预设次数的URL地址。
  6. 根据权利要求1至4任一所述的方法,其特征在于,所述状态数据包括以下几种数据中的至少一种:
    用于表示是否接入无线网络的数据;
    用于表示前台运行的应用程序的数据;
    用于表示当前时间所处的时间段的数据;
    用于表示当前时间是否属于工作时间段的数据;
    用于表示当前时间是否属于休息时间段的数据;
    用于表示电池是否处于充电状态的数据;
    用于表示电池的剩余电量的数据。
  7. 根据权利要求1至4任一所述的方法,其特征在于,所述将所述预测URL地址所存储的网页资源缓存储至预设空间之后,还包括:
    对所述网页资源进行解析得到关联URL地址,所述关联URL地址是指所述预测URL地址所链接的其它URL地址;
    将所述关联URL地址所存储的其它网页资源缓存至所述预设空间。
  8. 根据权利要求1至4任一所述的方法,其特征在于,所述方法还包括:
    当所述预设空间中已存储的网络资源的资源大小达到预设大小时,清空所述预设空间;
    或,
    当所述预设空间中存储的网络资源的已存储时长达到预设时长时,清除达到所述预设时长的所述网络资源。
  9. 根据权利要求1至4任一所述的方法,其特征在于,所述获取状态数据,包括:
    每隔第一预设时长采集基础数据,所述基础数据是所述操作系统从当前运行的组件中获取的未经处理的数据;
    将所述基础数据的格式转换为输入预测模型的数据的格式,得到所述状态数据。
  10. 一种资源加载装置,其特征在于,所述装置包括:
    数据获取单元,用于获取状态数据,所述状态数据用于表示操作系统的运行状态;
    地址预测单元,用于将所述状态数据输入预测模型,得到预测统一资源定位符URL地址,所述预测模型是根据样本状态数据和样本URL地址确定的;
    资源存储单元,用于将所述预测URL地址所存储的网页资源存储至预设空间;
    资源检测单元,用于在接收到客户端生成的资源加载请求时,检测所述预设空间是否存储有所述资源加载请求所请求的网页资源;
    资源反馈单元,用于在所述预设空间存储有所述资源加载请求所请求的网页资源时,将所述网页资源反馈至所述客户端。
  11. 根据权利要求10所述的装置,其特征在于,所述资源检测单元,还用于调用所述操作系统中的URL连接组件,所述URL连接组件具有与所述资源加载请求所携带的URL地址建立通信连接的功能;通过所述URL连接组件检测所述预设空间是否包括所述资源加载请求所请求的网页资源。
  12. 根据权利要求10所述的装置,其特征在于,所述预测模型为逻辑回归模型,所述逻辑回归模型用于对状态数据和URL地址进行分类;所述装置还包括:模型训练单元。
    所述模型训练单元,用于将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,对所述预测模型进行训练,得到训练后的预测模型;所述训练后的预测模型用于根据后续获取到的状态数据预测对应的预测URL地址。
  13. 根据权利要求10所述的装置,其特征在于,所述预测模型为贝叶斯模型;所述贝叶斯模型用于预测URL地址被访问的概率;所述装置还包括:模型建立单元。
    所述模型建立单元,用于将所述状态数据作为所述样本状态数据,将所述资源加载请求中携带的URL地址作为所述样本URL地址,建立更新后的预测模型,所述更新后的预测模型用于根据下一次获取到的状态数据预测对应的预测URL地址。
  14. 根据权利要求10至13任一所述的装置,其特征在于,所述样本URL地址为访问时长大于预设时长的URL地址;和/或,所述样本URL地址为访问次数大于预设次数的URL地址。
  15. 根据权利要求10至13任一所述的装置,其特征在于,所述状态数据包括以下几种数据中的至少一种:
    用于表示是否接入无线网络的数据;
    用于表示前台运行的应用程序的数据;
    用于表示当前时间所处的时间段的数据;
    用于表示当前时间是否属于工作时间段的数据;
    用于表示当前时间是否属于休息时间段的数据;
    用于表示电池是否处于充电状态的数据;
    用于表示电池的剩余电量的数据。
  16. 根据权利要求10至13任一所述的装置,其特征在于,所述装置还包括:解析单元。
    所述解析单元,用于将所述预测URL地址所存储的网页资源存储至预设空间之后,对所述网页资源进行解析得到关联URL地址,所述关联URL地址是指所述预测URL地址所链接的其它URL地址;
    资源存储单元,还用于将所述关联URL地址所存储的其它网页资源缓存至所述预设空间。
  17. 根据权利要求10至13任一所述的装置,其特征在于,所述资源存储单元,还用于当所述预设空间中已存储的网络资源的资源大小达到预设大小时,清空所述预设空间;
    或,
    所述资源存储单元,还用于当所述预设空间中存储的网络资源的已存储时长达到预设时长时,清除达到所述预设时长的所述网络资源。
  18. 根据权利要求10至13任一所述的装置,其特征在于,所述数据获取单元,还用于每隔第一预设时长采集基础数据,所述基础数据是所述操作系统从当前运行的组件中获取的未经处理的数据;将所述基础数据的格式转换为输入预测模型的数据的格式,得到所述状态数据。
  19. 一种终端,其特征在于,所述终端包括处理器、与所述处理器相连的存储器,以及存储在所述存储器上的程序指令,所述处理器执行所述程序指令时实现如权利要求1至9任一所述的资源加载方法。
  20. 一种计算机可读存储介质,其特征在于,其上存储有程序指令,所述程序指令被处理器执行时实现如权利要求1至9任一所述的资源加载方法。
PCT/CN2018/116248 2017-12-05 2018-11-19 资源加载的方法、装置、终端及存储介质 WO2019109798A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711268145.X 2017-12-05
CN201711268145.XA CN110020310A (zh) 2017-12-05 2017-12-05 资源加载的方法、装置、终端及存储介质

Publications (1)

Publication Number Publication Date
WO2019109798A1 true WO2019109798A1 (zh) 2019-06-13

Family

ID=66750773

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/116248 WO2019109798A1 (zh) 2017-12-05 2018-11-19 资源加载的方法、装置、终端及存储介质

Country Status (2)

Country Link
CN (1) CN110020310A (zh)
WO (1) WO2019109798A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691125A (zh) * 2019-09-24 2020-01-14 上海富数科技有限公司 基于启发式算法实现浏览器加载控制的系统及其方法
CN111158807A (zh) * 2019-11-29 2020-05-15 华为技术有限公司 一种基于云虚拟机的数据访问方法及设备
CN111666497B (zh) * 2020-06-16 2023-06-06 腾讯科技(上海)有限公司 应用程序的加载方法、装置、电子设备及可读存储介质
CN115827947B (zh) * 2023-02-03 2023-04-25 北京匠数科技有限公司 采集分页网站数据的方法、装置及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102438045A (zh) * 2011-12-07 2012-05-02 深圳市深信服电子科技有限公司 Web页面的预取方法、系统以及访问web页面的方法
CN103440276A (zh) * 2013-08-08 2013-12-11 星云融创(北京)信息技术有限公司 一种提高网页显示速度的方法及装置
CN103905439A (zh) * 2014-03-25 2014-07-02 重庆邮电大学 一种基于家庭网关的加速网页浏览方法
CN106611032A (zh) * 2015-10-27 2017-05-03 广州市动景计算机科技有限公司 一种网页预加载的方法及装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6925485B1 (en) * 2002-05-24 2005-08-02 Sun Microsystems, Inc. Proxy cache preloader
CN103139278A (zh) * 2011-12-05 2013-06-05 北京网康科技有限公司 一种网络资源预取并缓存加速的方法及其装置
CN103729438B (zh) * 2013-12-30 2017-06-16 优视科技有限公司 网页预加载方法及装置
CN104298780B (zh) * 2014-11-05 2018-01-12 百纳(武汉)信息技术有限公司 一种浏览器网页信息的预获取方法及系统
CN104361067B (zh) * 2014-11-05 2018-07-20 百纳(武汉)信息技术有限公司 一种浏览器网页信息的智能加载方法及系统
CN104536787B (zh) * 2014-12-26 2018-05-18 小米科技有限责任公司 资源预加载方法及装置
CN104657183B (zh) * 2015-03-09 2018-11-09 联想(北京)有限公司 信息处理方法、装置及电子设备
CN104794004B (zh) * 2015-03-17 2018-09-04 中国石油天然气集团公司 信息预加载的方法
CN105610909B (zh) * 2015-12-21 2019-01-18 北京大学 一种基于云-端协同的移动浏览器资源加载优化方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102438045A (zh) * 2011-12-07 2012-05-02 深圳市深信服电子科技有限公司 Web页面的预取方法、系统以及访问web页面的方法
CN103440276A (zh) * 2013-08-08 2013-12-11 星云融创(北京)信息技术有限公司 一种提高网页显示速度的方法及装置
CN103905439A (zh) * 2014-03-25 2014-07-02 重庆邮电大学 一种基于家庭网关的加速网页浏览方法
CN106611032A (zh) * 2015-10-27 2017-05-03 广州市动景计算机科技有限公司 一种网页预加载的方法及装置

Also Published As

Publication number Publication date
CN110020310A (zh) 2019-07-16

Similar Documents

Publication Publication Date Title
WO2019109798A1 (zh) 资源加载的方法、装置、终端及存储介质
US10592837B2 (en) Identifying security risks via analysis of multi-level analytical records
US9773011B2 (en) On-demand caching in a WAN separated distributed file system or clustered file system cache
EP2946333B1 (en) Efficient query processing using histograms in a columnar database
US20190379762A1 (en) Data prefetching for large data systems
US20190392258A1 (en) Method and apparatus for generating information
WO2017097231A1 (zh) 话题处理方法及装置
CN107423535B (zh) 用于确定用户的医疗状况的方法、装置和系统
CN109471783B (zh) 预测任务运行参数的方法和装置
CN110855648B (zh) 一种网络攻击的预警控制方法及装置
US11550937B2 (en) Privacy trustworthiness based API access
CN113610239A (zh) 针对机器学习的特征处理方法及特征处理系统
CN110535850B (zh) 帐号登录的处理方法和装置、存储介质及电子装置
US20230106106A1 (en) Text backup method, apparatus, and device, and computer-readable storage medium
CN114415965A (zh) 一种数据迁移方法、装置、设备及存储介质
CN114022711A (zh) 工业标识数据缓存处理方法及装置、介质及电子设备
CN112330059B (zh) 用于生成预测分数的方法、装置、电子设备和介质
Raghav et al. Bigdata fog based cyber physical system for classifying, identifying and prevention of SARS disease
CN114495137B (zh) 票据异常检测模型生成方法与票据异常检测方法
CN112948223A (zh) 一种监测运行情况的方法和装置
CN112650940A (zh) 应用程序的推荐方法、装置、计算机设备及存储介质
WO2019061996A1 (zh) 销售人员话题辅助查询方法、电子装置及存储介质
CN114297462A (zh) 一种基于动态自适应的网站异步序列数据智能采集方法
CN113868481A (zh) 组件获取方法、装置及电子设备和存储介质
CN108810573B (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: 18885301

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: 18885301

Country of ref document: EP

Kind code of ref document: A1