Optimal Sample Size Selection For Torusity Estimation Using A PSO Based Neural Network
Optimal Sample Size Selection For Torusity Estimation Using A PSO Based Neural Network
2, April-June2007
Chakguy Prakasvudhisarn
Schoolof Technology,ShinawatraUniversity, | 5th Floor, ShinawatraTower lll,
Chatuchak,Bangkok,10900 Thailand
Abstract
In a competitivemanufacturingenvironment,the quality, cost, and time to market dependnot
only on the design and manufacturingbut also on the inspection process used. The use of
computerizedmeasuringdeviceshas greatly improvedthe efficacy of geometrictoleranceinspection,
especiallyfor form measurement.However,they still lack an efficient and effectivesamplingplan for
data collectionof a complex form featurelike a torus. Factorsthat could affect plans due to design,
manufacturing,and measurementsuch as size, geometricaltolerance,manufacfuringprocess,and
confidence level are studied. Type of manufacturingprocess,feature size, precision band, and
sampling method are identified as impact factors for sampling strategy. A Hammersleysequence
basedsamplingmethod is extendedto cover toroidal shape. A neural network basedon the particle
swarm optimtzation(PSO) is then applied to determinesample size for torus feature inspectionby
taking these impact factors into consideration. The PSO based neural network's algorithm and
architectureare describedand its predictive ability on unseentest subsetsis also presented. An
effective and efficient sampling strategy can be achieved by using sampling locations from the
Hammersleysamplingmethodand samplesizeguidedby the PSO basedneuralnetwork.
64
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
with some successlI, 6, 71. However, the new population based search technique,
selection of sample size which controls demonstrates appealing properties such as
measurementprecision is normally conducted simplicity, shortcomputercode,few parameters,
by trial and error, experience,and metrology fast convergence,consistentresults,robustness,
handbooks.This resultsin a relaxedsamplesize and no requirementfor gradientinformationI I 0]
which gives a trade-off between It can be applied to train neural networks by
precision/accuracy of measurement and optimizing their weights in place of the BP.
inspection time. Therefore,a suitable sample This should relieve some drawbacksposed by
size which can representenoughinformationon the BP algorithm.
the whole populationhasto be found with a high The purposeof this work is to propose,for
confidencelevel. the first time, an efhcient and effective method,
Interestingly, complex forms such as PSO basedneural network, for optimal sample
torusity have been largely ignored and are size selectionfor torusity estimation. To do so,
normally left to be dealt-with by the use of the following steps are investigated; (l)
profile tolerance definition, except in a few identification of relevant factors influencing
recentcases[8,9]. The correspondingequations sample size of a doughnut-shapedfeature
for torusesare complex. This has partially lec inspection;(2) collectionof dataof thesefactors
to a relative absenceof researchworks dealing and corresponding sample sizes; and (3)
with the torusity tolerance in the literature. developmentof a PSO basedneuralnetwork for
Since the equations required for torusity optimal samplesizedetermination.
calculationhavejust beenfound, the study ofits
data collection issue has not been realizedyet. 2. Literature review
In addition. a sufficient number of industriaL Form toleranceinspectionplays a vital role
parts such as outer and inner races in bearings, in industrialproductionsince it can guarantee
and toroidal continuous variable transmission the interchangeabilityof the parts. Therefore,
possesstoroidal features,must be effectively probe-type coordinate measuring machines
and efficiently inspected. Considering these (CMMs) have been widely used to accurately
many applications, sampling strategies for measureand analyze parts. However, a main
torusity estimation, especially sample size drawback of CMMs is that an entire inspected
determination, should be studied more surfacecan not practicallybe measured.CMMs
extensively. The need to developeffective and are normally used to measureonly a sampleof
efficient guidelines for sample size used for discrete points on the part feature surface and
torusity measurementis the subject of this thesepoints are used as a representativeof the
paper. entiresurface.Someotherinstruments can scan
The task in doing so is rather complicated the entire surfacebut with lower accuracyand
becausethere are many factorsinvolved such as precision. Hence,a questionfollows; how well
size, dimensional and geometrical tolerances, do the discrete sample points represent the
manufacturing processes,sampling locations, inspectedsurface?
and accuracyand confidencelevels. Thus, an Dimensional surface measurementshave
analytical approachfor their modeling is very involved the use of deterministicsequencesof
difficult due to their unknown nonlinearnature. numbers for determination of sample
Feedforward neural networks have been coordinatesto maximize information collected.
considereda very powerful tool for function According to Woo and Liang t6], a two
approximation and modeling. One of their dimensional (2D) sampling strategy based on
advantagesis the ability to learn from examples. the Hammersleysequenceshows a remarkable
Hence, they can be applied to a model improvementof a nearly quadraticreductionin
relationshipbetweensamplesize and its relevant the numberof sampleswhen comparedwith the
factors. However, their classical training uniform sampling strategy, while maintaining
algorithm, back-propagationalgorithm (BP), the same level of accuracy. The HZ based
present some disadvantagesassociated with strategyin 2D spacewas also suggestedby Woo
overfitting, local optimum problems, and et al. I I ] without a discernibledifferencein the
sensitivity to the initial values of weights. performanceover the HM strategy. The only
Particleswarm optimization(PSO), a relatively differencesare that the total number of sample
65
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
66
ThammasatInt. J. Sc. Tech.,Vol. 12, No.2, April-June2007
61
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
Enmm
,€1=[0,...,N_l],
ft is [log, lr] : ceiling of log, 1y',
b; is binary representation ofthe index i,
b;7denote thej'h bit in bi, and
j:0,...,k-1.
3.2.2Aligned systematicsamplingmethod
ME€GO
Figure 2. Torus surfacegeneration[29].
The systematicsamplingsequenceis a form
of probabilisticsamplingwhich employs a grid
Note that the sample size attempted for each
of equally spacedlocation. There are two types
transformed 3D sampling method was varied
of systematicsampling; aligned and unaligned
from 8 to 256 points to measureeach group of'
sampling. Aligned samplingis normally called
nine toruses. Then, the torusity tolerancezone
systematic sampling. The sample is first
would be calculatedfrom suchpointsby [8]:
determinedby the choice of a pair of random
numbers in order to selectthe coordinatesof the
upper left unit and the subsequentpoints are
taken according to the predetermined
mathematicalpattem.
Supposethat a population is suggestedin
(7),
the form of am rows and eachrow consistsofbr
where 4 is the normal deviation from the
units. The basic procedure for arranging the
measurement (r,,y,,t,) to the ideal torus
coordinateof aligned systematicsampling can
be computedas follows: surface; and xs,y6,u,v,c , and ro are searched
1. Determinea pair of randomnumbers(p,4) parameters for establishing the ideal torus
wherep is lessthan or equal to m, and q is less surface by using the following minimax
than or equal to r. These random numbers criterion:
would decide the coordinatesof the upper left
unit by the p" unit column andq'h unit row. minimum zonetorusity : 2 x min (max d) (8).
2. Locatethe subsequent samplingpoints for x-
Clearly, the torusity zone obtained depends
c o o r d i n a t ea s p + i m w h e r e l e [ 0 , . . . , a - 1 ]
on the measurements(r,,y,,2,) and hence
Therefore, the row consists of
p, p + m,p + 2m,..., p + (a -l)m . sampling strategies used. Different strategies
may give different torusity tolerance zones.
3. Locatethe subsequent samplingpoints fory-
-l] Five levels of quantitativeprecision (precision
coordinate as q + jn where i e10,...,b
band)were chosenas 0.3, 0.9, 1.5,2.1, and2.1
Therefore, the column consists of pm to reflex various sampling strategies
q,q + n,q + 2n,..., q + (b -l)n . employedlor eachprecision.
68
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
69
ThammasatInt. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
250
& zoo
q.-^
t l)u
50
100
0
2369 94'7s 14804
SurfaceArea
70
ThammasatInt. J. Sc. Tech.,Vol. 12, No.2, April-June2007
71
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, Apil-June 2007
effective and efficient optimization technique (0,1) range. This makes the system less
like the PSO. Therefore,the PSO was proposed predictableand more flexible.
to train the neuralnetwork insteadof the BP. 6. Loop to step 2 until a stopping criterion,
either a sufficiently good evaluation function
4.1 PSO basedneural network value or a maximum numberof iterations,is met.
The following steps illustrate neural In step (4), both trained networks would
network trainingby using the PSO: then be simulated with all data sets to check
1. Initialize a populationof particleswith small their predictiveabilities.
random positions,presentxfilfd],and velocities,
vlil[d], of the i'h particle in the lh dimension on 5. Results and analyses
problem space D dimensions (number of The discussedPSONN was implementedin
weightssearched).The positionof eachparticle MATLAB 7 running on a Pentium lY 2.4 GHz
corresponds to weights in the neural network with Microsoft Windows XP operatingsystem.
whereasvelocity representsthe rate of position The computation of PSO depends on a few
change.Also, initializeNN's parameters. parameters such as population size, inertia
2. Evaluatethe desiredoptimization function, weight, maximum velocity, maximum anc
minimization of sum-squared error, in D minimum positions on each dimension, and
dimensionsfor each particle. This is done for maximum numberof iterations. Populationsize
every training pair by computing the actual and maximum iterations of 20 and 600 were
output via analyzing the network from input selected, respectively. The inertia weight
layer to output layer. gradually decreasedfrom 0.9 to 0.4 so as to
3. Compareevaluationwith particle'sprevious balance the global and local exploration.
best value, pbestfi). If current value is better Particles' velocities in each dimension were
than pbestlil, then pbestfi] - current value and clampedto a maximum velocity, v^o,,to control
pbest position,pbestxfi]ffl, is set to the current the explorationability of particles. If u.* is too
position(or weight). high, the PSO facilitates a global search;and
4. Compareevaluationwith swarm's previous particlesmight passgood solutions. However,if
best vafue, pbestfgbestl. lf current value is v^^ is too small, the PSO facilitates a local
better than (pbest[gbest]), then gbest : particle's search;and particlesmight not explore beyond
array index. locally good regions. v-* is a problem-oriented
5. Updatevelocity and positionof eachparticle parameterand shouldbe set at about l0-20oloof
by usingEquations(10) and(1 l), respectively: the dynamic range of the variable in each
vli)[d)= w x vfil[dl+ C' x randO x d i m e n s i o n . I n t h i s e x p e r i m e n t .m a x i m u m
(pbestx[ilfdl - presentxfilldl) + C, x rand 0 x velocity(v.u^),was set at l2%o. The maximum
(pbestxIgbest lfd] - presentx fil[d]) and minimum positions of each variable were
(10), chosento be 0.5 and -0.5, respectively,so that
presentxlilldl=presentxfi)fd]+v[i][dl (ll). they would give small, around zero, initial
weights.
A linearly decreasing inertia weight was
The BPNN was also createdby using the
implementedby startingat 0.9 and endingat 0.4.
neural network toolbox in MATLAB 7 to
This helps expand the search space in the
predict the sample size of torusity verification.
beginning so that the particlescan explore new
Parameterselection in BPNN dependson a few
areas, which implies a global search. This
statistically shrinks the search space through factors, learning rate (r1) and momentum (2) .
iterations,which resemblesa local search. The Both are used to control weight adjustment
accelerationconstantsCr and C2 representthe along the gradientdirection. The learningrate is
weighing of the stochasticterms that pull each used to adjust step size of the weight whereas
particle toward pbest and gbest positions. They the momentum factor is used to accelerate
are normally set to 2.0 to give it a mean of I for convergenceof the network. ry (learning rate)
the cognition (2"d term) and social parts (3'd and ,t (momentum factor) were selected as 0.5
term), so that the particles would thoroughly and 1, respectively. In addition, the maximum
search the settled regions [0]. rand0 is a numberofepochs was 12000(numberofepochs
uniformly random number generator within the in BPNN : maximum iterationsxsize of swarm
72
ThammasatInt. J. Sc. Tech.,Vol. 12, No.2, April-June2007
in PSONN). All other things for training both Since the test subsetswere not used for
networkswere kept the same. training, it can be concluded that the neural
PSONN can function very well for network can perform well in determining the
prediction of sample size of torusity estimation requiredsamplesize for torusity inspectionwith
with the training subsetsandjust slightly poorer a certain confidencelevel. lts performancecan
for the validating and unseen test subsetsas be enhanced by utilizing a better training
illustrated in Table 4. Recall that the BP algorithm (optimizer). DaIa distribution
algorithm has some serious limitations assumptionsrequired in traditional statistical
associatedwith overfitting and local optimum approachescan be discardedin this approach.
problems. The outcomescomparisonshowsthat In addition, more relevantfactors,if any, could
the PSONN can avoid local optimum trap and be included rather easily by retraining the
reach near-optimal results better than the BPNN network to obtain a more realistic and
can. For both training subsetsof torusity enors, comprehensivemodel with added factors. For
their accuracieswere much lower than those of inspection of other forms, this PSONN could
PSONN. To avoid overfitting for both PSONN also be applied, but new training with
and BPNN, the proper architectureof 8 hidden correspondingdata must be conductedfirst to
layer nodes was selected based on the best capture new characteristicsof that particular
combined results between training and form and its relevant factors. This learning
validatingsubsets.When appliedto both unseen ability, simplicity, and effectiveness are
test subsets,their performanceshowed a slight important advantagesof the neural network
drop from those of training subsetsand the approach.
resultsfrom PSONN were still much higherthan
thoseof BPNN. This showsgood generalization 6. Conclusions and recommendations
performance. It can be concluded that the In coordinatemetrology, an effective and
performance of the trained PSONN is efficient samplingplan for data collection of a
remarkable and consistent for both training given feature is difficult to determine since it
samplesand testingsamples. can be affected by many factors such as
Classical BP updates weights and biases geometric tolerances,manufacturingprocesses,
based on the gradient descentconcept so the size, and confidencelevel on the measurement
solution obtained might get stuck in a local results. Establishing the correlation between
minimum easily without any mechanism to them is the key leading to such a sampling
avoid it. Particlesin PSO explore new areasin strategy. Experimental studies on torusity
the beginning and refine the search later on. produced by different processes(different enor
while keeping personal best and group best types) were carried out to identify key factors
values. Better solutionscan be found basedon that affect the sample size. Surface area, error
this concept. In addition, to avoid local traps, pattern, sampling methods,and precision band
some mechanismssuch as inertia weight and were found as relevant factors. An improved
randj are incorporated in velocity adjustment. neuralnefwork,PSONN, was proposedto model
This should result in near-optimalperformance. this relationship with significant improvement
Coupledwith the model selectiontechnique,the over the original BPNN due to the appealing
overfitting issuecan be avoidedto some extent. properties of PSO such as fast convergence,
Consequently,the results obtainedconfirm that consistencyresults, robustness,and local trap
improvementof NN can be accomplishedwhen avoidance. The results from both training
trainedby the PSO. subsetsand unseentest subsetsdemonstratethat
the PSONN has the potential for sample size
Table 4. Resultsof Toaccuracycomparison selection of a given form feature measurement,
between the two trar
een tne traini me thods especiallywhen the explicit relationshipmodel
PSONN BPNN
Torusity is hard to find or does not exist. The PSONN
erTor Training Test Set
Training
Test Sel can also be easily expanded to cover more
Set Set
5 91.1597 85.8066 86.2648 8r .3906 factors so that the correlationmodel would be
IJ 83.9762 79.6038 78.2935 74.2561 more comprehensiveand realistic. Moreover,
the PSONN could be used to handle other form
features by retraining the network with new
t)
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
14
Thammasat Int. J. Sc. Tech., Vol. 12, No. 2, April-June 2007
Division (Publication)PED, 47, pp. 135- l23lZhang, C., Shao, H., and Li, Y., Particle
149, t990. Swarm Optimisationfor Evolving Artificial
[ 1 8 ] Z h a n gY . F . , N e e A . Y . C . , F u h J . Y . H . ,N e o Neural Network, Proc. IEEE Int. Conf. on
K.S., and Loy H.K., A Neural Network Sys.,Man, and Cyb., pp.2487-2490,2000.
Approach to Determining Optimal [24] Mendes, R., Cortez, P., Rocha, M., and
Inspection Sampling Size for CMM, Neves,J., ParticleSwarmsfor Feedforward
Computer-lntegrated Manufacturing Neural Network Training, Proc. Int. Conf.
S y s t e m sV, o l . 9 ,N o . 3 ,p p . l 6 l - 1 6 9 , 1 9 9 6 . on Neural Networks (IJCNN 2002), pp.
[19] Lin 2.C., andLin W.S.,Measurement Point 1895-1899.2002.
Predictionof FlatnessGeometricTolerance [25] Gudise, V. G. and Venayagamoorthy, G. K.,
by Using Grey Theory, Prec. Eng., Vol.25, Comparison of Particle Swarm
No.3,pp. l7 l-184, 2001. Optimization and Backpropagation as
[20] Raghunandan, R., and Rao, P.V., Selection Training Algorithms for Neural Networks,
of An Optimum Sample Size for Flatness Proc. IEEE Swarm IntelligenceSymposium
Error Estimation While Using Coordinate 2003 (SfS 2003), Indianapolis,Indiana,
Measuring Machine, Int. J. Mach. Tools U S A ,p p . 1 1 0 - 1 1 7 , 2 0 0 3 .
Manu.,Yol.47,No.3-4,pp.477-482,2007. [26] ASME Yl4.5M-1994, Dimensioningand
[21] Elbeltagi,E.,Hegazy,T., and Grierson,D., Tolerancing, The American Society of
Comparison Among Five Evolutionary- MechanicalEngineers,New York, 1995.
based Optimization Algorithms, Advanced [27] Algeo, M.E. and Hopp, T.H., Form Error
EngineeringInformatics,Vol. I 9, pp.43-53, Models of the NIST Algorithm Testing
2005. System,NISTIR 4740, National Instituteof
[22]Clow, B., and White, T., An Evolutionary Standardsand Technology, Gaithersburg,
Race:A Comparisonof GeneticAlgorithms MD, 1992.
and Particle Swarm OptimizationUsed for [28] http:II en wikipedia.org/wiki/Lapping, June
Training Neural Networks,Proc. of the Int. 2006.
Conf. on Artificial Intelligence,IC-AI'O4, l29l http:II abyss.uoregon.edu/-j s/glossary/torus.
2, pp. 582-588,2004. html, August 2006.
Appendix A
75
Thammasat Int. J. Sc. Tech., Vol. 12, No.2, April-June 2007
76
ThammasatInt. J. Sc. Tech., Vol. 12, No.2, April-June2007
77