Garment Factory Analysis Project using Python

assignment advertisement

Data Description for Garment Factory Analysis Project using Python

Our dataset belongs to the garment factory and workers focusing on their productivity.
We have considered “NUMBER OF STYLE CHANGE” column as a base column in each of our machine learning models. It has only categorical data in it.
Below is the description of dataset columns:

  1. Date: This column of the dataframe has the date in MM-DD-YYYY
  2. Day: This column of the dataframe has the day of the Week
  3. Quarter: A portion of the month. A month was divided into four quarters
  4. Department: This column of the dataframe depicts the associated department with the instance
  5. Team_no: This column of the dataframe represents the Associated team number with the instance
  6. No_of_workers: This column of the dataframe represents the Number of workers in each team
  7. No_of_style_change: This column of the dataframe describes the Number of changes in the style of a
    particular product
  8. Targeted_productivity: This column of the dataframe depicts the Targeted productivity set by the
    Authority for each team for each day.
  9. Smv: This column of the dataframe depicts Standard Minute Value, it is the allocated time for a
    task.
  10. Wip: This column of the dataframe depicts wip (Work in progress) which includes the number of
    unfinished items for products
  11. Over_time: This column of the dataframe represents the amount of overtime by each team in
    minutes.
  12. Incentive: This column of the dataframe represents the amount of financial incentive (in BDT)
    that enables or motivates a particular course of action.
  13. Idle_time: This column of the dataframe depicted the amount of time when the production was
    interrupted due to several reasons
  14. Idle_men: This column of the dataframe depicts the number of workers who were idle due to
    production interruption
  15. Actual_productivity: This column of the dataframe depicts the actual % of productivity that the workers delivered. It ranges from 0-to 1

CODES:

Garment Factory Analysis Project using Python

Let us have a look at code screenshots:
The first step is that import the required libraries that we want to use in the process. We are importing pandas, numpy, seaborn, matplotlib.
Here it is

Garment Factory Analysis Project using Python

In the above cell, we are importing the libraries. We have imported numpy, pandas.
We have used pd. read csv ( ) function to read the excel dataset.

output

We are using the info ( ) function to print the data type and null count of each column

Garment Factory Analysis Project using Python Our dataset belongs to the garment factory and workers focusing on their productivity.We have considered “NUMBER OF STYLE CHANGE” column as a base column in each of our machine learning models. It has only categorical data in it.Below is the description of dataset columns:

We are using the shape ( ) function to print the number of rows and columns in the dataset

program

We have used describe ( ) function to print the basic statistical values of all data columns that are numeric

output

Afterwards, we have used isnull( ) function followed by sum( ) to find the number of null values in each column.

program and output

Here, our exploratory data analysis and data cleaning end. Next, we have started with data visualization techniques.

DATA VISUALISATION

data visualization

First of all, we are importing seaborn and matplotlib for data visualization.

output Garment Factory Analysis Project using Python, Garment Factory, data analysis

In the above screenshot, we have plotted a heat map using the seaborn library for df.corr ( ).
Then, we have plotted a bar plot depicting the incentives for all the departments.

bar plot

Garment Factory Analysis Project with Data Science and Ml using Python

We have presented a box plot for all the numeric columns present in our dataset for Garment Factory Analysis Project using Python

box plot

We have also presented the count of departments for each quarter. We have differentiated them using different colors for our ML Analysis Project using Python

bar chart graph

We have plotted a pie chart showing the number of records in each department.

pie chart , ds, data science, ml project, analysis

MACHINE LEARNING MODELS used in this ML and Data Science Project

Firstly, we need to prepare the dataset for training and testing the models.
We are dropping irrelevant columns. For example, date.

drop MACHINE LEARNING MODELS used in this ML and Data Science Project
import preprocessing

We would need categorial data for training the models of machine learning.

We have used “processing . Label Encoder ( )” to convert strings to numbers. We are using for loop to iterate over the dataset.

label encoder

We have pasted the screenshot of the data frame that we have obtained after label encoding. We can see that we only have numerical values in our data frame now.
We are then importing the libraries for machine learning

import others

We have imported the test train split, classification report, confusion matrix, and an accuracy score.

divide data as train and test ml, machine learning, ai, artificial intelligence

We are choosing NUMBER OF STYLE CHANGE as the target variable. We have to store the values of NUMBER OF STYLE CHANGE in Y and the remaining dataframe values in X. We are splitting the dataset as train and test data in the ratio of 80: 20 which means that 80 % of data is train data and 20 % data in test data

MODEL 1: RANDOM FOREST CLASSIFIER

We are importing the machine learning model, Random Forest Classifier from sklearn.ensemble.

sklearn.ensemble import

Next, we are passing 600 estimators for the random forest classifier.

rfc object creation

We have used the fit ( ) method to train the model by passing training data into it. Afterward, we used the predict ( ) method to find the accuracy of the model.
We have used x_test, x_train, y_test, and y_train that we have obtained after label encoding
in the first step of Garment Factory Analysis Project using Python

fit rfc

Our machine learning model has an accuracy score of 95.42%. It is accurate to conclude that our model is capable of predicting the target variable with a higher rate of accuracy.

final year project, python

In the screenshot presented above, we have presented the confusion matrix.


Also Read:

Share:
Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at admin@copyassignment.com Thank you