Michael Indrawan
This portfolio will discuss Deep Learning with KERAS to classify the condition of a milk. Based on information from the attributes possessed by milk, the machine will classify whether the milk is in the best, moderate, or bad condition. The accuracy of the developed model reached 100% from the 106 samples. This model is useful for an organization or individual engaged in research who wants to know the condition of a milk, whether it is still drinkable or not.
Steps to develop a model: 1. Importing Some Libraries & Preparing the Dataset Importing Keras, Pandas. Use “milknew.csv” as the dataset and then convert to Dataframe with Pandas library. Print the data variable shape to know how many the data and attribute. Initiate the data variable info and describe functions to get insight from Dataframe information. We do not need to clean the data, because it is clean from null objects. Importing Keras, Pandas. Use “milknew.csv” as the dataset and then convert to Dataframe with Pandas library. Print the data variable shape to know how many the data and attribute. Initiate the data variable info and describe functions to get insight from Dataframe information. We do not need to clean the data, because it is clean from null objects. 2. Data Preprocessing Initiating X variable which containing a Dataframe with no Grade attribute. Initiate y variable which containing Dataframe with Grade attribute only. Import StandardScaler from sklearn.preprocessing and fit and transform the Dataframe from X variable with StandardScaler. Import OneHotEncoder from sklearn.preprocessing to fit and transform the Dataframe from y variable. A one hot encoding allows the representation of categorical data to be more expressive.
3. Splitting the DataFrame into Training Data and Testing Data Import train_test_split from sklearn.model_selection to automatically spliting the dataframe into training and test data.
4. Building Model Initiate a sequential layer as a model. Add input, and solid layer. Initiate the summary function to get the model insights.
5. Training The Model Compile the model with Adam optimizer, categorical cross entropy for loss function, and accuracy metric. Fit the model with training data. Set validation split to 0.1 and epoch to100.
6. Model Evaluation Import numpy as np. Make model predict with X_test as y_pred. Make test, and pred variable to contain the the maximum values along an axis from y_test and y_pred. Import accuracy_score from sklearn.metrics and initiate accuracy_score with test and prediction data. Import classification_report and initiate classifcation_report with test and prediction data.