CN107014635A - Grain uniform sampling method and device - Google Patents
Grain uniform sampling method and device Download PDFInfo
- Publication number
- CN107014635A CN107014635A CN201710230778.5A CN201710230778A CN107014635A CN 107014635 A CN107014635 A CN 107014635A CN 201710230778 A CN201710230778 A CN 201710230778A CN 107014635 A CN107014635 A CN 107014635A
- Authority
- CN
- China
- Prior art keywords
- grain processing
- recurrence
- sequence
- sampling
- 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.)
- Granted
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.Methods described includes the grain processing amount and default proportion computation rule in the n grain processing region based on acquisition, and the ratio in n grain processing region is obtained 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 sample area;Calculate the cumulative of each element in each sample area and, and respectively will be cumulative and default sampling constant be multiplied by, to obtain the sampling number of each sample area respectively;If sampling number is more than 0, cumulative based on each element in sampling number, sample area and, the ratio in grain processing region in the sample area and distribution sample calculation rule, 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 field, in particular to a kind of grain uniform sampling method and device.
Background technology
Problem is wasted, it is necessary to be carried out to national grain processing enterprise in order to estimate grain loss during national grain processing
Extensive sampling.Due to being limited by human and material resources and financial resources, the number of times of sampling is often limited.Due to different main grains
The grain processing amount in producing region is different, therefore needs to formulate rational sampling plan.In theory, the more regions 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, from linchpin city to this kind of grain
There is very big difference in the processing capacity of food.Many provinces are fewer due to the amount for processing this kind of grain, cause the grain in these provinces
It can not be sampled.However, by the total amount of these provinces processing grain than larger, if without sampling, national grain will be caused
Estimate and serious distortion occur, rational sampling plan is lacked at present.
The content of the invention
In view of this, the purpose of the embodiment of the present invention is to provide a kind of grain uniform sampling method and device, to improve
Above mentioned problem.To achieve these goals, the technical scheme that the present invention takes is as follows:
In a first aspect, present example provides a kind of grain uniform sampling method, methods described includes the n based on acquisition
The grain processing amount in individual grain processing region and default proportion computation rule, obtain the n grain processing region respectively
Ratio;The ratio in the n grain processing region is ranked up, grain processing regional sequence is obtained;, will based on divide and conquer
The grain processing regional sequence is divided into t subsequence, using each subsequence as a sample area, is adopted with obtaining t
Sample region;Calculate the cumulative of each element in each sample area and, and respectively will be described cumulative and be multiplied by default sampling
Constant, to obtain the sampling number of each sample area respectively, wherein, the element is the ratio in grain processing region;
If the sampling number is more than 0, based on each element in the sampling number, the corresponding sample area of the sampling number
It is cumulative and, the ratio in grain processing region in the sample area and distribution sample calculation rule, obtain the grain processing area
The frequency in sampling in domain.
Second aspect, the embodiments of the invention provide a kind of grain uniform sampling device, described device is obtained including ratio
Unit, for the grain processing amount and default proportion computation rule in the n grain processing region based on acquisition, is obtained respectively
The ratio in the n grain processing region;Sequence obtaining unit, for the ratio in the n grain processing region to be arranged
Sequence, obtains grain processing regional sequence;Cutting unit, for based on divide and conquer, the grain processing regional sequence to be divided into t
Individual subsequence, using each subsequence as a sample area, to obtain t sample area;Sampling number obtaining unit, is used for
Calculate the cumulative of each element in each sample area and, and respectively will be described cumulative and be multiplied by default sampling constant, point
The sampling number of each sample area is not obtained, wherein, the element is the ratio in grain processing region;Frequency in sampling is obtained
Unit is obtained, if being more than 0 for the sampling number, based on the sampling number, the corresponding sample area of the sampling number
Interior each element cumulative and, the ratio in grain processing region in the sample area and distribution sample calculation rule, 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 default proportion computation rule, obtain the ratio in the n grain processing region respectively;Will
The ratio in the 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 sample area, to obtain t sample area;Meter
Calculate the cumulative of each element in each sample area and, and respectively will be described cumulative and be multiplied by default sampling constant, with point
The sampling number of each sample area is not obtained, wherein, the element is the ratio in grain processing region;If the sampling
Number of times is more than 0, then cumulative based on each element in the sampling number, the corresponding sample area of the sampling number and, should
The ratio and distribution sample calculation rule in the grain processing region in sample area, obtain the sampling time in the grain processing region
Number.Use divide and conquer by multiple grain processing region divisions for different sample areas, then each sample 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 or by implementing understanding of the embodiment of the present invention.The purpose of the present invention and other advantages can be by saying for being write
Specifically noted structure is realized and obtained in bright book, claims and accompanying drawing.
Brief description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be attached to what is used required in embodiment
Figure is briefly described, it will be appreciated that the following drawings illustrate only certain embodiments of the present invention, therefore is not construed as pair
The restriction of scope, for those of ordinary skill in the art, on the premise of not paying creative work, can also be according to this
A little accompanying drawings obtain other related accompanying drawings.
Fig. 1 is a kind of structured flowchart for the electronic equipment that can be applied in the embodiment of the present application;
The flow chart for the grain uniform sampling method that Fig. 2 provides for first embodiment of the invention;
The schematic diagram data for the national paddy rice processing capacity in 2016 that Fig. 3 provides for first embodiment of the invention;
The T=50 that Fig. 4 provides for first embodiment of the invention, s=0.4 uniform sampling result schematic diagram;
The T=50 that Fig. 5 provides for first embodiment of the invention, s=0.6 uniform sampling result schematic diagram;
The T=50 that Fig. 6 provides for first embodiment of the invention, s=0.8 uniform sampling result schematic diagram;
The structured flowchart for the grain uniform sampling device that Fig. 7 provides for second embodiment of the invention.
Embodiment
Below in conjunction with accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Ground is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.Generally exist
The component of the embodiment of the present invention described and illustrated in accompanying drawing can be arranged and designed with a variety of configurations herein.Cause
This, the detailed description of the embodiments of the invention to providing in the accompanying drawings is not intended to limit claimed invention below
Scope, but it is merely representative of the selected embodiment of the present invention.Based on embodiments of the invention, those skilled in the art are not doing
The every other embodiment obtained on the premise of going out creative work, belongs to the scope of protection of the invention.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain Xiang Yi
It is defined in individual accompanying drawing, then it further need not be defined and explained in subsequent accompanying drawing.Meanwhile, the present invention's
In description, term " first ", " second " etc. are only used for distinguishing description, and it is not intended that indicating or implying relative importance.
Referring to Fig. 1, Fig. 1 shows a kind of structured flowchart for the electronic equipment 100 that can be applied in the embodiment of the present application.
The electronic equipment 100 can as user terminal or computer or server, the user terminal can for mobile phone or
Tablet personal computer.As shown in figure 1, electronic equipment 100 can include memory 110, storage control 111, processor 112 and grain
Uniform sampling device.
Directly or indirectly electrically connected between memory 110, storage control 111, each element of processor 112, to realize
The transmission or interaction of data.For example, between these elements electricity can be realized by one or more communication bus or signal bus
Connection.Grain uniform sampling method includes at least one respectively to be stored in the form of software or firmware (firmware)
Software function module in reservoir 110, such as software function module or computer journey that described grain uniform sampling device includes
Sequence.
Memory 110 can store various software programs and module, and the grain equilibrium that such as the embodiment of the present application is provided is taken out
Quadrat method and the corresponding programmed instruction/module of device.Processor 112 is by running the software program of storage in the memory 110
And module, so as to perform various function application and data processing, that is, realize the grain uniform sampling in 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 storage (Electric Erasable Programmable Read-Only Memory, EEPROM) etc..
Processor 112 can be a kind of IC chip, with 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.;Can also be digital signal processor (DSP), it is application specific integrated circuit (ASIC), ready-made programmable
Gate array (FPGA) or other PLDs, discrete gate or transistor logic, discrete hardware components.It can
To realize or perform disclosed each method, step and the logic diagram in the embodiment of the present application.General processor can be micro-
Processor or the processor can also be any conventional processors etc..
First embodiment
Referring to Fig. 2, the embodiments of the invention provide a kind of grain uniform sampling method, methods described includes:
Step S200:The grain processing amount and default proportion computation rule in the n grain processing region based on acquisition,
The ratio in the n grain processing region is obtained respectively.
Specifically, it is based onThe ratio in the n grain processing region is obtained respectively, its
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 a total of n of province, autonomous region and municipality directly under the Central Government of certain grain processing can be carried out, and this n
Grain processing region is w to the year processing capacity of this kind of grain in a certain yeari(i=1,2 ..., that is, get n grain by n) ten thousand tons
The grain processing amount of machining area, then the processing total amount W of this kind of grain is in this year:
In formula (1), wiFor the grain processing amount in i-th of grain processing region, W is grain processing total amount.The grain
Paddy, wheat, peanut, soybean, rapeseed etc. can be included.
Based on formula (2), the ratio p in the n grain processing region is obtained respectivelyi(i=1,2 ..., are at this n)
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 default proportion computation rule.
Step S210:The ratio in the n grain processing region is ranked up, grain processing regional sequence is obtained.
Sequence can be ascending order arrangement or descending arrangement.In the present embodiment, by the ratio in the t 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 newly
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:Based on divide and conquer, the grain processing regional sequence is divided into t subsequence, by every sub- sequence
Row are as a sample area, to obtain t sample area.
In order to realize to the progress stratified sampling of grain processing region the grain processing regional sequence, it is necessary to being arranged in descending
Split, i.e., a descending sequence is divided into the descending sequence of several non-overlapping copies.
Based on step S220, a part of sequence in the grain processing regional sequence is obtained, and by a part of sequence
Row as recurrence minor structure and according toCalculating obtains greatest member and least member in the recurrence minor structure
Relative distance, wherein, xixi+1…xjFor the recurrence minor structure, xiFor greatest member, x in the recurrence minor structurejFor 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 by (3), formula draws 0≤cij<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 default segmentation threshold is 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, it is impossible to disconnect.Such as
Fruit can disconnect, then might as well set open position as mij。
Further, if j > i, cij>=s, then basisCalculate and obtain the equal of element in the recurrence minor structure
Value, wherein, s is default segmentation threshold, and a is the average 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 }, calculate and obtain disconnected in the recurrence minor structure
Open position, wherein, mijFor the open position in the recurrence minor structure.
For example, according to formula (4), obtaining recurrence minor structure xixi+1…xjAverage a.
Obviously, unique k ∈ { i, i+1 ..., j-1 } are 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
SubsequenceWith the second recurrence subsequence
Therefore, recurrence minor structure xixi+1…xjCan be as follows according to formula (5) recurrence Ground Split:
Recurrence obtains the open position of the first recurrence subsequence, xi…xkFor the first recurrence subsequence, mikTo be described
The open position of first recurrence subsequence, and recurrence obtain the open position of the second recurrence subsequence, xk+1…xjFor 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
Row, using each subsequence as a sample area, to obtain t sample area.
If j≤i or cij<S, then have mij=0, i.e. xixi+1…xjIt need not disconnect.If above-mentioned recursive procedure function
f(xixi+1…xj) represent, then pass through f (x1x2…xn) grain processing regional sequence x can be obtained1x2…xnAll open positions.
Further, by seeking mijRecursive algorithm understand, if mij=0, then it represents that grain processing regional sequence xixi+1…xj
It need not disconnect.If mij≠ 0, then mijFor xixi+1…xjOpen position.x1x2…xnAt most also there was only n-1 open position.
X is obtained for convenience1x2…xnThe subsequence after disconnection, might as well be by x1x2…xnAll open position linear lists
Represent.
A linear list is obtained, t=0 is the initial position of the linear list;
If j > i and mij≠ 0, then based on t=t+1, St=mijCarry out recursive calculation and result of calculation is stored into institute successively
State in linear list, until j=i or cij<S, obtains the position break sequence, wherein, S1S2…St-1Disconnected for the position
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) perform it is as follows:
T=t+1, St=mij;
Recurrence is performed
Recurrence is performedUntil 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, position is obtained
The position break sequence is simultaneously carried out ascending order arrangement by break sequence, to obtain t subsequence, regard each subsequence as one
Sample area, to obtain t sample area;
Wherein, the t sample area isS0=1, St=n, S1S2…St-1To be described
Position 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 caused1≤S2≤…≤St.Make S0=1 and St+1=n, then x1x2…xnIt is disconnected
It is split into t subsequence as follows:It regard each subsequence as a sample area, x1x2…xnCan
To be broken into t sample area, i.e.,
Step S230:Calculate the cumulative of each element in each sample area and, and respectively will be described cumulative and multiply
With default sampling constant, to obtain the sampling number of each sample area respectively, wherein, the element is grain processing area
The ratio in domain.
Specifically, t sample area:Calculate each member in each sample area
Element cumulative and, i.e.,:
In formula (7), i=0,1 ..., t-1, QiEach element cumulative for ith sample region and.The element is
The ratio in grain processing region, i.e.,
Default sampling constant is added up and is multiplied by further according to each element in each sample area, to obtain each institute respectively
The sampling number of sample area is stated, i.e.,:
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 the actual requirements, 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 more than 0, based on the sampling number, the sampling number is corresponding adopts
Each element in sample region cumulative and, the ratio in grain processing region in the sample area and distribution sample calculation rule
Then, the frequency in sampling in the grain processing region is obtained.
Based on step S240, if the sampling number is more than 0, it is based onIt is somebody's turn to do
The frequency in sampling in grain processing region, wherein,For 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 sample area of the sampling number
Plus and, xqFor the ratio in the grain processing region in the sample area.
Specifically, if in ith sample regionSampling number RiMore than 0, then existing should
The assignment problem of sampling number, specific as follows in region:
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 sample area of numberqFor the ratio in the grain processing region in the sample area.Formula
(9) it is the distribution sample calculation rule.Due to rounding error, certainly existWith(i=0,1 ...,
t-1).For example, xqThe percentage that q-th of grain processing region (q-th of province) processes the grain, v can be expressed asqCan be with table
It is shown as the frequency in sampling distributed in the grain processing region (province).
In order to further illustrate 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
In the schematic diagram data for the national paddy rice processing capacity in 2016 that first embodiment of the invention is provided, Fig. 3, the unit of processing capacity is ten thousand
Ton, national paddy rice processing capacity is 127,490,000 tons within 2016, 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.
Based on the data shown in Fig. 3, using grain uniform sampling method provided in an embodiment of the present invention, sampling constant is preset
T carried out 50 samplings for 50 to national paddy processing amount in 2016, presets segmentation threshold s and is taken as 0.4, uniform sampling result is such as
Shown in Fig. 4, first row represents the processing ratio in sample area, the second class of the representation sample area, and the 3rd row represent the sampling
Each paddy processing region in region, the 4th row represent the processing ratio in each paddy processing region in the sample area, the 5th
Row represent the frequency in sampling in each paddy processing region in the sample area, and the 6th row represent the sampling of the sample area always
Number of times.The frequency in sampling in 12 sample areas and each paddy processing region is obtained altogether.
Similarly, when default sampling constant T is 50, default segmentation threshold s be taken as 0.6, uniform sampling result as shown in figure 5,
The frequency in sampling in 9 sample areas and each paddy processing region is obtained altogether.When default sampling constant T is 50, presets and divide
Cut threshold value s and be taken as 0.8, uniform sampling result as shown in fig. 6, obtaining 6 sample areas and each paddy processing region altogether
Frequency in sampling.
For the reasonable Sampling in China's 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, it can estimate national grain more accurate.The scheme of one aligned sample, both
Consider major grain producing area should overabsorption sample number, it is further contemplated that the hits problem in the few producing region of grain.Therefore the present invention is implemented
The grain uniform sampling method that example is provided can solve the reasonable Sampling in grain processing region well.
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 default proportion computation rule, the ratio in the n grain processing region is obtained respectively;By the n
The ratio in individual 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 sample area, to obtain t sample area;Calculate each
Each element in the sample area cumulative and, and respectively will be described cumulative and be multiplied by default sampling constant, to obtain respectively
The sampling number of each sample area, wherein, the element is the ratio in grain processing region;If the sampling number is big
In 0, then cumulative based on each element in the sampling number, the corresponding sample area of the sampling number and, the sample region
The ratio and distribution sample calculation rule in the grain processing region in domain, obtain the frequency in sampling in the grain processing region.Adopt
By multiple grain processing region divisions it is different sample areas with divide and conquer, then stratified sampling is carried out to each sample area,
Realize the uniform sampling in multiple grain processing regions.
Second embodiment
Referring to Fig. 7, the embodiments of the invention provide a kind of grain uniform sampling device 300, shown device 300 includes:
Ratio obtaining unit 310, grain processing amount and default ratio for the n grain processing region based on acquisition
Re-computation rule, obtains the ratio in the n grain processing region respectively.
As a kind of embodiment, ratio obtaining unit 310 can include ratio and obtain subelement 311.
Ratio obtain subelement 311, for based onThe n grain is obtained respectively
The ratio of machining area, wherein,wiFor 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, for the ratio in the n grain processing region to be ranked up, obtains grain processing
Regional sequence.
As a kind of embodiment, sequence obtaining unit 320 can include sequence and obtain subelement 321.
Sequence obtains subelement 321, for the ratio in the t grain processing region to be carried out into 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
Individual subsequence is as a sample area, to obtain t sample area.
As a kind of embodiment, cutting unit 330 can include relative distance and obtain subelement 331, average acquisition
Unit 332, open position obtain subelement 333, recursive calculation subelement 334 and sample 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 toCalculating obtains greastest element in the recurrence minor structure
The relative distance of element and least member, wherein, xixi+1…xjFor the recurrence minor structure, xiFor maximum in the recurrence minor structure
Element, xjFor least member, c in the recurrence minor structureijFor the phase of greatest member and least member in the recurrence minor structure
Adjust the distance.
Average obtains subelement 332, if for j > i, cij>=s, then basisCalculating obtains recurrence
The average of element in structure, wherein, s is default segmentation threshold, and a is the average of element in the recurrence minor structure, and k is disconnection position
Put value, k ∈ { i, i+1 ..., j-1 } and meet 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
The open position obtained in the recurrence minor structure is calculated, wherein, mijFor the open position in the recurrence minor structure.
Recursive calculation subelement 334, the open position of the first recurrence subsequence, x are obtained for recurrencei…xkFor described
One recurrence subsequence, mikThe disconnected of the second recurrence subsequence is obtained for the open position of the first recurrence subsequence, and recurrence
Open position, xk+1…xjFor the second recurrence subsequence,For the open position of the second recurrence subsequence.
Sample area obtains subelement 335, for based on above step, calculating the grain processing regional sequence
All open positions, to obtain t subsequence, using each subsequence as a sample area, to obtain t sample area.
As a kind of embodiment, sample area, which obtains subelement 335, can include linear list acquisition subelement 336 and disconnected
Open sequence and obtain 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 for j > i and mij≠ 0, then based on t=t+1, St=mijCarry out recurrence meter
Calculate and store result of calculation in the linear list successively, until j=i or cij<S, obtains the position break sequence, its
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 sample area and, and respectively
Default sampling constant is added up and be multiplied by by described, the sampling number of each sample area is obtained respectively, wherein, the element
For the ratio in grain processing region.
Frequency in sampling obtaining unit 350, if being more than 0 for the sampling number, based on the sampling number, described is adopted
Each element in the corresponding sample area of sample number of times cumulative and, the ratio in grain processing region in the sample area and point
With sample calculation rule, the frequency in sampling in the grain processing region is obtained.
As a kind of embodiment, frequency in sampling obtaining unit 350 can include frequency in sampling and obtain subelement 351.
Frequency in sampling obtains subelement 351, if being more than 0 for the sampling number, is based onQ=Si+
1,…,Si+1, the frequency in sampling in the grain processing region is obtained, wherein,For 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 sample area.
Above each unit can be that now, above-mentioned each unit can be stored in memory 110 by software code realization.
Above each unit can equally be realized by hardware such as IC chip.
The technique effect of grain uniform sampling device 300 provided in an embodiment of the present invention, its realization principle and generation is with before
State embodiment of the method identical, to briefly describe, device embodiment part does not refer to part, refers to phase in preceding method embodiment
Answer content.
In several embodiments provided herein, it should be understood that disclosed apparatus and method, it can also pass through
Other modes are realized.Device embodiment described above is only schematical, for example, flow chart and block diagram in accompanying drawing
Show according to the device of multiple embodiments of the present invention, the architectural framework in the cards of method and computer program product,
Function and operation.At this point, each square frame in flow chart or block diagram can represent the one of a module, program segment or code
Part a, part for the module, program segment or code is used to realize holding for defined logic function comprising one or more
Row instruction.It should also be noted that in some implementations as replacement, the function of being marked in square frame can also with different from
The order marked in accompanying drawing occurs.For example, two continuous square frames can essentially be performed substantially in parallel, they are sometimes
It can perform in the opposite order, this is depending on involved function.It is also noted that every in block diagram and/or flow chart
The combination of individual square frame and block diagram and/or the square frame in flow chart, can use the special base for performing defined function or action
Realize, or can be realized with the combination of specialized hardware and computer instruction in the system of hardware.
In addition, each functional module in each embodiment of the invention can integrate to form an independent portion
Point or modules individualism, can also two or more modules be integrated to form an independent part.
If the function is realized using in the form of software function module and is used as independent production marketing or in use, can be with
It is stored in a computer read/write memory medium.Understood based on such, technical scheme is substantially in other words
The part contributed to prior art or the part of the technical scheme can be embodied in the form of software product, the meter
Calculation machine software product is stored in a storage medium, including some instructions are to cause a computer equipment (can be individual
People's computer, server, or network equipment etc.) perform all or part of step of each of the invention embodiment methods described.
And foregoing storage medium includes:USB flash disk, mobile hard disk, read-only storage (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), magnetic disc or CD etc. are various can be with the medium of store program codes.Need
Illustrate, herein, such as first and second or the like relational terms be used merely to by an entity or operation with
Another entity or operation make a distinction, and not necessarily require or imply between these entities or operation there is any this reality
The relation or order on border.Moreover, term " comprising ", "comprising" or its any other variant are intended to the bag of nonexcludability
Contain, so that process, method, article or equipment including a series of key elements are not only including those key elements, but also including
Other key elements being not expressly set out, or also include for this process, method, article or the intrinsic key element of equipment.
In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including the key element
Process, method, article or equipment in also there is other identical element.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area
For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies
Change, equivalent substitution, improvement etc., should be included in the scope of the protection.It should be noted that:Similar label and letter exists
Similar terms is represented in following accompanying drawing, therefore, once being defined in a certain Xiang Yi accompanying drawing, is then not required in subsequent accompanying drawing
It is further defined and explained.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any
Those familiar with the art the invention discloses technical scope in, change or replacement can be readily occurred in, should all be contained
Cover within protection scope of the present invention.Therefore, protection scope of the present invention described should be defined by scope of the claims.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality
Body or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or deposited between operating
In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to
Nonexcludability is included, so that process, method, article or equipment including a series of key elements not only will including those
Element, but also other key elements including being not expressly set out, or also include being this process, method, article or equipment
Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that
Also there is other identical element in process, method, article or equipment including the key element.
Claims (10)
1. a kind of grain uniform sampling method, it is characterised in that methods described includes:
The grain processing amount and default proportion computation rule in the n grain processing region based on acquisition, obtain the n respectively
The ratio in individual grain processing region;
The ratio in the 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, each subsequence is regard as a sampling
Region, to obtain t sample area;
Calculate the cumulative of each element in each sample area and, and respectively will be described cumulative and to be multiplied by default sampling normal
Number, to obtain the sampling number of each sample area respectively, wherein, the element is the ratio in grain processing region;
If the sampling number is more than 0, based on each member in the sampling number, the corresponding sample area of the sampling number
Element cumulative and, the ratio in grain processing region in the sample area and distribution sample calculation rule, obtain the grain and add
The frequency in sampling in work area domain.
2. according to the method described in claim 1, it is characterised in that the ratio by the n grain processing region is carried out
Sequence, obtains grain processing regional sequence, including:
The ratio in the t grain processing region is subjected to descending arrangement, grain processing regional sequence is obtained.
3. method according to claim 2, it is characterised in that the grain in the n grain processing region based on acquisition
Processing capacity and default proportion computation rule, obtain the ratio in the n grain processing region respectively, including:
It is based onThe ratio in the n grain processing region is obtained respectively, wherein,wiFor 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. method according to claim 2, it is characterised in that described to be based on divide and conquer, by grain processing region sequence
Column split is t subsequence, using each subsequence as a sample area, to obtain t sample area, including:
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 for obtaining greatest member and least member in the recurrence minor structure is calculated, wherein,
xixi+1…xjFor the recurrence minor structure, xiFor greatest member, x in the recurrence minor structurejFor 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 average for obtaining element in the recurrence minor structure is calculated, wherein, s is pre-
If segmentation threshold, a is the average of element in the recurrence minor structure, and k is open position value, k ∈ { i, i+1 ..., j-1 } and full
Sufficient xk>=a and xk+1<a;
According to mij=k | xk≥a,xk+1<A, k ∈ { i, i+1 ..., j-1 }, calculate the disconnection position obtained in the recurrence minor structure
Put, wherein, mijFor the open position in the recurrence minor structure;
Recurrence obtains the open position of the first recurrence subsequence, xi…xkFor the first recurrence subsequence, mikPassed for described first
The open position of subsequence, and recurrence is returned to obtain 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 sample area, to obtain t sample area.
5. method according to claim 4, it is characterised in that the institute for calculating the grain processing regional sequence
There is open position, to obtain t subsequence, using each subsequence as a sample area, to obtain t sample area, bag
Include:
All open positions of the grain processing regional sequence are calculated, position break sequence is obtained and the position is broken
Open sequence and carry out ascending order arrangement, to obtain t subsequence, using each subsequence as a sample area, to obtain t sampling
Region;
Wherein, the t sample area isS0=1, St=n, S1S2…St-1For the position
Break sequence, x1x2…xnFor the grain processing regional sequence.
6. method according to claim 5, it is characterised in that the institute for calculating the grain processing regional sequence
There is open position, obtain position break sequence, including:
A linear list is obtained, t=0 is the initial position of the linear list;
If j > i and mij≠ 0, then based on t=t+1, St=mijCarry out recursive calculation and result of calculation is stored to the line successively
In property table, until j=i or cij<S, obtains the position break sequence, wherein, S1S2…St-1Sequence is disconnected for the position
Row, 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. method according to claim 4, it is characterised in that if the sampling number is more than 0, adopted based on described
Sample number of times, each element in the corresponding sample area of the sampling number cumulative and, the grain processing area in the sample area
The ratio and distribution sample calculation rule in domain, obtain the frequency in sampling in the grain processing region, including:
If the sampling number is more than 0, it is based onQ=Si+1,…,Si+1, obtain taking out for the grain processing region
Sample number of times, wherein,For 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 sample 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, it is characterised 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 default proportion
Rule, obtains the ratio in the n grain processing region respectively;
Sequence obtaining unit, for the ratio in the n grain processing region to be ranked up, obtains grain processing region sequence
Row;
Cutting unit, for based on divide and conquer, the grain processing regional sequence to be divided into t subsequence, by every sub- sequence
Row are as a sample area, to obtain t sample area;
Sampling number obtaining unit, for calculate the cumulative of each element in each sample area and, and respectively will be described
Default sampling constant is added up and be multiplied by, the sampling number of each sample area is obtained respectively, wherein, the element is grain
The ratio of machining area;
Frequency in sampling obtaining unit, if being more than 0 for the sampling number, based on the sampling number, the sampling number
Each element in corresponding sample area cumulative and, the ratio in grain processing region in the sample area and distribution sampling
Computation rule, obtains the frequency in sampling in the grain processing region.
9. device according to claim 8, it is characterised in that the sequence obtaining unit includes:
Sequence obtains subelement, for the ratio in the t grain processing region to be carried out into descending arrangement, obtains grain processing area
Domain sequence.
10. device according to claim 9, it is characterised 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 toCalculating obtain 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, c in the recurrence minor structureijFor greatest member in the recurrence minor structure and least member it is relative away from
From;
Average obtains subelement, if for j > i, cij>=s, then basisCalculating obtains first in the recurrence minor structure
The average of element, wherein, s is default segmentation threshold, and a is the average 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 }, calculating obtain institute
The open position in recurrence minor structure is stated, wherein, mijFor the open position in the recurrence minor structure;
Recursive calculation subelement, the open position of the first recurrence subsequence, x are obtained for recurrencei…xkFor first recurrence
Sequence, mikThe open position of the second recurrence subsequence is obtained for the open position of the first recurrence subsequence, and recurrence,
xk+1…xjFor the second recurrence subsequence, mk+1,jFor the open position of the second recurrence subsequence;
Sample area obtains subelement, for based on above step, calculating all disconnected of the grain processing regional sequence
Open position, to obtain t subsequence, using each subsequence as a sample area, to obtain t sample 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 true CN107014635A (en) | 2017-08-04 |
CN107014635B 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 |
CN105046957A (en) * | 2015-07-02 | 2015-11-11 | 清华大学 | Balanced sampling method for accident analysis and safety assessment |
CN105051724A (en) * | 2013-08-19 | 2015-11-11 | 华为技术有限公司 | Data object processing method and device |
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 |
---|---|
CN107014635B (en) | 2019-09-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104572735B (en) | A kind of picture mark words recommending method and device | |
CN104866572B (en) | A kind of network short text clustering method | |
CN105005589A (en) | Text classification method and text classification device | |
CN104750982B (en) | A kind of reliability bounds estimate method that resampling is grouped based on ratio | |
CN115394358A (en) | Single cell sequencing gene expression data interpolation method and system based on deep learning | |
CN114091603A (en) | Spatial transcriptome cell clustering and analyzing method | |
CN109960612B (en) | Method, device and server for determining data storage ratio | |
CN112699142A (en) | Cold and hot data processing method and device, electronic equipment and storage medium | |
CN109543940B (en) | Activity evaluation method, activity evaluation device, electronic equipment and storage medium | |
CN113268665A (en) | Information recommendation method, device and equipment based on random forest and storage medium | |
CN104462061B (en) | Term extraction method and extraction element | |
Li et al. | Learning from Polar Representation: An Extreme-Adaptive Model for Long-Term Time Series Forecasting | |
CN108228634A (en) | A kind of data processing method and device | |
CN108804676A (en) | A kind of model sort method, device, equipment and computer readable storage medium | |
CN112667770A (en) | Method and device for classifying articles | |
CN107014635A (en) | Grain uniform sampling method and device | |
CN108133048A (en) | file ordering method, device and mobile terminal | |
CN113505273A (en) | Data sorting method, device, equipment and medium based on repeated data screening | |
CN103353885A (en) | Method and system for managing seed breeding data | |
CN103514167B (en) | Data processing method and equipment | |
CN109696614B (en) | Circuit test optimization method and device | |
Mankad et al. | Analysis of multiview legislative networks with structured matrix factorization: Does Twitter influence translate to the real world? | |
CN115862653A (en) | Audio denoising method and device, computer equipment and storage medium | |
CN104156492A (en) | Method and device for prompting search content | |
CN114021716A (en) | Model training method and system and electronic equipment |
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 |