Color size grouping and purchase template generation method based on gaussian mixture clustering
By constructing a Gaussian mixture model using the Gaussian mixture clustering method, the problem of complex color and size combinations in the apparel supply chain was solved, generating accurate procurement templates, resolving supply and demand mismatches and inventory backlogs, and enabling scientific procurement decisions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU JIAOYUN YICHENG CLOTHING CO LTD
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-05
AI Technical Summary
In the existing apparel supply chain, the complexity of color and size combinations leads to supply and demand mismatch and inventory backlog. Existing procurement models cannot scientifically quantify consumer preferences, and traditional clustering methods cannot handle the coupling relationship between size and color, resulting in a disconnect between procurement demand and actual demand.
A Gaussian mixture clustering method is adopted. By constructing a Gaussian mixture model, the expectation-maximization algorithm is used to fit multiple Gaussian distribution components, calculate the posterior probability of size samples, and generate a procurement template based on the posterior probability of color identification. Combined with the indicator function to count the actual frequency, an accurate procurement template is generated.
It achieves end-to-end transformation from sales data to procurement decisions, improving the accuracy of procurement and the effectiveness of inventory optimization, reducing stockouts and backlogs, and enhancing the scientific nature and automation efficiency of procurement.
Smart Images

Figure CN122155780A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of procurement data clustering analysis technology, and in particular to a method for color and size grouping and procurement template generation based on Gaussian mixture clustering. Background Technology
[0002] In apparel supply chain procurement decisions, the complexity of color and size combinations has long been a management challenge. Actual sales data shows a systematic difference in size preferences for different colors: for example, light-colored items tend to sell well in smaller sizes, while dark-colored items perform better in larger sizes. However, current procurement models generally adopt a "uniform size ratio for all payments" strategy, ignoring the impact of color on size structure, leading to the following structural contradictions: (1) Supply and demand mismatch: popular colors are frequently out of stock due to inaccurate size structure, resulting in lost sales opportunities; while slow-selling colors are exacerbated by redundant sizes, leading to inventory backlog. (2) Subjectivity in decision-making: Procurement relies on the experience of procurement staff or simple average statistics, which is highly subjective and difficult to quantify scientifically to capture true consumer preferences; (3) Limitations of clustering methods: Although some attempts have been made to introduce hard clustering such as K-Means to group colors, it assumes that the data is spherically distributed, is sensitive to outliers, and cannot handle the soft attribution relationship of size samples, making it difficult to explain the size offset trend; more importantly, the coupling relationship between color and size is not fully utilized, and cannot accurately reflect the size preference in single-item sales behavior, resulting in the grouping results being out of touch with the procurement needs.
[0003] Therefore, existing technologies cannot fully and scientifically reflect the complex relationship between size and color in sales samples. There is an urgent need for an automated grouping method that can be based on real sales data and take into account both size preferences and color characteristics, so as to achieve accurate procurement and inventory optimization. Summary of the Invention
[0004] To overcome the shortcomings of existing technologies and provide an automated grouping method that can be based on real sales data and take into account size preferences and color characteristics, thereby achieving accurate procurement and inventory optimization, this application provides a color and size grouping and procurement template generation method based on Gaussian mixture clustering.
[0005] Firstly, the objective of this invention is achieved through the following technical solution: A method for color and size grouping and purchasing template generation based on Gaussian mixture clustering includes: Obtain historical sales data of the target product, which includes multiple sales records. Each sales record includes at least a color identifier and a corresponding size. Map all sizes to consecutive size code values according to preset rules, and expand the size code values according to the sales quantity in each sales record to form a one-dimensional size sample set. Based on the one-dimensional size sample set, a Gaussian mixture model containing multiple Gaussian distribution components is constructed, and the Gaussian mixture model is iteratively fitted by the expectation-maximization algorithm to obtain the mixture weight, mean and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. For each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, the average posterior probability of the color identifier belonging to each Gaussian distribution component is calculated, and the color identifier is assigned to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. For each size structure group, based on all size samples within the group, the frequency of occurrence of each size code value is counted using an indicator function, and the proportion of each size code value in its respective size structure group is calculated to generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color markings.
[0006] By adopting the above technical solution, this invention constructs a Gaussian mixture model with size as the observed variable and color as the mapping object, realizing end-to-end transformation from raw sales data to procurement decision template. Specifically, by mapping sizes to continuous encoded values and expanding sales quantities to form a one-dimensional size sample set, discrete size labels possess differentiable and modelable numerical attributes, while preserving the independence of each sale. This is significantly different from the traditional data processing method of "summarizing by color and then taking the average," which results in the loss of distribution information. Furthermore, by constructing a Gaussian mixture model containing multiple Gaussian distribution components and fitting it using the expectation-maximization algorithm, the multimodal distribution structure in size data can be effectively identified, such as three consumer groups: small, regular, and large. The mean and variance of each Gaussian distribution component accurately characterize the size center position and dispersion of the corresponding group, overcoming the shortcomings of hard clustering methods such as K-Means, which cannot express soft sample attribution and make overly strong assumptions about the distribution pattern. At the same time, in order to make color grouping not only based on the size mean but also comprehensively consider the entire size distribution pattern and improve business rationality, this application establishes a probability mapping mechanism between color and size structure grouping by calculating the average posterior probability of each color on its corresponding size sample and assigning it to the highest probability group. By using an indicator function to count the actual frequency of each size code value within each size structure group and calculating the proportion, a size procurement template is generated. This ensures that the template directly and accurately reflects the actual sales structure of the group, rather than an approximation of the theoretical distribution, thereby improving the accuracy of the grouping results and the industrial application value of the procurement template.
[0007] In a preferred embodiment of this application: the Gaussian distribution components are three; the iterative fitting of the Gaussian mixture model using the expectation-maximization algorithm includes: Initialize the mixture weights, mean, and variance of the three Gaussian distribution components; Repeat the expected step and the maximization step until the increment of the log-likelihood function is less than the preset convergence threshold or the maximum number of iterations is reached; The expectation step calculates the posterior probability of each size sample belonging to each Gaussian distribution component, and the maximization step updates the mixture weights, mean, and variance of each Gaussian distribution component.
[0008] By adopting the above technical solution, the number of Gaussian distribution components in the Gaussian mixture model is limited to three, corresponding to the small-size preference group, the regular-size preference group, and the large-size preference group, respectively, which conforms to the actual distribution pattern of clothing consumption. Simultaneously, by initializing the mixing weights, mean, and variance of the Gaussian distribution components, and repeatedly executing the expectation step and maximization step in the expectation-maximization algorithm until the increment of the log-likelihood function is less than the preset convergence threshold or the maximum number of iterations is reached, the stable convergence of the Gaussian mixture model parameters is ensured. This ensures clustering accuracy while avoiding overfitting or decreased interpretability due to too many components, making the size structure grouping both mathematically reasonable and consistent with the actual distribution pattern of clothing consumption.
[0009] In a preferred embodiment of this application, the step of mapping all sizes to consecutive size code values according to a preset rule includes: Based on the physical size order of the sizes, discrete size labels are sequentially mapped to equally spaced integer code values; The following formula is used to calculate the proportion of each size code value in the size structure grouping: ,in, This represents all size samples assigned to the k-th size structure group. The set consisting of s, where s is any size code value. For indicator functions, defined as: when The value is 1 if it is true, and 0 otherwise.
[0010] By adopting the above technical solution, discrete size labels are mapped to equally spaced integer codes according to their physical size order, giving the sizes measurable numerical attributes and meeting the modeling requirements of Gaussian mixture models for continuous variables. When generating size procurement templates, an indicator function is used to accurately count the frequency of occurrence of each size code value within the size structure group, and the proportion is calculated by normalizing the total number of samples. The above formula is directly based on actual sales samples to calculate the proportion, avoiding reliance on the theoretical density approximation of Gaussian mixture models, and ensuring that the size procurement template closely matches the real market demand.
[0011] In a preferred embodiment of this application: the step of expanding the size code value based on the sales quantity in each sales record to form a one-dimensional size sample set includes: Let the total number of items sold be N, and the size number of the i-th item be... The one-dimensional size sample set is represented as: ; The construction of a Gaussian mixture model containing multiple Gaussian distribution components based on the one-dimensional size sample set includes: Assuming the one-dimensional size sample set X comes from three Gaussian distributions, corresponding to a skewed small size, a regular size, and a skewed large size, the probability density function of the Gaussian mixture model is expressed as: ,in, The mixing weights for the k-th component satisfy the following condition: ; The probability density is a normal distribution. The mean of the k-th group; Let be the variance of the k-th group.
[0012] By adopting the above technical solution, the probability density function of the Gaussian mixture model is clearly defined as the weighted sum of three Gaussian distribution components, where each Gaussian distribution component is parameterized by the mixture weights, mean, and variance, and the sum of all mixture weights equals 1; each Gaussian distribution component corresponds to the smaller size structure group, the regular size structure group, and the larger size structure group, respectively; this mathematical expression not only satisfies the normalization requirement of the probability density function, but also gives each Gaussian distribution component a clear business meaning; by using the standard normal distribution probability density function to characterize the central tendency and dispersion of sizes in each group, the clustering results have both statistical rigor and business interpretability, making it easy for procurement personnel to understand and verify.
[0013] In a preferred embodiment of this application, the step of iteratively fitting the Gaussian mixture model using the expectation-maximization algorithm to obtain the mixture weights, mean, and variance corresponding to each Gaussian distribution component includes: For each sample Calculate the posterior probability of belonging to the k-th group: in, Indicates sample The underlying variable, i.e., the group label; Update Mixed Weights The expression is: Update the mean The expression is: Update variance The expression is: .
[0014] By adopting the above technical solution, in the expectation step of the expectation-maximization algorithm, the posterior probability of each size sample belonging to each Gaussian distribution component is calculated using the current parameters of the Gaussian mixture model. In the maximization step, based on the posterior probabilities of all size samples, the mixture weights, mean, and variance of each Gaussian distribution component are updated. Specifically, the mixture weights are updated to the mean of the posterior probabilities, the mean is updated to the size sample mean weighted by the posterior probabilities, and the variance is updated to the square mean of the deviations of the size sample weighted by the posterior probabilities from the new mean. This parameter update mechanism ensures that the Gaussian mixture model approximates the true data distribution in each iteration, making the clustering results converge stably. The posterior probabilities obtained in this way accurately reflect the membership relationship between size samples and each size structure group, which is more conducive to improving the grouping mapping accuracy of the subsequent color label c.
[0015] In a preferred embodiment of this application: the step of, for each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, includes: For each color identifier c, extract the corresponding size sample subset: ; Calculate the average posterior probability that color label c belongs to each group: ; Map color identifier c to the group with the highest probability: .
[0016] By adopting the above technical solution, for each color identifier, all corresponding size samples are extracted to form a size sample subset; based on the posterior probability of each size sample in the size sample subset under each Gaussian distribution component, the average posterior probability of the color identifier belonging to each Gaussian distribution component is calculated; the color identifier is assigned to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability; by aggregating the soft attribution information of all sales records under the color identifier, this invention comprehensively reflects its overall size preference distribution, which is beneficial for capturing complex features such as size skewness and multimodality, and significantly improves the consistency between the grouping results and actual consumer behavior.
[0017] In a preferred example of this application: when assigning color identifiers to size structure groupings, if the following conditions are met: If the corresponding color identifier is not found, the automatic allocation process will be paused and marked as requiring manual intervention, until a manually specified size structure group is received; among which, , To iterate over variables, This is the preset grouping and discrimination threshold.
[0018] By adopting the above technical solution, when assigning color identifiers to size structure groups, if the difference between the maximum average posterior probability of the color identifier and the maximum average posterior probability of other Gaussian distribution components is less than the preset grouping discrimination threshold, the color identifier is determined to be in the fuzzy area of the grouping boundary. At this time, the system automatically marks the color identifier as awaiting manual intervention and suspends the automatic allocation process. This effectively prevents misclassification caused by forced automatic allocation in scenarios with sparse data or insignificant preferences.
[0019] Secondly, the objective of this invention is achieved through the following technical solution: A color and size grouping and purchasing template generation system based on Gaussian mixture clustering, the system comprising: The data preprocessing module is used to obtain historical sales data of the target product. The historical sales data contains multiple sales records, each of which includes at least a color identifier and a corresponding size. All sizes are mapped to continuous size code values according to preset rules, and the size code values are expanded according to the sales quantity in each sales record to form a one-dimensional size sample set. The Gaussian mixture modeling module is used to construct a Gaussian mixture model containing multiple Gaussian distribution components based on the one-dimensional size sample set, and to iteratively fit the Gaussian mixture model through the expectation-maximization algorithm to obtain the mixture weight, mean and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. The color grouping mapping module is used to calculate the average posterior probability of the color identifier belonging to each Gaussian distribution component based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component for each color identifier, and to assign the color identifier to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. The procurement template generation module is used to group each size structure group, and based on all size samples in the group, use an indicator function to count the frequency of occurrence of each size code value, and calculate the proportion of each size code value in its respective size structure group, and generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color markings.
[0020] Thirdly, the objective of this invention is achieved through the following technical solution: A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method for color and size grouping and purchasing template generation based on Gaussian mixture clustering.
[0021] Fourthly, the objective of this invention is achieved through the following technical solution: A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the color size grouping and purchasing template generation method based on Gaussian mixture clustering as described above.
[0022] In summary, this application includes at least one of the following beneficial technical effects: 1. By mapping discrete sizes in historical sales data to continuous size codes according to preset rules, and expanding the size codes based on sales volume to form a one-dimensional size sample set, the independence and distribution of each sales transaction are preserved. Based on this one-dimensional size sample set, a Gaussian mixture model containing multiple Gaussian distribution components is constructed, and the mixture weights, mean, variance, and posterior probability of each size sample are obtained through iterative fitting using the expectation-maximization algorithm. Furthermore, by calculating the average posterior probability of each color identifier on its corresponding size sample, a probabilistic mapping from color identifiers to size structure groups is achieved. Finally, an indicator function is used to statistically analyze and normalize the actual frequency of size codes within each size structure group, generating a size procurement template that truly reflects the sales structure, effectively solving the problems of size shortages and backlogs caused by uniform proportion procurement. 2. By introducing human-machine collaborative decision-making, the system retains the ability to manually verify key processes while ensuring automation efficiency, significantly improving the robustness and reliability of the system in complex business scenarios such as new products and low-volume colors. Attached Figure Description
[0023] Figure 1 This is a flowchart of a method for color and size grouping and procurement template generation based on Gaussian mixture clustering in one embodiment of this application; Figure 2 This is a rendering of an example of the application of Gaussian mixture model in a color size grouping and procurement template generation method based on Gaussian mixture clustering in one embodiment of this application. Detailed Implementation
[0024] The present application will be further described in detail below with reference to the accompanying drawings.
[0025] In one embodiment, such as Figure 1 and Figure 2 As shown, this application discloses a method for color and size grouping and procurement template generation based on Gaussian mixture clustering, which specifically includes the following steps: S1: Obtain historical sales data for the target product. The historical sales data contains multiple sales records, each of which includes at least a color identifier and a corresponding size. Map all sizes to consecutive size code values according to preset rules, and expand the size code values based on the sales quantity in each sales record to form a one-dimensional size sample set.
[0026] In this embodiment, historical sales data refers to all retail or wholesale transaction records generated by the target clothing style within the past complete sales cycle (e.g., the most recent 90 days); each sales record contains at least three fields: the unique product identifier, color identifier, corresponding size, and the sales quantity of this record; the unique product identifier is used to lock the target style, the color identifier is a string or code such as "navy blue", "light apricot", "classic black", etc., the size is discrete labels such as "S", "M", "L", "XL", etc., and the sales quantity is the sales volume. "Mapping the sizes to continuous size coding values according to a preset rule" means converting them into an equally spaced integer sequence based on the natural order of the physical sizes of the sizes (such as S < M < L < XL), so as to endow the sizes with numerical comparability and distance measurement capabilities; for example, S → 100, M → 200, L → 300, XL → 400. "Expanding the size coding values according to the sales quantity in each sales record" means that if a sales record shows "color = navy blue, size = M, sales volume = 50", then 50 elements with a value of 200 are added to the sample set, thereby restoring the aggregated data to the granularity of individual sales behaviors and forming a one-dimensional size sample set.
[0027] Specifically, mapping all sizes to continuous size coding values includes: S11: According to the order of the physical sizes of the sizes, sequentially map the discrete size labels to equally spaced integer coding values.
[0028] In this embodiment, the size refers to discrete labels used to distinguish the wearing sizes in clothing products, such as "XS", "S", "M", "L", "XL", "XXL", etc.; the physical size order refers to the size arrangement relationship determined according to ergonomics or industry standards; the equally spaced integer coding values refer to linearly mapping the above ordered size sequence to a set of integers with a fixed tolerance. For example, with a step size of 100, XS → 100, S → 200, M → 300, L → 400, XL → 500, XXL → 600. This mapping method ensures that the numerical distance between the size coding values is proportional to the physical size difference, thus meeting the basic premise of the Gaussian mixture model for modeling continuous variables: that is, the variable has measurable distance and order attributes.
[0029] During implementation, the system incorporates a built-in "size-code mapping table," pre-configured by category experts based on national standards (such as GB / T 1335) or the company's internal sizing specifications. Taking men's shirts as an example, their sizing system includes two dimensions: collar circumference and sleeve length. For instance, "39 / 84" indicates a collar circumference of 39cm and a sleeve length of 84cm. This needs to be converted into a single sorting sequence: arranged by collar circumference as the primary sequence, followed by sleeve length, and then assigned codes 100, 200, ..., 1000. For international brands' common "US 0, 2, 4, 6..." or "EU 34, 36, 38..." systems, the same numerical sorting and equal-interval mapping is used, such as US 0→100, US 2→200, US 4→300. A certain women's dress SKU involves 7 sizes: XXS, XS, S, M, L, XL, XXL, which are mapped to codes [100, 200, 300, 400, 500, 600, 700].
[0030] Furthermore, the multidimensional size sorting rules include: for size labels containing multiple dimensions, such as 'collar circumference / sleeve length' for men's shirts, they are first sorted in ascending order by the primary dimension (collar circumference), and if the primary dimensions are the same, they are sorted in ascending order by the secondary dimension (sleeve length), and then equally spaced integer codes are assigned sequentially.
[0031] Specifically, let the total number of items sold be N, and the size number of the i-th item be . The one-dimensional size sample set is represented as: For example, taking a women's knitwear brand as an example, its historical sales data includes 6 sizes (XS, S, M, L, XL, XXL), mapped to size codes [100, 200, 300, 400, 500, 600] according to the above rules. Assuming a total of 1,335,628 pieces were sold during the statistical period, of which the color "dusty blue" sold 398,172 pieces in size M (code 300), then in the one-dimensional size sample set, the number 300 will appear 398,172 times. The final set... It is a one-dimensional array with a length equal to the total sales volume, where each element represents the size code value of a sold item.
[0032] S2: Based on a one-dimensional size sample set, construct a Gaussian mixture model containing multiple Gaussian distribution components, and iteratively fit the Gaussian mixture model using the expectation-maximization algorithm to obtain the mixture weight, mean, and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component.
[0033] In this embodiment, the Gaussian distribution component refers to each independent normal distribution sub-model in the Gaussian mixture model, used to characterize a potential consumer preference pattern in the size data. The Gaussian mixture model is a probabilistic generative model that assumes the observed data (i.e., a one-dimensional size sample set) is a linear superposition of several Gaussian distributions (normal distributions). This embodiment uses three Gaussian distribution components for cluster lifetime, which respectively characterize three typical structures commonly found in consumer groups: "smaller size preference," "regular size preference," and "larger size preference." The Expectation-Maximization Algorithm (EM algorithm) is an iterative optimization algorithm used to estimate model parameters in the presence of latent variables (here, the group label to which the sample belongs). By fitting the Gaussian mixture model using the EM algorithm, the mixture weight, mean, and variance of each Gaussian distribution component can be output; the mixture weight represents the proportion of that component in the overall distribution, the mean represents the size center position of that group, and the variance represents the dispersion of the sizes in that group.
[0034] In step S2, there are three Gaussian distribution components; the Gaussian mixture model is iteratively fitted using the expectation-maximization algorithm, including: S21: Initialize the mixture weights, mean, and variance of the three Gaussian distribution components.
[0035] In this embodiment, the number of Gaussian distribution components is limited to "three". In a preferred embodiment of the invention, the number of Gaussian distribution components is fixed at three to match the typical consumer structure of clothing sizes being small, regular, and large. In practical applications, those skilled in the art can extend this to more than three Gaussian distribution components.
[0036] Specifically, in the sales data analysis of men's T-shirts for a major fast fashion brand in a certain year's spring / summer season, Gaussian mixture models with K=2 to K=5 were tried on a one-dimensional size sample set of 127 SKUs, and the Bayesian Information Criterion (BIC) was used for model selection. The results showed that when K=3, the BIC value reached the global minimum (average BIC=-1.82×10). 6 Furthermore, the mean intervals of the three groups are significant, with means of 291, 308, and 332 respectively, and standard deviations all between 100 and 120, indicating clear physical meaning. However, when K=4, the mixing weights of the newly added components are generally below 0.05, and the mean overlaps significantly with adjacent components, lacking clear business meaning. Therefore, the system defaults to fixing the number of Gaussian distribution components to three, assigning semantic labels to them respectively: "Group_1: Smaller", "Group_2: Normal", and "Group_3: Larger".
[0037] S22: Repeat the expectation step and the maximization step until the increment of the log-likelihood function is less than the preset convergence threshold or the maximum number of iterations is reached; wherein, the expectation step calculates the posterior probability of each size sample belonging to each Gaussian distribution component, and the maximization step updates the mixture weight, mean and variance of each Gaussian distribution component.
[0038] In this embodiment, a Gaussian mixture model containing multiple Gaussian distribution components is constructed based on a one-dimensional size sample set, including: S21: Assume that the one-dimensional size sample set X comes from three Gaussian distributions, corresponding to the smaller, regular, and larger sizes, respectively. The probability density function of the Gaussian mixture model is expressed as: ,in, The mixing weights for the k-th component satisfy the following condition: ; The probability density is a normal distribution. The mean of the k-th group; Let be the variance of the k-th group.
[0039] In this embodiment, the three Gaussian distribution components are respectively mapped to "smaller size structure group", "regular size structure group" and "larger size structure group". This is based on the semantic binding of the relative order of the means and industry experience. After the system completes the EM fitting, it automatically sorts the three components in ascending order of the means: the one with the smallest mean is marked as "smaller", the one in the middle is "regular", and the one with the largest mean is "larger".
[0040] Specifically, in the initialization phase, K-Means clustering (K=3) is first performed on the one-dimensional size sample set to obtain three initial cluster centers as the initial means of the Gaussian distribution components. Calculate the variance of each cluster sample as the initial variance. The sample proportions of each cluster were used as the initial mixing weights. In practical applications, mixed weights The initial value can also be set to a uniform distribution or based on the initial sample ratio.
[0041] Then proceed to the EM iteration: In the E step, for each sample Calculate the posterior probability of belonging to the k-th group: ,in, Indicates sample The underlying variable, i.e., the group label; In step M, update the parameters: Update Mixed Weights The expression is: ; Update the mean The expression is: ; Update variance The expression is: The iteration continues until the log-likelihood function changes by less than 10^−6 or reaches 100 iterations. Finally, three sets of parameters are obtained: a skewed small group, a regular group, and a skewed large group, along with the parameters for each sample. .
[0042] In this embodiment, the posterior probability refers to the probability given the current Gaussian mixture model parameters. Under these conditions, size sample The conditional probability of belonging to the k-th Gaussian distribution component; its calculation formula is a specific application of Bayes' theorem in the Gaussian mixture model, the numerator is the product of the prior weight of the k-th component and the likelihood function, and the denominator is the sum of the joint likelihoods of all components for this sample.
[0043] Furthermore, the Expectation-Maximization (EM) algorithm is an iterative optimization method for estimating parameters of probabilistic models containing latent variables. It comprises alternating "Expectation Step" (E-step) and "Maximization Step" (M-step). Initialization refers to assigning initial values to the mixture weights, mean, and variance of each Gaussian distribution component. Repeatedly executing the Expectation and Maximization steps involves iteratively calculating the posterior probability of the samples and updating the model parameters until a stopping condition is met. The "Maximization Step" involves re-estimating the parameters of the Gaussian mixture model based on the posterior probability matrix output from the E-step, making it more closely match the current data distribution. The mixture weights... Updated to the average posterior probability of all samples for the k-th component, reflecting the breadth of coverage of that component in the overall population; mean Updated to a posterior probability-weighted size sample mean, reflecting the central location of this component; variance It is updated to the posterior probability weighted mean of the deviation, which characterizes the dispersion of this component.
[0044] "The increment of the log-likelihood function is less than the preset convergence threshold" means that the absolute value of the difference between the log-likelihood value of the current iteration and the previous iteration is less than a very small positive number (such as 10⁻). 6 This indicates that the model is close to a local optimum; reaching the maximum number of iterations is a safety mechanism to prevent the algorithm from getting stuck in an infinite loop, such as setting it to 100 times.
[0045] Specifically, the convergence criterion for a Gaussian mixture model is when the change in the log-likelihood function... The iteration stops when the number of iterations falls below a preset threshold or reaches the maximum number of iterations. For example, the change in the log-likelihood function... This refers to the absolute value of the difference between the log-likelihood value of the current iteration and the log-likelihood value of the previous iteration. The value of the log-likelihood function is... The calculation formula is: By calculating the log-likelihood function value of the current iteration and the previous round By comparing the differences and taking the absolute value, we obtain the log-likelihood function change. ;when Stop iterating when the number of iterations is ≥100.
[0046] S3: For each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, calculate the average posterior probability of the color identifier belonging to each Gaussian distribution component, and assign the color identifier to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability.
[0047] In this embodiment, color identifiers refer to unique labels used to distinguish different colors in sales data, such as the color field in an SKU. All size samples corresponding to a color identifier refer to the subset of size code values corresponding to all product records belonging to that color selected from a one-dimensional size sample set. The average posterior probability is the arithmetic mean of the posterior probabilities of all size samples under that color under a certain Gaussian distribution component, used to characterize the overall tendency of that color to group the size structure. "Assigning to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability" means using the maximum a posteriori probability criterion (MAP) to complete the mapping from color to group.
[0048] For example, taking the color "hazy blue" as an example, its corresponding size sample subset It contains 431,122 elements (mainly concentrated in codes 300 and 400). Iterate through each sample in this subset. The average posterior probability is obtained by summing the posterior probabilities of the three Gaussian distribution components and then dividing by the subset size.
[0049] P(haze blue ∈ small) = 0.12, P(haze blue ∈ normal) = 0.75, P(haze blue ∈ larger) = 0.13.
[0050] Since 0.75 is the maximum, "haze blue" is assigned to the "regular size structure group". Similarly, if the average posterior probability of the color "burgundy" is [0.68, 0.25, 0.07], it is assigned to the "smaller size structure group".
[0051] S4: For each size structure group, based on all size samples within the group, use an indicator function to count the frequency of occurrence of each size code value, and calculate the proportion of each size code value in its respective size structure group to generate a size procurement template corresponding to the size structure group; wherein, the size procurement template is used to guide the size procurement ratio of products with corresponding color labels.
[0052] In this embodiment, the size structure grouping refers to the three size preference groups identified by Gaussian mixture clustering: small, regular, and large; "using indicator functions to count the frequency of occurrence of each size code value" means that for each size code value s within a group, the frequency of occurrence of each size code value s satisfies the following criteria: The number of samples, where the indicator function is defined as: ,when The value is 1 when it equals s, and 0 otherwise; "Calculate the proportion of each size code value in its respective size structure group", that is, divide the frequency of the size by the total number of samples in the group to obtain the empirical probability distribution; the size procurement template is this proportion vector, which is directly used to guide the stocking ratio of each size during procurement.
[0053] Specifically, the proportion of each size code value in the size structure grouping is calculated using the following formula: ,in, This represents all size samples assigned to the k-th size structure group. The set constituted refers to the set of all size samples included in a certain size preference group identified by Gaussian mixture clustering; s is any size code value. For indicator functions, defined as: when The value is 1 if the condition is met, and 0 otherwise. This formula is directly based on the statistical proportion of actual sales records, avoiding reliance on the theoretical probability density of a Gaussian distribution. This approximation eliminates the distortion of the procurement ratio caused by model fitting bias, ensuring that the template closely matches the actual market demand.
[0054] The purchasing template refers to the frequency vector of each size code value within all groups, as shown in the formula above. The molecule is size s in The actual number of units sold in a group, with the denominator being the total number of units sold in that group.
[0055] For example, grouped by larger size structure For example, this group contains 328,741 sales records. The system iterates through all samples, encoding each possible size s∈{100, 200, 300, 400, 500, 600, 700}, and accumulates the indicator function value: When s = 500 (corresponding to L), we have =98622; When s = 600 (corresponding to XL), we have =131496; When s = 700 (corresponding to XXL), we have =65748; The remaining sizes totaled 32,875 pieces.
[0056] The generated procurement template is as follows: =[0.0%, 0.0%, 0.0%, 10.0%, 30.0%, 40.0%, 20.0%], since the proportion of small sizes is extremely low at this point, it is rounded to 0%. Once the color "dark olive green" is assigned to this group, its procurement will be carried out according to this proportion. In contrast, if Gaussian theoretical density calculations are used (such as...) The rapid decline at the tail end of the price chart can lead to an underestimation of the proportion of larger sizes, resulting in XXL sizes still being out of stock after actual delivery. Therefore, this embodiment must generate a procurement template based on statistical analysis of actual sales frequency using an indicator function.
[0057] In one embodiment, in step S3, for each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, the following is included: S31: For each color identifier c, extract the corresponding size sample subset: ; S32: Calculate the average posterior probability that color label c belongs to each group: ; S33: Map color identifier c to the group with the highest probability: .
[0058] In this embodiment, "assigning the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability" means making a decision using the Maximum A Posteriori (MAP) criterion: that is, selecting k that maximizes P(c∈k) as the final group to which color c belongs.
[0059] For example, assuming the maximum average posterior probability of color identifier c being "obsidian black" is 0.690 (corresponding to k=2), it is assigned to the "regular size structure grouping"; If the calculation result for another color identifier c, "burgundy", is P∈[0.71, 0.22, 0.07], then it is assigned to the "smaller size structure group" (k=1). For the color identifier c, which is the neutral color "oatmeal", if the result is P∈[0.33, 0.34, 0.33], although the maximum value is 0.34 (k=2), it will trigger the manual intervention mechanism because its difference from other components is very small.
[0060] After allocation, the system updates the "color-group mapping table" and directly calls the experience frequency vector of the corresponding group during the procurement template generation stage. For example, after "burgundy" is mapped to a subgroup, its procurement ratio automatically adopts the template of that group: S accounts for 35%, M accounts for 42%, and L accounts for 18%, instead of the conventional template where M accounts for 32% and L accounts for 34%.
[0061] In one embodiment, when assigning color identifiers to size structure groups, if the following conditions are met: If the corresponding color identifier is not found, the automatic allocation process will be paused and an early warning notification will be triggered until a manually specified size structure grouping is received; , For the traversal variable, it represents any condition that satisfies Other size structure grouping indexes; This is the preset grouping and discrimination threshold. For the optimal grouping probability, This represents the probability of suboptimal grouping. The inequality states that if the difference between the probability of color c being in the optimal group and the probability of being in the second-best group is less than a preset threshold... This indicates that the color's classification across multiple size groupings is unclear, leading to grouping ambiguity. (Preset threshold) The larger the difference (e.g., >0.3), the more pronounced the color preference for a particular size range; preset threshold. The smaller the difference (e.g., <0.1), the more ambiguous the color's classification, indicating it "oscillates" between multiple groups. For fast fashion / high-frequency iteration categories, The value range is 0.15-0.20, for high-end / low-tolerance product categories (such as formal wear and evening gowns). The value range is 0.10-0.15. In a preferred embodiment, the grouping discrimination threshold τ is obtained through historical data calibration: the consistency rate between the manual final grouping results and the automatic assignment results of all colors in the past year is statistically analyzed, and the minimum value that makes the consistency rate not less than 95% is selected. The value is used as the system default parameter.
[0062] For example, =2 (regular group), the maximum probability is 0.371, the second-best probability is 0.362 (from the partial group), the difference is 0.371-0.362=0.009. (System preset) =0.15, since 0.009 < 0.15, the color classification is unclear. For example, the new color "Lime Green" only sold 2103 units, with a probability distribution of [0.48, 0.45, 0.07], and a difference of 0.03, which is also less than... This also triggered a review.
[0063] Specifically, marking it as pending manual intervention means updating the status field of the color-coded identifier to "pending_review" within the system and highlighting it in the procurement decision dashboard; pausing automatic allocation means not including it in any size structure grouping template generation process to avoid using incorrect templates in the procurement plan; receiving manually designated size structure groups means providing an interactive entry point through the user interface, allowing procurement specialists or category managers to manually select the grouping based on auxiliary information such as historical trends, seasonal factors, competitor data, and designer suggestions.
[0064] Once a color is marked as 'awaiting manual intervention', the system adds it to the 'pending queue' of the procurement decision dashboard and freezes the generation of its procurement template. After logging into the system, procurement specialists can view the size histogram, the overlay of three Gaussian distribution curves, and historical records of grouping products of the same color in the same period. Specialists select the target group from the drop-down menu and submit it. After the system verifies the validity of the input, it updates the group label and triggers the template to be recalculated.
[0065] For example, when "oatmeal color" is marked as pending review, the purchasing manager logs into the intelligent purchasing system, sees the entry in the "Pending Colors" list, and can view supplementary information: Visualization panel: Displays a superimposed graph of its size histogram and three Gaussian curves; Historical comparison: Last year, products in the same color family were mostly categorized into smaller subgroups; Seasonal factor: This season's trend is for loose-fitting styles, which may lean towards larger sizes.
[0066] After comprehensive evaluation, the supervisor selected "Smaller Size Grouping" from the drop-down menu and submitted. The system immediately updated its grouping label, removed the "pending_review" status, and included its sales samples in the template statistics for the smaller group.
[0067] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0068] In one embodiment, a color size grouping and procurement template generation system based on Gaussian mixture clustering is provided, which corresponds to the color size grouping and procurement template generation method based on Gaussian mixture clustering in the above embodiment.
[0069] A color-size grouping and procurement template generation system based on Gaussian mixture clustering includes a data preprocessing module, a Gaussian mixture modeling module, a color grouping mapping module, and a procurement template generation module. Detailed descriptions of each functional module are as follows: The data preprocessing module is used to obtain historical sales data of the target product. The historical sales data contains multiple sales records, each of which includes at least a color identifier and a corresponding size. All sizes are mapped to continuous size code values according to preset rules, and the size code values are expanded according to the sales quantity in each sales record to form a one-dimensional size sample set. The Gaussian Mixture Modeling module is used to construct a Gaussian mixture model containing multiple Gaussian distribution components based on a one-dimensional size sample set. It iteratively fits the Gaussian mixture model through the expectation-maximization algorithm to obtain the mixture weight, mean, and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. The color grouping mapping module is used to calculate the average posterior probability of a color identifier belonging to each Gaussian distribution component based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component for each color identifier, and to assign the color identifier to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. The procurement template generation module is used to group each size structure group, and based on all size samples in the group, use an indicator function to count the frequency of occurrence of each size code value, and calculate the proportion of each size code value in its respective size structure group, and generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color labels.
[0070] For specific limitations regarding the color size grouping and procurement template generation system based on Gaussian mixture clustering, please refer to the limitations of the color size grouping and procurement template generation method based on Gaussian mixture clustering mentioned above, which will not be repeated here. Each module in the above-mentioned color size grouping and procurement template generation system based on Gaussian mixture clustering can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in the processor of the computer device in hardware form or independent of it, or it can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0071] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor: S1: Obtain historical sales data for the target product. The historical sales data contains multiple sales records, each of which includes at least a color identifier and a corresponding size. Map all sizes to consecutive size code values according to preset rules, and expand the size code values according to the sales quantity in each sales record to form a one-dimensional size sample set. S2: Based on a one-dimensional size sample set, construct a Gaussian mixture model containing multiple Gaussian distribution components, and iteratively fit the Gaussian mixture model through the expectation-maximization algorithm to obtain the mixture weight, mean and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. S3: For each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, calculate the average posterior probability of the color identifier belonging to each Gaussian distribution component, and assign the color identifier to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. S4: For each size structure group, based on all size samples within the group, use an indicator function to count the frequency of occurrence of each size code value, and calculate the proportion of each size code value in its respective size structure group to generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color labels.
[0072] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0073] In one embodiment, particularly according to an embodiment of the invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, embodiments of the invention include a computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the color-size grouping and purchasing template generation method based on Gaussian mixture clustering. In such an embodiment, the computer program can be downloaded and installed from a network via a communication module, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), it performs the various functions defined in this invention.
[0074] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0075] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for color and size grouping and purchasing template generation based on Gaussian mixture clustering, characterized in that, include: Obtain historical sales data for the target product, wherein the historical sales data contains multiple sales records, and each sales record includes at least a color identifier and a corresponding size; All sizes are mapped to continuous size codes according to preset rules, and the size codes are expanded according to the sales quantity in each sales record to form a one-dimensional size sample set. Based on the one-dimensional size sample set, a Gaussian mixture model containing multiple Gaussian distribution components is constructed, and the Gaussian mixture model is iteratively fitted by the expectation-maximization algorithm to obtain the mixture weight, mean and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. For each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, the average posterior probability of the color identifier belonging to each Gaussian distribution component is calculated, and the color identifier is assigned to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. For each size structure group, based on all size samples within the group, the frequency of occurrence of each size code value is counted using an indicator function, and the proportion of each size code value in its respective size structure group is calculated to generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color markings.
2. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 1, characterized in that, The Gaussian distribution has three components; the iterative fitting of the Gaussian mixture model using the expectation-maximization algorithm includes: Initialize the mixture weights, mean, and variance of the three Gaussian distribution components; Repeat the expected step and the maximization step until the increment of the log-likelihood function is less than the preset convergence threshold or the maximum number of iterations is reached; The expectation step calculates the posterior probability of each size sample belonging to each Gaussian distribution component, and the maximization step updates the mixture weights, mean, and variance of each Gaussian distribution component.
3. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 1, characterized in that, The process of mapping all sizes to consecutive size code values according to a preset rule includes: Based on the physical size order of the sizes, discrete size labels are sequentially mapped to equally spaced integer code values; The following formula is used to calculate the proportion of each size code value in the size structure grouping: ,in, This represents all size samples assigned to the k-th size structure group. The set consisting of s, where s is any size code value. For indicator functions, defined as: when The value is 1 if it is true, and 0 otherwise.
4. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 1, characterized in that, The step involves expanding the size code values based on the sales quantity in each sales record to form a one-dimensional size sample set, including: Let the total number of items sold be N, and the size number of the i-th item be... The one-dimensional size sample set is represented as: ; The construction of a Gaussian mixture model containing multiple Gaussian distribution components based on the one-dimensional size sample set includes: Assuming the one-dimensional size sample set X comes from three Gaussian distributions, corresponding to a skewed small size, a regular size, and a skewed large size, the probability density function of the Gaussian mixture model is expressed as: ,in, The mixing weights for the k-th component satisfy the following condition: ; The probability density is a normal distribution. The mean of the k-th group; Let be the variance of the k-th group.
5. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 4, characterized in that, The step of iteratively fitting the Gaussian mixture model using the expectation-maximization algorithm to obtain the mixture weights, mean, and variance corresponding to each Gaussian distribution component includes: For each sample Calculate the posterior probability of belonging to the k-th group: in, Indicates sample The underlying variable, i.e., the group label; Update Mixed Weights The expression is: Update the mean The expression is: Update variance The expression is: .
6. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 1 or 5, characterized in that, For each color identifier, based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component, the following is included: For each color identifier c, extract the corresponding size sample subset: ; Calculate the average posterior probability that color label c belongs to each group: ; Map color identifier c to the group with the highest probability: .
7. The method for color and size grouping and purchasing template generation based on Gaussian mixture clustering according to claim 6, characterized in that, When assigning color codes to size structure groups, if the following conditions are met: If the corresponding color identifier is not found, the automatic allocation process will be paused and marked as requiring manual intervention, until a manually specified size structure group is received; among which, , To iterate over variables, This is the preset grouping and discrimination threshold.
8. A color-size grouping and procurement template generation system based on Gaussian mixture clustering, characterized in that, The system includes: The data preprocessing module is used to obtain historical sales data of the target product. The historical sales data contains multiple sales records, each of which includes at least a color identifier and a corresponding size. All sizes are mapped to continuous size code values according to preset rules, and the size code values are expanded according to the sales quantity in each sales record to form a one-dimensional size sample set. The Gaussian mixture modeling module is used to construct a Gaussian mixture model containing multiple Gaussian distribution components based on the one-dimensional size sample set, and to iteratively fit the Gaussian mixture model through the expectation-maximization algorithm to obtain the mixture weight, mean and variance corresponding to each Gaussian distribution component, as well as the posterior probability of each size sample belonging to each Gaussian distribution component. The color grouping mapping module is used to calculate the average posterior probability of the color identifier belonging to each Gaussian distribution component based on all size samples corresponding to the color identifier and their posterior probabilities under each Gaussian distribution component for each color identifier, and to assign the color identifier to the size structure group corresponding to the Gaussian distribution component with the largest average posterior probability. The procurement template generation module is used to group each size structure group, and based on all size samples in the group, use an indicator function to count the frequency of occurrence of each size code value, and calculate the proportion of each size code value in its respective size structure group, and generate the size procurement template corresponding to the size structure group. The size procurement template is used to guide the size procurement ratio of products with corresponding color markings.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the color size grouping and procurement template generation method based on Gaussian mixture clustering as described in any one of claims 1 to 7.
10. A computer program product comprising a computer program / instructions, characterized in that, When executed by a processor, the computer program / instruction implements the steps of the color size grouping and purchasing template generation method based on Gaussian mixture clustering as described in any one of claims 1 to 7.