Cotton spinning quality index measuring method based on random forest and support vector machine
By using random forest and support vector machine models to deeply mine cotton textile production data, the problems of insufficient data processing capabilities and outdated analysis methods in cotton textile enterprises have been solved, achieving a dual improvement in product quality and production efficiency.
Patent Information
- Application Number
- CN202511721859.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-17
AI Technical Summary
Cotton textile enterprises face challenges in meeting the dual demands of improving both quality and efficiency due to insufficient data processing capabilities, outdated data analysis methods, and low accuracy resulting from reliance on manual methods for measuring production levels.
We employ a cotton spinning quality index measurement method based on random forest and support vector machine. Through data collection, preprocessing, index correlation analysis, and dual model construction, we achieve in-depth mining and accurate measurement of cotton spinning production data.
It improves the accuracy of cotton spinning production data analysis, provides reliable decision-making basis, supports enterprises in optimizing production processes and resource allocation, and enhances product quality and production efficiency.
Smart Images

Figure CN121544112A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of cotton textile production data analysis and intelligent measurement technology, specifically to a method for measuring cotton textile quality indicators based on random forest and support vector machine. Background Technology
[0002] With the deep application of technologies such as big data, artificial intelligence, and 5G in the textile industry, cotton textile enterprises in my country are actively promoting the construction of "smart spinning workshops." By cooperating with telecommunications operators to build data centers, they have achieved centralized collection of data on production processes, equipment operation, and product quality.
[0003] However, cotton textile enterprises still face prominent problems: First, their data processing capabilities are insufficient. The collected data suffers from noise and missing values due to the complex production environment, and most enterprises remain at the data storage level, lacking in-depth feature mining. Second, their data analysis methods are outdated. Most enterprises rely only on basic statistical analysis and have limited application of machine learning algorithms, making it difficult to identify key influencing factors from massive amounts of data. Third, production level measurement relies on manual methods, which are highly subjective and have low accuracy, failing to meet the dual needs of enterprises to improve quality and efficiency. Therefore, it is necessary to propose a cotton textile quality index measurement method based on random forests and support vector machines. Summary of the Invention
[0004] To address the problems in existing technologies, this invention provides a method for measuring cotton spinning quality indicators based on random forests and support vector machines.
[0005] The technical solution adopted by this invention to solve its technical problem is: a cotton spinning quality index measurement method based on random forest and support vector machine, including the following steps: 1) Data Collection and Indicator Selection: Relying on the 5G "Smart Spinning Workshop" data center of cotton textile enterprises, comprehensive data of the entire production process is collected, covering process parameters, equipment operating status, product quality inspection results, and production efficiency data; core analysis indicators are selected and divided into quality-related indicators (yarn defects, fine yarn, bobbin tension, preparation, weaving, yarn defects, fabric defects) and production level-related indicators (machine type, variety, length, number of stops, downtime, number of spindles, basis weight, first-grade rate, weight), constructing two types of datasets; variety indicators are simplified by merging pure cotton yarns of the same type but different counts, such as C30, C32, and C40, into the same category to reduce data dimensions, avoid statistical bias caused by insufficient sample size, and improve data representativeness; 2) Data preprocessing: To ensure data quality and provide a reliable foundation for subsequent modeling, four preprocessing operations are performed: A. Missing value handling: For string-type variables such as machine type and product type, since the validity of the data cannot be guaranteed by reasonable filling, the missing records are directly deleted; for numerical variables such as number of spindles and quantity, the mean filling method is used to fill missing values and maintain the original distribution characteristics of the data. B. Duplicate value handling: A row-by-row comparison and deduplication algorithm is used to fully verify the entire dataset to confirm that there are no duplicate records in the dataset, thus ensuring the reliability of the analysis results. C. Outlier handling: Using box plot tools, outlier data points that exceed the normal process parameter range or violate business logic can be intuitively identified through five key nodes: minimum, lower quartile, median, upper quartile, and maximum value. These outlier data points are then removed to avoid misleading the model training. D. Data Normalization: The min-max standardization method is used to uniformly process all numerical indicators, eliminating the influence of different units of measurement (such as the unit of length "meter" and the unit of weight "kilogram"), so that each indicator has a balanced weight in model training. The standardization formula is: ,in The original data, The minimum value of this variable. This represents the maximum value of the variable. The data is after normalization; 3) Correlation analysis of indicators: By calculating the Pearson correlation coefficients between each indicator and drawing a correlation heatmap, the relationship between the indicators is systematically analyzed. E. Quality Dimension: Clearly define the strong correlation between the yarn twisting process and yarn defects (correlation coefficient 0.99), the weaving process and weaving defects (correlation coefficient 0.99), and the potential correlation between the spinning process and yarn and weaving defects, so as to provide a basis for identifying quality influencing factors; F. Production Level Dimension: Explore the inherent logic between indicators such as length and actual total length, weight and quantity, clarify the interaction mechanism of production links, and lay the foundation for production level measurement. The Pearson correlation coefficient ranges from -1 to 1. The closer the correlation coefficient is to 1, the stronger the positive correlation between the two indicators; the closer it is to -1, the stronger the negative correlation between the two indicators. 4) Dual model construction and optimization training: Random forest and support vector machine classification models are constructed respectively, with "first-class product rate" as the core objective variable, which is divided into "high" and "low" levels to achieve quantitative measurement of quality and production level. E. Construction of Random Forest Classification Model: The Bootstrap sampling technique is used to randomly sample multiple subsets of data from the original training set, and each subset of data is used to train a decision tree independently. During decision tree training, each node randomly selects some features when splitting, calculates split gains such as Gini coefficient or information gain, selects the optimal features for splitting, and enhances the model's generalization ability. The optimal configuration was determined by optimizing the hyperparameters through a 5-fold hierarchical sampling grid search: max_depth=15, min_samples_leaf=2, min_samples_split=2, n_estimators=100. When the model makes predictions, the final classification result is determined through a voting mechanism of multiple decision trees, and the importance of each indicator is output to identify key influencing factors. F. Construction of Support Vector Machine Classification Model: First, the continuous features are discretized using equal frequency, and then the StandardScaler tool is used for standardization to solve the problem of support vector machines being sensitive to feature scale. The input data is defined as a set of labeled samples. ,in for A 3D feature vector is used to describe the attributes of a sample. These are binary labels used to indicate the category to which a sample belongs; By optimizing key parameters through a 5-fold stratified sampling grid search, the penalty coefficient C=1, the kernel function coefficient gamma=1, and the kernel function type rbf (radial basis function) were determined. The core objective of the model is to achieve maximum margin classification in the linearly separable case. It assumes the existence of a linear hyperplane that completely separates positive and negative samples, and defines the geometric margin from the sample to the hyperplane as: ; in, Let be the normal vector of the hyperplane. Let the hyperplane intercept be... For sample feature vectors, For sample labels; The model objective is to maximize the minimum geometric margin of all samples, i.e., to solve an optimization problem: ; , ; Normalization process The above optimization problem can be transformed into a convex optimization problem: ; , ; To address noise and outliers in the data, slack variables are introduced. Construct a soft-margin optimization problem: ; , ; , ; Among them, the penalty coefficient C is used as the coefficient of the regularization term to regulate the balance between the model's tolerance for error and complexity. C=1 indicates a moderate level of regularization. Using the rbf kernel function The nonlinear data in cotton spinning production is mapped to an infinite-dimensional feature space, which is transformed into a linearly separable problem. The optimal classification hyperplane is found by maximizing the sample interval. The final classification decision function is a non-linear classifier: ;in, For the set of support vectors, To use Lagrange multipliers to achieve accurate prediction of the "first-class product rate" level; 5) Model Evaluation and Practical Application: Accuracy, F1 score, and ROC curve are used as three core metrics to comprehensively evaluate the classification performance of the two models, ensuring high reliability and generalization ability. The successfully trained models are then applied to actual production data from cotton spinning enterprises. Accurately measure product quality grade ("first-class product rate" high / low), and key quality-affecting links such as positioning cylinder twisting and weaving; Quantitative analysis of production levels clarifies the mechanism by which indicators such as length, number of spindles, and quantity affect production efficiency; It provides targeted decision-making recommendations to support enterprises in optimizing production processes (such as adjusting process parameters) and rationally allocating resources (such as optimizing the ratio of manpower to equipment), thereby achieving a dual improvement in product quality and production efficiency.
[0006] Specifically, in step 1, the data collection relies on the 5G data center built by the cotton textile enterprise in cooperation with China Mobile, China Unicom or China Telecom to realize the centralized collection and real-time management of equipment operation, process parameters and quality inspection data of each process.
[0007] Specifically, in step 3, the strong correlation between bobbin twist and yarn defects (correlation coefficient 0.99) and between fabric weaving and fabric defects (correlation coefficient 0.99) is clarified by using a heat map.
[0008] Specifically, in step 4, the random forest model in E can output the feature importance of each indicator, and the correlation of the base learner is reduced by parallel training of multiple decision trees, effectively avoiding overfitting.
[0009] Specifically, in step 4, the rbf kernel function in F can map the samples to an infinite-dimensional feature space, efficiently handling nonlinear correlation problems in cotton spinning production data; the penalty coefficient C=1 achieves a balance between model error tolerance and complexity, avoiding overfitting or underfitting.
[0010] The beneficial effects of this invention are as follows: The cotton textile quality index measurement method based on random forest and support vector machine described in this invention has significant practical value and technical advantages: First, through standardized preprocessing procedures and clear normalization formulas, it efficiently solves problems such as noise, missing values, and inconsistent dimensions in cotton textile production data. Combined with index correlation mining, it fully releases the value of data and breaks the dilemma of "rich data, poor knowledge". Second, the support vector machine model incorporates formulas such as complete geometric margin, optimization objective, and decision function, and works in conjunction with the random forest model to avoid the limitations of a single model, avoid the subjectivity of manual measurement, accurately identify key influencing factors of quality and production level, and achieve high measurement accuracy. Third, it provides a complete process solution. The model formula support enhances reproducibility, aligns with the industry's digital upgrade orientation, and can provide reliable decision-making basis for enterprise production process optimization and rational resource allocation, helping to reduce costs and increase efficiency, and significantly enhance core competitiveness. Attached Figure Description
[0011] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0012] Figure 1 A schematic diagram illustrating the principle of the random forest method for measuring cotton spinning quality indicators based on random forest and support vector machine provided by this invention; Figure 2 The flowchart of the support vector machine for the cotton spinning quality index measurement method based on random forest and support vector machine provided by the present invention; Figure 3 A heatmap showing the correlation between quality dimensions of the cotton spinning quality index measurement method based on random forest and support vector machine provided by this invention. Figure 4 The production level dimension correlation heatmap of the cotton spinning quality index measurement method based on random forest and support vector machine provided by the present invention. Detailed Implementation
[0013] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below in conjunction with specific embodiments.
[0014] like Figures 1-4 As shown, the present invention provides the following technical solution: Example: A method for measuring cotton spinning quality indicators based on random forest and support vector machine, including the following steps: 1) Data Collection and Indicator Selection: Relying on the 5G "Smart Spinning Workshop" data center of cotton textile enterprises, comprehensive data of the entire production process is collected, covering process parameters, equipment operating status, product quality inspection results, and production efficiency data; core analysis indicators are selected and divided into quality-related indicators (yarn defects, fine yarn, bobbin tension, preparation, weaving, yarn defects, fabric defects) and production level-related indicators (machine type, variety, length, number of stops, downtime, number of spindles, basis weight, first-grade rate, weight), constructing two types of datasets; variety indicators are simplified by merging pure cotton yarns of the same type but different counts, such as C30, C32, and C40, into the same category to reduce data dimensions, avoid statistical bias caused by insufficient sample size, and improve data representativeness; Indicator selection:
[0015] 2) Data preprocessing: To ensure data quality and provide a reliable foundation for subsequent modeling, four preprocessing operations are performed: A. Missing value handling: For string-type variables such as machine type and product type, since the validity of the data cannot be guaranteed by reasonable filling, the missing records are directly deleted; for numerical variables such as number of spindles and quantity, the mean filling method is used to fill missing values and maintain the original distribution characteristics of the data. Missing values:
[0016] B. Duplicate value handling: A row-by-row comparison and deduplication algorithm is used to fully verify the entire dataset to confirm that there are no duplicate records in the dataset, thus ensuring the reliability of the analysis results. C. Outlier handling: Using box plot tools, outlier data points that exceed the normal process parameter range or violate business logic can be intuitively identified through five key nodes: minimum, lower quartile, median, upper quartile, and maximum value. These outlier data points are then removed to avoid misleading the model training. D. Data Normalization: The min-max standardization method is used to uniformly process all numerical indicators, eliminating the influence of different units of measurement (such as the unit of length "meter" and the unit of weight "kilogram"), so that each indicator has a balanced weight in model training. The standardization formula is: ,in The original data, The minimum value of this variable. This represents the maximum value of the variable. The data is after normalization; 3) Correlation analysis of indicators: By calculating the Pearson correlation coefficients between each indicator and drawing a correlation heatmap, the relationship between the indicators is systematically analyzed. E. Quality Dimension: Clearly define the strong correlation between the yarn twisting process and yarn defects (correlation coefficient 0.99), the weaving process and weaving defects (correlation coefficient 0.99), and the potential correlation between the spinning process and yarn and weaving defects, so as to provide a basis for identifying quality influencing factors; F. Production Level Dimension: Explore the inherent logic between indicators such as length and actual total length, weight and quantity, clarify the interaction mechanism of production links, and lay the foundation for production level measurement. The Pearson correlation coefficient ranges from -1 to 1. The closer the correlation coefficient is to 1, the stronger the positive correlation between the two indicators; the closer it is to -1, the stronger the negative correlation between the two indicators. 4) Dual model construction and optimization training: Random forest and support vector machine classification models are constructed respectively, with "first-class product rate" as the core objective variable, which is divided into "high" and "low" levels to achieve quantitative measurement of quality and production level. E. Construction of Random Forest Classification Model: The Bootstrap sampling technique is used to randomly sample multiple subsets of data from the original training set, and each subset of data is used to train a decision tree independently. During decision tree training, each node randomly selects some features when splitting, calculates split gains such as Gini coefficient or information gain, selects the optimal features for splitting, and enhances the model's generalization ability. The optimal configuration was determined by optimizing hyperparameters through a 5-fold stratified sampling grid search:
[0017] When the model makes predictions, the final classification result is determined through a voting mechanism of multiple decision trees, and the importance of each indicator is output to identify key influencing factors. F. Construction of Support Vector Machine Classification Model: First, the continuous features are discretized using equal frequency, and then the StandardScaler tool is used for standardization to solve the problem of support vector machines being sensitive to feature scale. The input data is defined as a set of labeled samples. ,in for A 3D feature vector is used to describe the attributes of a sample. These are binary labels used to indicate the category to which a sample belongs; By optimizing key parameters through a 5-fold stratified sampling grid search, the penalty coefficient C=1, the kernel function coefficient gamma=1, and the kernel function type rbf (radial basis function) were determined. The core objective of the model is to achieve maximum margin classification in the linearly separable case. It assumes the existence of a linear hyperplane that completely separates positive and negative samples, and defines the geometric margin from the sample to the hyperplane as: ; in, Let be the normal vector of the hyperplane. Let the hyperplane intercept be... For sample feature vectors, For sample labels; The model objective is to maximize the minimum geometric margin of all samples, i.e., to solve an optimization problem: ; , ; Normalization process The above optimization problem can be transformed into a convex optimization problem: ; , ; To address noise and outliers in the data, slack variables are introduced. ≥0, construct a soft-margin optimization problem: ; , ; , ; Among them, the penalty coefficient C is used as the coefficient of the regularization term to regulate the balance between the model's tolerance for error and complexity. C=1 indicates a moderate level of regularization. Using the rbf kernel function The nonlinear data in cotton spinning production is mapped to an infinite-dimensional feature space, which is transformed into a linearly separable problem. The optimal classification hyperplane is found by maximizing the sample interval. The final classification decision function is a non-linear classifier: ;in, For the set of support vectors, To use Lagrange multipliers to achieve accurate prediction of the "first-class product rate" level; 5) Model Evaluation and Practical Application: Accuracy, F1 score, and ROC curve are used as three core metrics to comprehensively evaluate the classification performance of the two models, ensuring high reliability and generalization ability. The successfully trained models are then applied to actual production data from cotton spinning enterprises. Accurately measure product quality grade ("first-class product rate" high / low), and key quality-affecting links such as positioning cylinder twisting and weaving; Quantitative analysis of production levels clarifies the mechanism by which indicators such as length, number of spindles, and quantity affect production efficiency; It provides targeted decision-making recommendations to support enterprises in optimizing production processes (such as adjusting process parameters) and rationally allocating resources (such as optimizing the ratio of manpower to equipment), thereby achieving a dual improvement in product quality and production efficiency.
[0018] In step 1, data collection relies on a 5G data center built by cotton textile enterprises in cooperation with China Mobile, China Unicom, or China Telecom to achieve centralized collection and real-time management of equipment operation, process parameters, and quality inspection data for each process.
[0019] In step 3, the strong correlation between bobbin twist and yarn defects (correlation coefficient 0.99) and between fabric weaving and weaving defects (correlation coefficient 0.99) is clearly established through heat maps.
[0020] In step 4, the random forest model in E can output the feature importance of each indicator, and the correlation of the base learner is reduced by parallel training of multiple decision trees, which effectively avoids overfitting.
[0021] In step 4, the rbf kernel function in F can map the samples to an infinite-dimensional feature space, efficiently handling nonlinear correlation problems in cotton spinning production data; the penalty coefficient C=1 achieves a balance between model error tolerance and complexity, avoiding overfitting or underfitting.
[0022] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of protection claimed by the present invention. The scope of protection of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for measuring cotton spinning quality indices based on random forest and support vector machines, characterized in that, Comprise the following steps: 1) Data collection and index selection: relying on the 5G "smart spinning workshop" data center of cotton spinning enterprises, comprehensive collection of production process data, covering process parameters, equipment running status, product quality test results and production efficiency data; Select the core analysis index, divided into quality related index and production level related index, build two types of data sets; Simplify the variety index, merge C30, C32, C40 and other same type different count pure cotton yarns into the same category, reduce the data dimension, avoid statistical bias caused by too small sample size, and improve the data representativeness; 2) Data preprocessing: to ensure data quality and provide reliable foundation for subsequent modeling, four preprocessing operations are carried out: A, missing value processing: for string type variables such as machine type and variety, because it is impossible to ensure data validity by reasonable filling, the missing records are directly deleted; For numerical variables such as spindle number and weight, mean filling method is used to supplement missing values, maintaining the original distribution characteristics of data; B, repeated value processing: using line by line comparison and deduplication algorithm, the full amount of data is comprehensively verified to confirm that there is no repeated record in the data set, ensuring the reliability of the analysis results; C, abnormal value processing: using box plot tool, through the five key nodes of minimum value, lower quartile, median, upper quartile and maximum value, the abnormal data points beyond the normal process parameter range or violating the business logic are directly removed, avoiding misleading the model training; D, data normalization: all numerical indicators are uniformly processed by using min-max standardization method to eliminate the influence of different dimensions, so that each index has balanced weight in model training, and the standardization formula is: wherein is the original data, is the minimum value of the variable, is the maximum value of the variable, is the normalized data; 3) Index correlation analysis: by calculating the Pearson correlation coefficient between each index, draw the correlation heat map, and systematically analyze the correlation between indexes: E, quality dimension: clear the strong correlation between the ring twisting link and yarn defect, weaving link and weaving defect, and the potential correlation between spinning link and yarn defect, weaving defect, and provide basis for quality influence factor positioning; F, production level dimension: explore the internal logic between length and actual total length, weight and weight, clarify the interaction mechanism of production link, and lay the foundation for production level measurement; The value range of Pearson correlation coefficient is [-1, 1], the closer the correlation coefficient is to 1, the stronger the positive correlation between two indexes; The closer to-1, the stronger the negative correlation between two indexes; 4) Double model construction and optimization training: build random forest and support vector machine classification models respectively, take "first class yield" as the core target variable, divide it into "high" and "low" two levels, and realize the quantitative measurement of quality and production level: E, random forest classification model construction: Bootstrap sampling technology is used to randomly select multiple sub data sets from the original training set, and each sub data set is independently trained as a decision tree; During the training process of decision tree, a part of features are randomly selected for each node splitting, the splitting gain such as Gini coefficient or information gain is calculated, the optimal feature is selected for splitting, and the generalization ability of the model is enhanced; Through 5-fold stratified sampling grid search optimization of hyperparameters, the optimal configuration is determined as max_depth=15, min_samples_leaf=2, min_samples_split=2, n_estimators=100; When the model is predicted, the final classification result is determined through the voting mechanism of multiple decision trees, and the feature importance degree of each indicator is output to clearly determine the key influencing factors; F. Support vector machine classification model construction: First, the continuous features are discretized at equal frequency, and then standardized by StandardScaler tool to solve the problem of support vector machine sensitivity to feature scale; The input data is defined as a set of labeled samples wherein is a feature vector of dimensionality d, describing the properties of the sample is a binary label indicating the class the sample belongs to; Through 5-fold stratified sampling grid search optimization of key parameters, the penalty coefficient C=1, the kernel function coefficient gamma=1, and the kernel function type are determined as rbf; The core objective of the model is to achieve maximum interval classification in linearly separable cases. Assuming that there is a linear hyperplane that can completely separate positive and negative samples, the geometric interval of the sample to the hyperplane is defined as: ; wherein, is a hyperplane normal vector, is a hyperplane intercept, is a sample feature vector, is a sample label; The objective of the model is to maximize the minimum geometric interval of all samples, that is, to solve the optimization problem: ; , ; By normalizing (x = x - x0 =1), the above optimization problem is converted into a convex optimization problem: ; , ; To cope with the noise and outliers in the data, slack variables are introduced and a soft-margin optimization problem is constructed: ; , ; , ; Where the penalty coefficient C is the coefficient of the regularization term, which regulates the balance between the tolerance of the model to error and complexity, and C=1 represents moderate regularization; Using rbf kernel function The nonlinear data in cotton spinning production is mapped to infinite dimensional feature space, converted into linear separable problem, and the optimal classification hyperplane is found by maximizing sample interval. The final classification decision function is a nonlinear classifier: ; wherein, to support the vector set, is the Lagrange multiplier, which realizes the accurate prediction of the "first-grade" level. 5) Model evaluation and practical application, using accuracy, F1 value and ROC curve as three core indicators to comprehensively evaluate the classification performance of the double model, ensure the high reliability and generalization ability of the model, and apply the trained model to the actual production data of cotton spinning enterprises: Accurately measure product quality level, locate key quality influencing links such as tube drawing and weaving; Quantitative analysis of production level, clear mechanism of length, spindle number, and quantitative indicators on production efficiency; Output targeted decision suggestions to support enterprises to optimize production process and reasonably allocate resources, and realize double improvement of product quality and production efficiency.
2. The Random Forest and Support Vector Machine based cotton spinning quality index measurement method according to claim 1, characterized in that: The data collection in step 1 relies on the 5G data center built by cotton spinning enterprises in cooperation with China Mobile, China Unicom or China Telecom, which realizes centralized collection and real-time management of equipment operation, process parameters and quality detection data in each process.
3. The Random Forest and Support Vector Machine based cotton spinning quality index measurement method according to claim 1, characterized in that: In step 3, the heat map is used to clearly determine the strong correlation between tube drawing and yarn defects, and weaving and weaving defects.
4. The Random Forest and Support Vector Machine based cotton spinning quality index measurement method according to claim 1, characterized in that: In step 4E, the random forest model can output the feature importance degree of each indicator, and the multiple decision trees are trained in parallel to reduce the correlation of base learners, effectively avoiding overfitting.
5. The method of claim 1, wherein the method is characterized by: In step 4F, the rbf kernel function can map samples to an infinite-dimensional feature space, efficiently handling nonlinear correlation problems in cotton spinning production data; The penalty coefficient C=1 realizes the balance between model error tolerance and complexity, avoiding overfitting or underfitting.