# 1 July 2020 - Daily Report
## Progress
----
###
Expected Outcome : Understand the cats vs dogs model using tensorflow
___
Outcome :
* Understand what is convolutional neural networks and how it works
* Understand how the cats vs dogs model works
* Get a general view of O-RAN
Further plan:
* Explain some term that is used in CNN such as kernel, layers, hyperparameter, activation function, pooling, optimizer etc. I have studied about it in the past month but not yet make a note about it.
* Find another source for O-RAN
___
### Timeline
**09:00** - Internship Introduction Meeting.
**09.30** - contacting kevin for further information.
**09.45** - Searching for another cat vs dog reference.
**10.45** - Downloading resource
**11.15** - Try to run and analyze the code
**12.49** - Praying and have a lunch
**13.37** - Continue writing and studying about Cat vs Dog
**15.12** - Start to find a general view on O-RAN
**16.06** - Praying
**16.19** - Continue Study
---
### Cats vs Dogs
The reference is providing a complete code of cat vs dog machine learning model using tensorflow. This machine learning model is known as classification model. Using a Convolutional Neural Network, a model can be created to recognize some of basic feature that present in an image. In this case is cat and dog picture.
The reference not only provide the code but also provide the train and test dataset. Each set of this data consist of thousands of picture from different classes (cat vs dog). This data later be used to train and test our model.
After reading through the code, it can be separated into several parts like data preprocessing, model defining, training, and testing.
#### Data preprocessing
The **data preprocessing** part consist of data extracting, data cleaning and reading data. The data extraction was done using zipfile module to unpack the picture from the archive. The data cleaning was done by extracting the label from the picture name. The splitting can be done using split method from string object. After the data is labeled, it must be contained in some sort of container. In this case using a list of image object (X for train dataset and y for test dataset)
#### model defining
The next part of the code is **model defining**. In this part, we define each layer that our model will have. An image classification like cat vs dog often use a convolutional neural network. This network consist of at least one layer of convolutional neuron. This neuron will process image data using a kernel. This kernel consist of an imaginary mesh which contains a small cell of value. The kernel slides through our image while doing a convolution operation. The output of a convolution process is a processed picture.
In a convolutional neural network, we often need maxpooling layer that can take maximum value of our processed data. This maxpooling layer will reduce the size of our data so that it can be processed through the next layer. A convolutional neural network also consist of dense layer of neuron which apply weights and biases so that it can give the desired output.
The code below is the model defining of the cats vs dogs model
```
model = Sequential()
# Adds a densely-connected layer with 64 units to the model:
model.add(Conv2D(64,(3,3), activation = 'relu', input_shape = X.shape[1:]))
model.add(MaxPooling2D(pool_size = (2,2)))
# Add another:
model.add(Conv2D(64,(3,3), activation = 'relu'))
model.add(MaxPooling2D(pool_size = (2,2)))
model.add(Flatten())
model.add(Dense(64, activation='relu'))
# Add a softmax layer with 10 output units:
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer="adam",
loss='binary_crossentropy',
metrics=['accuracy'])
```
The model is a sequential model which means each of the layer output will be passed on to the next layer until it gets to the output layer.
In the model defining part we also notice a parameter such as activation, loss, optimizer and metrics in some function. Activation parameter will define the activation function that is used by the neuron. There are some activation function such as rectified linear unit (relu), sigmoid function and so on.
Loss parameter define the function that is used to measure the loss of our model. There are many type of loss function such as mean square error, binary crossentrophy, categorical crossentrophy and so on. Because our model is a classification model which has two class, we use the binary crossentrophy function to measure the loss of our model.
Optimizer parameter will define how the model will minimize its loss. There are several optimizer but in this model the writer use adam optimizer. It is one of the best optimizer that exist. The performance of an optimizer is measured by the time required to reach minimum loss.
Metrics parameter define the units that will be used to measure our model performance. In this case we use accuracy as a model performance indicator. We could also use another metrics like precision and so on.
#### Training
The **training** part of the code will train our model using the provided data and its label. This learning process is known as supervised learning. Our model training goal is to get a set of rule (hyperparameter consists of weights and biases) so that it can accurately predict a picture. Using backpropagation process, it will evaluate the hyperparameter of our model. Backpropagation uses gradient descent principle in multivariable calculus to reach the minimum loss in loss function.
Here is the screenshot when the training process was done
```
model.fit(X, y, epochs=10, batch_size=32, validation_split=0.2)
```

In this training process, the writer decide to train the model in 10 epochs. Epochs parameter define how many time our model will go through the data. There is also a batch_size parameter which define how much data we want to pass through the model at the same time. Validation_split is a parameter that define how much data will be used to check validation error.
#### Testing
The last part is the **testing** part. In this part we pass on the test data to our trained model.
```
predictions = model.predict(X_test)
predicted_val = [int(round(p[0])) for p in predictions]
```
The code above will return the predicted value of each image inside a numpy array. Sadly we can't check the accuracy since the test data is unlabeled. We can only know our model accuracy from the training process which give us the accuracy about 98.28%
Reference : https://www.kaggle.com/ruchibahl18/cats-vs-dogs-basic-cnn-tutorial/notebook
___
### What is O-RAN?
Random Access Network is part of a mobile telecommunication system that implements a radio access technology. Conceptually, it resides between a devices such as mobile phone, a computer or any remote controlled device and provide connection with its core network (CN)

note:
* CN = Core Network
* RAN = Radio Access Network
* UE = User Equipment
O-RAN (Open Radio Access Network) is a totally disaggregated approach to deploying mobile fronthaul and midhaul networks built entirely on cloud native principles. O-RAN is an evolution of Next Generation RAN architecture.

I watch the webinar from [this reference](https://www.brighttalk.com/webcast/16515/359818?utm_source=brighttalk-portal&utm_medium=web&utm_content=Parallel%20Wireless&utm_campaign=webcasts-search-results-feed) but not yet finished. I am planning to get better understanding about O-RAN first before jumping to the Acumos utilization
Reference :
* https://www.metaswitch.com/knowledge-center/reference/what-is-an-open-radio-access-network-o-ran#:~:text=An%20Open%20Radio%20Access%20Network%20(O%2DRAN)%20is%20a,entirely%20on%20cloud%20native%20principles
* https://en.wikipedia.org/wiki/Radio_access_network
###### tags: `Daily Report`