CN107014635B - Grain uniform sampling method and device - Google Patents
Grain uniform sampling method and device Download PDFInfo
- Publication number
- CN107014635B CN107014635B CN201710230778.5A CN201710230778A CN107014635B CN 107014635 B CN107014635 B CN 107014635B CN 201710230778 A CN201710230778 A CN 201710230778A CN 107014635 B CN107014635 B CN 107014635B
- Authority
- CN
- China
- Prior art keywords
- sampling
- grain processing
- recurrence
- sequence
- subsequence
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N1/00—Sampling; Preparing specimens for investigation
- G01N1/02—Devices for withdrawing samples
Landscapes
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Measuring Or Testing Involving Enzymes Or Micro-Organisms (AREA)
Abstract
A kind of grain uniform sampling method and device provided in an embodiment of the present invention, is related to grain sampling techniques field.The method includes the grain processing amount in the n grain processing region based on acquisition and preset specific gravity computation rules, obtain the ratio in n grain processing region respectively;The ratio in n grain processing region is ranked up, grain processing regional sequence is obtained;Based on divide and conquer, grain processing regional sequence is divided into t subsequence, to obtain t sampling area;Calculate the cumulative of each element in each sampling area and, and respectively will be cumulative and multiplied by default sampling constant, to obtain the sampling number of each sampling area respectively;If sampling number is greater than 0, cumulative and the grain processing region in the sampling area ratio and distribution sample calculation rule based on each element in sampling number, sampling area obtain the frequency in sampling in the grain processing region.The uniform sampling in multiple grain processing regions is realized using divide and conquer.
Description
Technical field
The present invention relates to grain sampling techniques fields, in particular to a kind of grain uniform sampling method and device.
Background technique
In order to estimate grain loss waste problem during national grain processing, need to carry out national grain processing enterprise
Extensive sampling.Due to being limited by human and material resources and financial resources, the number of sampling is often limited.Due to different main grains
The grain processing amount in producing region is different, therefore needs to formulate reasonable sampling plan.Theoretically, the more region of grain processing adopts
Sample, the fewer sampling in the fewer region of grain processing.For certain grain, the different province in the whole nation, autonomous region have jurisdiction over city to this kind of grain certainly
There are great differences for the processing capacity of food.Many provinces lead to the grain in these provinces since the amount for processing this kind of grain is fewer
It can not be sampled.However, the total amount of these provinces processing grain is bigger, if will lead to national grain without sampling
Estimate and serious distortion occur, lack reasonable sampling plan at present.
Summary of the invention
In view of this, the embodiment of the present invention is designed to provide a kind of grain uniform sampling method and device, to improve
The above problem.To achieve the goals above, the technical solution adopted by the present invention is as follows:
In a first aspect, present example provides a kind of grain uniform sampling method, the method includes the n based on acquisition
The grain processing amount in a grain processing region and preset specific gravity computation rule, obtain n grain processing region respectively
Ratio;The ratio in n grain processing region is ranked up, grain processing regional sequence is obtained;It, will based on divide and conquer
The grain processing regional sequence is divided into t subsequence, using each subsequence as a sampling area, is adopted with obtaining t
Sample region;Calculate the cumulative of each element in each sampling area and, and described will add up and multiplied by default sampling respectively
Constant, to obtain the sampling number of each sampling area respectively, wherein the element is the ratio in grain processing region;
If the sampling number is greater than 0, based on each element in the sampling number, the corresponding sampling area of the sampling number
The ratio and distribution sample calculation rule in the grain processing region in the cumulative and sampling area, obtain the grain processing area
The frequency in sampling in domain.
Second aspect, the embodiment of the invention provides a kind of grain uniform sampling device, described device includes that ratio obtains
Unit, grain processing amount and preset specific gravity computation rule for the n grain processing region based on acquisition, obtains respectively
The ratio in n grain processing region;Sequence obtaining unit, for arranging the ratio in n grain processing region
Sequence obtains grain processing regional sequence;The grain processing regional sequence is divided into t for being based on divide and conquer by cutting unit
A subsequence, using each subsequence as a sampling area, to obtain t sampling area;Sampling number obtaining unit, is used for
Calculate the cumulative of each element in each sampling area and, and respectively will be described cumulative and multiplied by default sampling constant, divide
The sampling number of each sampling area is not obtained, wherein the element is the ratio in grain processing region;Frequency in sampling obtains
Unit is obtained, if being greater than 0 for the sampling number, is based on the sampling number, the corresponding sampling area of the sampling number
The ratio and distribution sample calculation rule in the grain processing region in cumulative and sampling area of interior each element, obtain
The frequency in sampling in the grain processing region.
A kind of grain uniform sampling method and device provided in an embodiment of the present invention, is added by the n grain based on acquisition
The grain processing amount in work area domain and preset specific gravity computation rule, obtain the ratio in n grain processing region respectively;It will
The ratio in n grain processing region is ranked up, and obtains grain processing regional sequence;Based on divide and conquer, by the grain
Machining area sequences segmentation is t subsequence, using each subsequence as a sampling area, to obtain t sampling area;Meter
Calculate the cumulative of each element in each sampling area and, and respectively will be described cumulative and multiplied by default sampling constant, to divide
The sampling number of each sampling area is not obtained, wherein the element is the ratio in grain processing region;If the sampling
Number is greater than 0, then cumulative based on each element in the sampling number, the corresponding sampling area of the sampling number and should
The ratio and distribution sample calculation rule in the grain processing region in sampling area, obtain the sampling time in the grain processing region
Number.It uses divide and conquer by multiple grain processing region divisions for different sampling areas, then each sampling area is layered
Sampling, realizes the uniform sampling in multiple grain processing regions.
Other features and advantages of the present invention will be illustrated in subsequent specification, also, partly be become from specification
It is clear that by implementing understanding of the embodiment of the present invention.The objectives and other advantages of the invention can be by written theory
Specifically noted structure is achieved and obtained in bright book, claims and attached drawing.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as pair
The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this
A little attached drawings obtain other relevant attached drawings.
Fig. 1 is a kind of structural block diagram that can be applied to the electronic equipment in the embodiment of the present application;
Fig. 2 is the flow chart for the grain uniform sampling method that first embodiment of the invention provides;
Fig. 3 is the schematic diagram data for the national rice processing capacity in 2016 that first embodiment of the invention provides;
Fig. 4 is the T=50 that first embodiment of the invention provides, the uniform sampling result schematic diagram of s=0.4;
Fig. 5 is the T=50 that first embodiment of the invention provides, the uniform sampling result schematic diagram of s=0.6;
Fig. 6 is the T=50 that first embodiment of the invention provides, the uniform sampling result schematic diagram of s=0.8;
Fig. 7 is the structural block diagram for the grain uniform sampling device that second embodiment of the invention provides.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, technical solution in the embodiment of the present invention carries out clear, complete
Ground description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Usually exist
The component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.Cause
This, is not intended to limit claimed invention to the detailed description of the embodiment of the present invention provided in the accompanying drawings below
Range, but it is merely representative of selected embodiment of the invention.Based on the embodiment of the present invention, those skilled in the art are not doing
Every other embodiment obtained under the premise of creative work out, shall fall within the protection scope of the present invention.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi
It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile of the invention
In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Referring to Fig. 1, Fig. 1 shows a kind of structural block diagram of electronic equipment 100 that can be applied in the embodiment of the present application.
The electronic equipment 100 can be used as user terminal, be also possible to computer or server, the user terminal can for mobile phone or
Tablet computer.As shown in Figure 1, electronic equipment 100 may include memory 110, storage control 111, processor 112 and grain
Uniform sampling device.
Memory 110, storage control 111 are directly or indirectly electrically connected between each element of processor 112, to realize
The transmission or interaction of data.For example, can realize electricity by one or more communication bus or signal bus between these elements
Connection.Grain uniform sampling method respectively includes at least one can be stored in the form of software or firmware (firmware)
Software function module in reservoir 110, such as the grain uniform sampling device software function module that includes or computer journey
Sequence.
Memory 110 can store various software programs and module, and such as grain equilibrium provided by the embodiments of the present application is taken out
Quadrat method and the corresponding program instruction/module of device.Software program of the processor 112 by operation storage in the memory 110
And module, thereby executing various function application and data processing, i.e. grain uniform sampling in realization the embodiment of the present application
Method.Memory 110 can include but is not limited to random access memory (Random Access Memory, RAM), read-only to deposit
Reservoir (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only Memory,
PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electric erasable
Read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM) etc..
Processor 112 can be a kind of IC chip, have signal handling capacity.Above-mentioned processor can be general
Processor, including central processing unit (Central Processing Unit, abbreviation CPU), network processing unit (Network
Processor, abbreviation NP) etc.;It can also be digital signal processor (DSP), specific integrated circuit (ASIC), ready-made programmable
Gate array (FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components.It can
To realize or execute disclosed each method, step and the logic diagram in the embodiment of the present application.General processor can be micro-
Processor or the processor are also possible to any conventional processor etc..
First embodiment
Referring to Fig. 2, the embodiment of the invention provides a kind of grain uniform sampling methods, which comprises
Step S200: the grain processing amount in the n grain processing region based on acquisition and preset specific gravity computation rule,
The ratio in n grain processing region is obtained respectively.
Specifically, it is based onThe ratio in n grain processing region is obtained respectively,
In,wiFor the grain processing amount in i-th of grain processing region, W is grain processing total amount, piAdd for i-th of grain
The ratio in work area domain.
In the present embodiment, if can be carried out the province of certain grain processing, autonomous region and a total of n of municipality directly under the Central Government, and this n
Grain processing region is w in year processing capacity of a certain year to this kind of grainiTen thousand tons of (i=1,2 ..., n), that is, get n grain
The grain processing amount of machining area, then the processing total amount W of this kind of grain in this year are as follows:
In formula (1), wiFor the grain processing amount in i-th of grain processing region, W is grain processing total amount.The grain
It may include paddy, wheat, peanut, soybean, rapeseed etc..
Based on formula (2), the ratio p in n grain processing region is obtained respectivelyi(i=1,2 ..., n), is at this
The grain processing amount of 1 year each machining area accounts for the percentage of the processing total amount of this kind of grain:
Wherein, formula (2) is the preset specific gravity computation rule.
Step S210: the ratio in n grain processing region is ranked up, and obtains grain processing regional sequence.
Sequence can be ascending order arrangement or descending arrangement.In the present embodiment, by the ratio in n grain processing region
Value carries out descending arrangement, obtains grain processing regional sequence.
For example, the ratio P=p in the n grain processing region to acquisition1p2…pnDescending arrangement is carried out, is obtained new
Percent sequence X=x1x2…xn, wherein x1≥x2≥…≥xn, i.e., new Percent sequence X=x1x2…xnAdd for the grain
Work regional sequence.
Step S220: being based on divide and conquer, the grain processing regional sequence be divided into t subsequence, by every sub- sequence
Column are used as a sampling area, to obtain t sampling area.
Stratified sampling is carried out to grain processing region in order to realize, is needed to the grain processing regional sequence in descending arrangement
It is split, i.e., the descending sequence for being divided into several not overlap a descending sequence.
Based on step S220, a part of sequence in the grain processing regional sequence is obtained, and by a part of sequence
Column as recurrence minor structure and according toGreatest member and least member in the recurrence minor structure is calculated
Relative distance, wherein xixi+1…xjFor the recurrence minor structure, xiFor greatest member in the recurrence minor structure, xjFor institute
State least member in recurrence minor structure, cijFor the relative distance of greatest member and least member in the recurrence minor structure.
For example, setting sequence xixi+1…xjFor the grain processing regional sequence X=x1x2…xnIn a part, then have xi
≥xj>0.Therefore, following inequality sets up:
IfIt is xiAnd xjBetween relative distance, then 0≤c is obtained by (3) formulaij<1.If it is desired to one is dropped
Sequence sequence xixi+1…xjBecome two descending sequences, then it needs to be determined that its open position.If segmentation threshold is preset as s, and 0≤s <
1, it might as well be arranged as follows: if cij>=s, then can be by xixi+1…xjTwo descending sequences are fragmented into, otherwise, cannot be disconnected.Such as
Fruit can disconnect, then might as well set open position as mij。
Further, if j > i, cij>=s, then basisThe equal of element in the recurrence minor structure is calculated
Value, wherein s is default segmentation threshold, and a is the mean value of element in the recurrence minor structure, and k is open position value, k ∈ { i, i+
1 ..., j-1 } and meet xk>=a and xk+1<a。
According to mij=k | xk≥a,xk+1< a, k ∈ { i, i+1 ..., j-1 } are calculated disconnected in the recurrence minor structure
Open position, wherein mijFor the open position in the recurrence minor structure.
For example, obtaining recurrence minor structure x according to formula (4)ixi+1…xjMean value a.
Obviously, unique k ∈ { i, i+1 ..., j-1 } is certainly existed, so that xk>=a and xk+1<a.Define recurrence minor structure
xixi+1…xjOpen position mijIt is as follows:
mij=k | xk≥a,xk+1<a,k∈{i,i+1,…,j-1} (5)
As the above analysis, if j > i and cij>=s, then recurrence minor structure xixi+1…xjThe first recurrence can be broken into
SequenceWith the second recurrence subsequence
Therefore, recurrence minor structure xixi+1…xjIt can be as follows according to formula (5) recurrence Ground Split:
Recurrence finds out the open position of the first recurrence subsequence, xi…xkFor the first recurrence subsequence, mikIt is described
The open position and recurrence of first recurrence subsequence find out the open position of the second recurrence subsequence, xk+1…xjIt is described
Two recurrence subsequences, mk+1,jFor the open position of the second recurrence subsequence.
The open position k of first recurrence subsequence and the second recurrence subsequence is recursively solved by (5) and (6) formula.
Based on above step, all open positions of the grain processing regional sequence are calculated, to obtain t sub- sequences
Column, using each subsequence as a sampling area, to obtain t sampling area.
If j≤i or cij< s, then have mij=0, i.e. xixi+1…xjIt does not need to disconnect.If above-mentioned recursive procedure function
f(xixi+1…xj) indicate, then pass through f (x1x2…xn) grain processing regional sequence x can be found out1x2…xnAll open positions.
Further, by seeking mijRecursive algorithm it is found that if mij=0, then it represents that grain processing regional sequence xixi+1…xj
It does not need to disconnect.If mij≠ 0, then mijFor xixi+1…xjOpen position.x1x2…xnAt most also there was only n-1 open position.
X is found out for convenience1x2…xnThe subsequence after disconnecting, might as well be by x1x2…xnAll open position linear lists
It indicates.
A linear list is obtained, t=0 is the initial position of the linear list;
If j > i and mij≠ 0, then it is based on t=t+1, St=mijIt carries out recursive calculation and successively stores calculated result to institute
It states in linear list, until j=i or cij< s obtains the position break sequence, wherein S1S2…St-1For position disconnection
Sequence, i=1 and j=n are illustrated respectively in the head of the queue element and tail of the queue element of grain processing regional sequence described in the linear list
Storage location.
For example, obtaining a linear list, t=0 is the initial position of the linear list;If j > i and mij≠ 0, then recurrence mistake
Journey g (xi…xj) execute it is as follows:
T=t+1, St=mij;
Recurrence executes
Recurrence executesUntil being unsatisfactory for j > i and mij≠ 0, recursive procedure terminates.
By above-mentioned recursive procedure, all open positions of the grain processing regional sequence are calculated, obtain position
The position break sequence is simultaneously carried out ascending order arrangement by break sequence, to obtain t subsequence, using each subsequence as one
Sampling area, to obtain t sampling area;
Wherein, the t sampling area isI=0,1 ... t-1, S0=1, St=n, S1S2…St-1For institute
Rheme sets break sequence, x1x2…xnFor the grain processing regional sequence.
Specifically, recursive resolve obtains the grain processing regional sequence x1x2…xnPosition break sequence S1S2…St。
To S1S2…StElement carry out ascending order arrangement, S can be made1≤S2≤…≤St.Enable S0=1 and St+1=n, then x1x2…xnIt is disconnected
It is as follows to be split into t subsequence:I=0,1 ... t-1, using each subsequence as a sampling area, x1x2…xn
It can be broken into t sampling area, i.e.,I=0,1 ... t-1.
Step S230: calculate the cumulative of each element in each sampling area and, and respectively will be described cumulative and multiply
With default sampling constant, to obtain the sampling number of each sampling area respectively, wherein the element is grain processing area
The ratio in domain.
Specifically, t sampling area:I=0,1 ... t-1 calculate each member in each sampling area
Element cumulative and, it may be assumed that
In formula (7), i=0,1 ..., t-1, QiFor ith sample region each element cumulative and.The element is
The ratio in grain processing region, i.e.,I=0,1 ... t-1.
Further according to the cumulative of each element in each sampling area and multiplied by default sampling constant, to obtain each institute respectively
State the sampling number of sampling area, it may be assumed that
Ri=[QiT] (8)
In formula (8), i=0,1 ..., t-1, RiFor the sampling number in ith sample region, QiFor ith sample region
Each element cumulative and, T is default sampling constant, can set according to actual needs, for example, T can be 50, expression pair
The processing capacity in all grain processing regions carries out 50 samplings.
Step S240: if the sampling number is greater than 0, based on the sampling number, the sampling number is corresponding adopts
The ratio in the grain processing region in cumulative and sampling area of each element in sample region and distribution sample calculation rule
Then, the frequency in sampling in the grain processing region is obtained.
It is based on based on step S240 if the sampling number is greater than 0Q=Si+1,…,Si+1, it is somebody's turn to do
The frequency in sampling in grain processing region, whereinI=0,1 ... t-1 are ith sample region, vqAdd for the grain
The frequency in sampling in work area domain, RiFor the sampling number, QiFor the tired of each element in the corresponding sampling area of the sampling number
Adduction, xqFor the ratio in the grain processing region in the sampling area.
Specifically, if in ith sample regionI=0,1 ... the sampling number R of t-1iGreater than 0, then exist
The assignment problem of sampling number in the region, specific as follows:
In formula (9), vqFor the frequency in sampling in the grain processing region, RiFor the sampling number, QiFor the sampling time
The cumulative and x of each element in the corresponding sampling area of numberqFor the ratio in the grain processing region in the sampling area.Formula
It (9) is the distribution sample calculation rule.Due to rounding error, certainly existWith(i=0,1 ...,
t-1).For example, xqIt can be expressed as the percentage that q-th of grain processing region (q-th of province) processes the grain, vqIt can be with table
It is shown as the frequency in sampling distributed in the grain processing region (province).
In order to further explain beneficial effects of the present invention, in the present embodiment, by grain provided in an embodiment of the present invention
Uniform sampling method is eaten to be applied in the uniform sampling conceptual design of national paddy processing amount in 2016.Referring to Fig. 3, Fig. 3 is
The schematic diagram data for the national rice processing capacity in 2016 that first embodiment of the invention provides, in Fig. 3, the unit of processing capacity is ten thousand
Ton, national rice processing capacity in 2016 are 127,490,000 tons, altogether 29 grain processing regions (save, autonomous region and municipality directly under the Central Government) with
And the processing capacity in each grain processing region.
Sampling constant is preset using grain uniform sampling method provided in an embodiment of the present invention based on data shown in Fig. 3
T is 50 i.e. to national 50 samplings of paddy processing amount progress in 2016, and default segmentation threshold s is taken as 0.4, and uniform sampling result is such as
Shown in Fig. 4, first row indicates sampling area, the processing ratio in the second class of the representation sampling area, and third column indicate the sampling
Each paddy processing region in region, the 4th column indicate the sampling area in each paddy processing region processing ratio, the 5th
Column indicate that the frequency in sampling in each paddy processing region in the sampling area, the 6th column indicate the total sampling of the sampling area
Number.The frequency in sampling of 12 sampling areas and each paddy processing region is obtained altogether.
Similarly, when default sampling constant T is 50, default segmentation threshold s is taken as 0.6, uniform sampling result as shown in figure 5,
The frequency in sampling of 9 sampling areas and each paddy processing region is obtained altogether.It is 50 when presetting sampling constant T, presets and divide
It cuts threshold value s and is taken as 0.8, uniform sampling result is as shown in fig. 6, obtain altogether 6 sampling areas and each paddy processing region
Frequency in sampling.
For the reasonable Sampling in China grain processing region, proposition of the embodiment of the present invention realizes processing district with divide and conquer
The aligned sample in domain.By aligned sample, the grain in the whole nation can be made to estimate more accurate.The scheme of one aligned sample, both
Consider major grain producing area should overabsorption sample number, it is further contemplated that grain lacks the hits problem in producing region.Therefore the present invention is implemented
The grain uniform sampling method that example provides can well solve the reasonable Sampling in grain processing region.
A kind of grain uniform sampling method provided in an embodiment of the present invention passes through the n grain processing region based on acquisition
Grain processing amount and preset specific gravity computation rule, obtain the ratio in n grain processing region respectively;By the n
The ratio in a grain processing region is ranked up, and obtains grain processing regional sequence;Based on divide and conquer, by the grain processing area
Domain sequences segmentation is t subsequence, using each subsequence as a sampling area, to obtain t sampling area;It calculates each
Each element in the sampling area cumulative and, and described will add up respectively and multiplied by default sampling constant, to obtain respectively
The sampling number of each sampling area, wherein the element is the ratio in grain processing region;If the sampling number is big
In 0, then cumulative and sample region based on each element in the sampling number, the corresponding sampling area of the sampling number
The ratio and distribution sample calculation rule in the grain processing region in domain, obtain the frequency in sampling in the grain processing region.It adopts
By multiple grain processing region divisions it is different sampling areas with divide and conquer, then stratified sampling is carried out to each sampling area,
Realize the uniform sampling in multiple grain processing regions.
Second embodiment
Referring to Fig. 7, the embodiment of the invention provides a kind of grain uniform sampling device 300, shown device 300 includes:
Ratio obtaining unit 310, grain processing amount and preset ratio for the n grain processing region based on acquisition
Re-computation rule, obtains the ratio in n grain processing region respectively.
As an implementation, ratio obtaining unit 310 may include that ratio obtains subelement 311.
Ratio obtains subelement 311, for being based onThe n grain is obtained respectively
The ratio of machining area, whereinwiFor the grain processing amount in i-th of grain processing region, W is that grain processing is total
Amount, piFor the ratio in i-th of grain processing region.
Sequence obtaining unit 320 obtains grain processing for the ratio in n grain processing region to be ranked up
Regional sequence.
As an implementation, sequence obtaining unit 320 may include that sequence obtains subelement 321.
Sequence obtains subelement 321, for the ratio in n grain processing region to be carried out descending arrangement, obtains grain
Eat machining area sequence.
Cutting unit 330 will be every for based on divide and conquer, the grain processing regional sequence to be divided into t subsequence
A subsequence is as a sampling area, to obtain t sampling area.
As an implementation, cutting unit 330 may include that relative distance obtains subelement 331, mean value obtains son
Unit 332, open position obtain subelement 333, recursive calculation subelement 334 and sampling area and obtain subelement 335.
Relative distance obtains subelement 331, for obtaining a part of sequence in the grain processing regional sequence, and will
A part of sequence as recurrence minor structure and according toGreastest element in the recurrence minor structure is calculated
The relative distance of element and least member, wherein xixi+1…xjFor the recurrence minor structure, xiIt is maximum in the recurrence minor structure
Element, xjFor least member in the recurrence minor structure, cijFor the phase of greatest member and least member in the recurrence minor structure
It adjusts the distance.
Mean value obtains subelement 332, if being used for j > i, cij>=s, then basisThe recurrence knot is calculated
The mean value of element in structure, wherein s is default segmentation threshold, and a is the mean value of element in the recurrence minor structure, and k is open position
Value, k ∈ { i, i+1 ..., j-1 } and meets xk>=a and xk+1<a。
Open position obtains subelement 333, for according to mij=k | xk≥a,xk+1< a, k ∈ { i, i+1 ..., j-1 }, meter
Calculation obtains the open position in the recurrence minor structure, wherein mijFor the open position in the recurrence minor structure.
Recursive calculation subelement 334 finds out the open position of the first recurrence subsequence, x for recurrencei…xkIt is described
One recurrence subsequence, mikThe disconnected of the second recurrence subsequence is found out for the open position and recurrence of the first recurrence subsequence
Open position, xk+1…xjFor the second recurrence subsequence, mk+1,jFor the open position of the second recurrence subsequence.
Sampling area obtains subelement 335, and for being based on above step, the grain processing regional sequence is calculated
All open positions, to obtain t subsequence, using each subsequence as a sampling area, to obtain t sampling area.
As an implementation, it may include that linear list obtains subelement 336 and breaks that sampling area, which obtains subelement 335,
It opens sequence and obtains subelement 337.
Linear list obtains subelement 336, and for obtaining a linear list, t=0 is the initial position of the linear list.
Break sequence obtains subelement 337, if being used for j > i and mij≠ 0, then it is based on t=t+1, St=mijCarry out recurrence meter
It calculates and successively stores calculated result in the linear list, until j=i or cij< s obtains the position break sequence,
In, S1S2…St-1For the position break sequence, i=1 and j=n are illustrated respectively in grain processing area described in the linear list
The head of the queue element of domain sequence and the storage location of tail of the queue element.
Sampling number obtaining unit 340, for calculate the cumulative of each element in each sampling area and, and respectively
Will be described cumulative and multiplied by default sampling constant, the sampling number of each sampling area is obtained respectively, wherein the element
For the ratio in grain processing region.
Frequency in sampling obtaining unit 350 based on the sampling number, described is adopted if being greater than 0 for the sampling number
The ratio in the grain processing region in cumulative and sampling area of each element in the corresponding sampling area of sample number and point
With sample calculation rule, the frequency in sampling in the grain processing region is obtained.
As an implementation, frequency in sampling obtaining unit 350 may include that frequency in sampling obtains subelement 351.
Frequency in sampling obtains subelement 351, if being greater than 0 for the sampling number, is based onQ=Si+
1,…,Si+1, obtain the frequency in sampling in the grain processing region, whereinI=0,1 ... t-1 is ith sample area
Domain, vqFor the frequency in sampling in the grain processing region, RiFor the sampling number, QiFor the corresponding sample region of the sampling number
The cumulative and x of each element in domainqFor the ratio in the grain processing region in the sampling area.
The above each unit can be by software code realization, at this point, above-mentioned each unit can be stored in memory 110.
The above each unit can equally be realized by hardware such as IC chip.
The technical effect of grain uniform sampling device 300 provided in an embodiment of the present invention, realization principle and generation is with before
It is identical to state embodiment of the method, to briefly describe, Installation practice part does not refer to place, can refer to phase in preceding method embodiment
Answer content.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass through
Other modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and block diagram in attached drawing
Show the device of multiple embodiments according to the present invention, the architectural framework in the cards of method and computer program product,
Function and operation.In this regard, each box in flowchart or block diagram can represent the one of a module, section or code
Part, a part of the module, section or code, which includes that one or more is for implementing the specified logical function, to be held
Row instruction.It should also be noted that function marked in the box can also be to be different from some implementations as replacement
The sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimes
It can execute in the opposite order, this depends on the function involved.It is also noted that every in block diagram and or flow chart
The combination of box in a box and block diagram and or flow chart can use the dedicated base for executing defined function or movement
It realizes, or can realize using a combination of dedicated hardware and computer instructions in the system of hardware.
In addition, each functional module in each embodiment of the present invention can integrate one independent portion of formation together
Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function module
It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a
People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.It needs
Illustrate, herein, relational terms such as first and second and the like be used merely to by an entity or operation with
Another entity or operation distinguish, and without necessarily requiring or implying between these entities or operation, there are any this realities
The relationship or sequence on border.Moreover, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludability
Contain, so that the process, method, article or equipment for including a series of elements not only includes those elements, but also including
Other elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device.
In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the element
Process, method, article or equipment in there is also other identical elements.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field
For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair
Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.It should also be noted that similar label and letter exist
Similar terms are indicated in following attached drawing, therefore, once being defined in a certain Xiang Yi attached drawing, are then not required in subsequent attached drawing
It is further defined and explained.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Claims (10)
1. a kind of grain uniform sampling method, which is characterized in that the described method includes:
The grain processing amount in the n grain processing region based on acquisition and preset specific gravity computation rule, obtain the n respectively
The ratio in a grain processing region;
The ratio in n grain processing region is ranked up, grain processing regional sequence is obtained;
Based on divide and conquer, the grain processing regional sequence is divided into t subsequence, is sampled each subsequence as one
Region, to obtain t sampling area;
Calculate the cumulative of each element in each sampling area and, and respectively will it is described cumulative and multiplied by default sampling often
Number, to obtain the sampling number of each sampling area respectively, wherein the element is the ratio in grain processing region;
If the sampling number is greater than 0, based on each member in the sampling number, the corresponding sampling area of the sampling number
The ratio and distribution sample calculation rule in the grain processing region in cumulative and sampling area of element, obtain the grain and add
The frequency in sampling in work area domain.
2. the method according to claim 1, wherein the ratio by n grain processing region carries out
Sequence obtains grain processing regional sequence, comprising:
The ratio in n grain processing region is subjected to descending arrangement, obtains grain processing regional sequence.
3. according to the method described in claim 2, it is characterized in that, the grain in the n grain processing region based on acquisition
Processing capacity and preset specific gravity computation rule, obtain the ratio in n grain processing region respectively, comprising:
It is based onThe ratio in n grain processing region is obtained respectively, whereinwiFor the grain processing amount in i-th of grain processing region, W is grain processing total amount, piFor i-th of grain processing area
The ratio in domain.
4. according to the method described in claim 2, it is characterized in that, described be based on divide and conquer, by grain processing region sequence
Column split is t subsequence, using each subsequence as a sampling area, to obtain t sampling area, comprising:
Obtain a part of sequence in the grain processing regional sequence, and using a part of sequence as recurrence minor structure with
And according toThe relative distance of greatest member and least member in the recurrence minor structure is calculated, wherein
xixi+1…xjFor the recurrence minor structure, xiFor greatest member in the recurrence minor structure, xjFor in the recurrence minor structure most
Small element, cijFor the relative distance of greatest member and least member in the recurrence minor structure;
If j > i, cij>=s, then basisThe mean value of element in the recurrence minor structure is calculated, wherein s is default
Segmentation threshold, a are the mean value of element in the recurrence minor structure, and k is open position value, k ∈ { i, i+1 ..., j-1 } and satisfaction
xk>=a and xk+1<a;
According to mij=k | xk≥a,xk+1< a, k ∈ { i, i+1 ..., j-1 }, are calculated the disconnection position in the recurrence minor structure
It sets, wherein mijFor the open position in the recurrence minor structure;
Recurrence finds out the open position of the first recurrence subsequence, xi…xkFor the first recurrence subsequence, mikIt is passed for described first
The open position of subsequence and recurrence is returned to find out the open position of the second recurrence subsequence, xk+1…xjFor second recurrence
Subsequence, mk+1,jFor the open position of the second recurrence subsequence;
Based on above step, all open positions of the grain processing regional sequence are calculated, to obtain t subsequence,
Using each subsequence as a sampling area, to obtain t sampling area.
5. according to the method described in claim 4, it is characterized in that, the institute that the grain processing regional sequence is calculated
There is open position, to obtain t subsequence, using each subsequence as a sampling area, to obtain t sampling area, packet
It includes:
All open positions of the grain processing regional sequence are calculated, obtain position break sequence and the position is broken
It opens sequence and carries out ascending order arrangement, to obtain t subsequence, using each subsequence as a sampling area, to obtain t sampling
Region;
Wherein, the t sampling area isIt is described
Position break sequence, x1x2…xnFor the grain processing regional sequence.
6. according to the method described in claim 5, it is characterized in that, the institute that the grain processing regional sequence is calculated
There is open position, obtain position break sequence, comprising:
A linear list is obtained, t=0 is the initial position of the linear list;
If j > i and mij≠ 0, then it is based on t=t+1, St=mijIt carries out recursive calculation and successively stores calculated result to the line
In property table, until j=i or cij< s obtains the position break sequence, wherein S1S2…St-1Sequence is disconnected for the position
Column, i=1 and j=n are illustrated respectively in the head of the queue element and tail of the queue element of grain processing regional sequence described in the linear list
Storage location.
7. if according to the method described in claim 4, it is characterized in that, the sampling number greater than 0, is adopted based on described
Sample number, each element in the corresponding sampling area of the sampling number the cumulative and sampling area in grain processing area
The ratio and distribution sample calculation rule in domain, obtain the frequency in sampling in the grain processing region, comprising:
If the sampling number is greater than 0, it is based onQ=Si+1,…,Si+1, obtain the pumping in the grain processing region
Sample number, whereinFor ith sample region, vqFor the frequency in sampling in the grain processing region,
RiFor the sampling number, QiFor the cumulative and x of each element in the corresponding sampling area of the sampling numberqFor the sample region
The ratio in the grain processing region in domain.
8. a kind of grain uniform sampling device, which is characterized in that described device includes:
Ratio obtaining unit is calculated for the grain processing amount in the n grain processing region based on acquisition and preset specific gravity
Rule obtains the ratio in n grain processing region respectively;
Sequence obtaining unit obtains grain processing region sequence for the ratio in n grain processing region to be ranked up
Column;
The grain processing regional sequence is divided into t subsequence, by every sub- sequence for being based on divide and conquer by cutting unit
Column are used as a sampling area, to obtain t sampling area;
Sampling number obtaining unit, for calculate the cumulative of each element in each sampling area and, and respectively will be described
It adds up and multiplied by default sampling constant, obtains the sampling number of each sampling area respectively, wherein the element is grain
The ratio of machining area;
Frequency in sampling obtaining unit is based on the sampling number, the sampling number if being greater than 0 for the sampling number
The ratio in the grain processing region in cumulative and sampling area of each element in corresponding sampling area and distribution sampling
Computation rule obtains the frequency in sampling in the grain processing region.
9. device according to claim 8, which is characterized in that the sequence obtaining unit includes:
Sequence obtains subelement, for the ratio in n grain processing region to be carried out descending arrangement, obtains grain processing area
Domain sequence.
10. device according to claim 9, which is characterized in that the cutting unit includes:
Relative distance obtains subelement, for obtaining a part of sequence in the grain processing regional sequence, and by described one
Partial sequence as recurrence minor structure and according toBe calculated in the recurrence minor structure greatest member with most
The relative distance of small element, wherein xixi+1…xjFor the recurrence minor structure, xiFor greatest member in the recurrence minor structure,
xjFor least member in the recurrence minor structure, cijFor greatest member in the recurrence minor structure and least member it is opposite away from
From;
Mean value obtains subelement, if being used for j > i, cij>=s, then basisElement in the recurrence minor structure is calculated
Mean value, wherein s is default segmentation threshold, and a is the mean value of element in the recurrence minor structure, and k is open position value, k ∈
I, i+1 ..., j-1 } and meet xk>=a and xk+1<a;
Open position obtains subelement, for according to mij=k | xk≥a,xk+1< a, k ∈ { i, i+1 ..., j-1 }, are calculated institute
State the open position in recurrence minor structure, wherein mijFor the open position in the recurrence minor structure;
Recursive calculation subelement finds out the open position of the first recurrence subsequence, x for recurrencei…xkFor the first recurrence
Sequence, mikThe open position of the second recurrence subsequence is found out for the open position and recurrence of the first recurrence subsequence,
xk+1…xjFor the second recurrence subsequence, mk+1,jFor the open position of the second recurrence subsequence;
Sampling area obtains subelement, and for being based on above step, all disconnected of the grain processing regional sequence is calculated
Open position, to obtain t subsequence, using each subsequence as a sampling area, to obtain t sampling area.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710230778.5A CN107014635B (en) | 2017-04-10 | 2017-04-10 | Grain uniform sampling method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710230778.5A CN107014635B (en) | 2017-04-10 | 2017-04-10 | Grain uniform sampling method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107014635A CN107014635A (en) | 2017-08-04 |
CN107014635B true CN107014635B (en) | 2019-09-27 |
Family
ID=59446247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710230778.5A Expired - Fee Related CN107014635B (en) | 2017-04-10 | 2017-04-10 | Grain uniform sampling method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107014635B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0987645A2 (en) * | 1998-09-14 | 2000-03-22 | NCR International, Inc. | Predicting a future value of a variable associated with an input data sequence |
EP1394688A1 (en) * | 2002-08-27 | 2004-03-03 | Christian Bartels | Sampling method |
CN103458504A (en) * | 2013-09-13 | 2013-12-18 | 中国科学院信息工程研究所 | Sensor node locating method and device based on sequences |
CN105051724A (en) * | 2013-08-19 | 2015-11-11 | 华为技术有限公司 | Data object processing method and device |
CN105046957A (en) * | 2015-07-02 | 2015-11-11 | 清华大学 | Balanced sampling method for accident analysis and safety assessment |
CN105445054A (en) * | 2015-11-09 | 2016-03-30 | 长沙开元仪器股份有限公司 | Sampling method and device of carriage coal |
CN106206346A (en) * | 2015-05-27 | 2016-12-07 | 郑芳田 | Measurement Sampling Method with Sampling Rate Determination Mechanism |
-
2017
- 2017-04-10 CN CN201710230778.5A patent/CN107014635B/en not_active Expired - Fee Related
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP0987645A2 (en) * | 1998-09-14 | 2000-03-22 | NCR International, Inc. | Predicting a future value of a variable associated with an input data sequence |
EP1394688A1 (en) * | 2002-08-27 | 2004-03-03 | Christian Bartels | Sampling method |
CN105051724A (en) * | 2013-08-19 | 2015-11-11 | 华为技术有限公司 | Data object processing method and device |
CN103458504A (en) * | 2013-09-13 | 2013-12-18 | 中国科学院信息工程研究所 | Sensor node locating method and device based on sequences |
CN106206346A (en) * | 2015-05-27 | 2016-12-07 | 郑芳田 | Measurement Sampling Method with Sampling Rate Determination Mechanism |
CN105046957A (en) * | 2015-07-02 | 2015-11-11 | 清华大学 | Balanced sampling method for accident analysis and safety assessment |
CN105445054A (en) * | 2015-11-09 | 2016-03-30 | 长沙开元仪器股份有限公司 | Sampling method and device of carriage coal |
Also Published As
Publication number | Publication date |
---|---|
CN107014635A (en) | 2017-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Floudas et al. | Recent advances in global optimization | |
Campbell et al. | Assessing colour-dependent occupation statistics inferred from galaxy group catalogues | |
CN104572735B (en) | A kind of picture mark words recommending method and device | |
CN102087575A (en) | Electronic device and method for dynamic arrangement of icons | |
Jin et al. | Community detection in complex networks by density-based clustering | |
Aguerri et al. | A study of catalogued nearby galaxy clusters in the SDSS-DR4-II. Cluster substructure | |
CN105786860A (en) | Data processing method and device in data modeling | |
CN110827924B (en) | Clustering method and device for gene expression data, computer equipment and storage medium | |
CN110928739B (en) | Process monitoring method and device and computing equipment | |
CN107678800A (en) | Background application method for cleaning, device, storage medium and electronic equipment | |
CN105139282B (en) | A kind of power grid achievement data processing method, device and computing device | |
US20090319457A1 (en) | Method and apparatus for structural data classification | |
CN111429980A (en) | Automatic acquisition method for material crystal structure characteristics | |
CN110019790A (en) | Text identification, text monitoring, data object identification, data processing method | |
CN104598539A (en) | Internet event hot degree calculation method and terminal | |
CN114780606A (en) | Big data mining method and system | |
CN107203496B (en) | Grain distribution sampling method and device | |
Gauran et al. | Empirical null estimation using zero-inflated discrete mixture distributions and its application to protein domain data | |
CN107014635B (en) | Grain uniform sampling method and device | |
CN107644101A (en) | Information classification approach and device, information classification equipment and computer-readable medium | |
CN109472322A (en) | Classification method, device, storage medium and electronic equipment based on cluster | |
CN105589683B (en) | Sample extraction method and device | |
CN108491451B (en) | English reading article recommendation method and device, electronic equipment and storage medium | |
CN109696614B (en) | Circuit test optimization method and device | |
CN106020505B (en) | A kind of sort method and mobile terminal of candidates of input method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190927 Termination date: 20210410 |