Categories
CapstoneWeekly

Simple Introduction to Neural Network

Since the deployment of our Neural Network is approaching, this week I started to learn some primary Pytorch related knowledge (because our project is implemented by Flask, and Flask is implemented by Python, so we use the Pytorch with the same implementation by Python for our NN).

But before learning about Pytorch, I found that I first need to understand what Neural Network is.

“Neural network” is an underlying model of artificial intelligence. Many complex applications (such as pattern recognition, automatic control) and advanced models (such as deep learning) are based on it. Learning artificial intelligence must start from it.

1.Perceptron

  • Perceptron
    Scientists have always hoped to simulate the human brain and create machines that can think. Why can people think? Scientists discovered that the reason lies in the human body’s neural network. Since the basis of thinking is neurons, if you can create artificial neurons, you can form an artificial neural network to simulate thinking. In the 1960s, the earliest “artificial neuron” model called “perceptron” was proposed, which is still in use today.
  • Examples of perceptrons
    Let’s look at an example. The city is holding an annual video game exhibition, I can’t make up my mind whether to visit it on weekends. I decided to consider three factors.
    1. Weather: Is it sunny on weekends?
    2. Companion: Can you find someone to go with?
    3. Price: Are the tickets affordable?
  • This constitutes a perceptron. The above three factors are external input, and the final decision is the output of the sensor. If all three factors are Yes (represented by 1), the output is 1 (to visit); if they are all No (represented by 0), the output is 0 (not to visit).

2. Weight and  Biases

Seeing this, you will definitely ask: If some factors are established and others are not established, what is the output? For example, the weather is good on weekends and the tickets are not expensive, but I can’t find my partner. Should I visit? In reality, various factors are rarely of equal importance: some factors are decisive factors, while others are secondary factors. Therefore, you can assign weights to these factors to represent their different importance.

3. Decision Model

A single perceptron constitutes a simple decision model, which is ready for use. In the real world, the actual decision model is much more complicated, and it is a multi-layer network composed of multiple perceptrons.

4. The Operation Process of the Neural Network

To build a neural network, three conditions need to be met.

Input and output
Weight (w) and Bias (b)
Structure of multilayer perceptron

Among them, the most difficult part is to determine the weight (w) and bias (b). So far, these two values ​​have been given subjectively, but it is difficult to estimate their values ​​in reality. There must be a way to find out.

This method is trial and error. Other parameters remain unchanged, and small changes in w (or b) are recorded as Δw (or Δb), and then observe any changes in the output. Repeat this process until we get the set of w and b corresponding to the most accurate output, which is the value we want. This process is called model training.

Therefore, the operation process of the neural network is as follows.

  • Determine input and output
  • Find one or more algorithms that can get output from the input
  • Find a set of data sets with known answers to train the model and estimate w and b
  • Once new data is generated and input into the model, the results can be obtained, and w and b are corrected at the same time.

I appreciate Michael Nielsen’s open-source textbook (Neural Networks and Deep Learning) for helping me. Of course, this blog is just my basic and primary understanding of NN. If there are some errors or miss, I hope I can correct them in the future.

Link for Neural Networks and Deep Learning:http://neuralnetworksanddeeplearning.com/index.html

Categories
CapstoneWeekly

Monstrous snow

This weekend is a very memorable weekend. A four-day continuous heavy snow has caused many inconveniences to the people around Portland. Power cuts, cars buried in snow, or skidded at intersections. Fortunately, due to the impact of Covid-19, there are not too many people who want to go out. However, this Saturday is the Chinese New Year, so my friends and I decided to drive to Portland for dinner. Chinese New Year is a very important festival to Chinese people, so even if we are both surrounded by endless tasks, we still want to go out and have a delicious meal. As a person from southern China, such heavy snow is unusual and seldom seen for me. The road surface marking is completely covered by snow, and the drivers don’t know how to maintain a safe distance from each other. Everyone can only drive slowly. On both sides of the highway, there are many vehicles that flipped out because of slipping and vehicles that broke down in heavy snow. When we were close to the restaurant, we arrived at a snow-covered intersection. Two cars stuck at this intersection and the cars could not move forward because of the snow. My friends and I immediately went to help them push the cart together, and finally, they left this intersection successfully. However, our car also is stuck at the intersection, but what makes people happy is that, just like we helped others, other people also helped us push the car out of this intersection. When we got back to the car, my ears and hands were numb. For a child who grew up in a city that has never snowed, this is really an interesting experience.

Last week I finally successfully deployed cfd3_input_generator.py to server.py. And Zhaoxiang re-modified the input form again so that the input form of the predict_input page can be better collected the data for the geometry preview generator to generate a better preview. But I still need to modularize cfd3_input_generator just in case I need to deploy that again in subsequent tasks.

For some personal reasons, I started to try to use Linux-like systems more proficiently. Since ubuntu has a fairly complete UI, I decided to choose it as my practicing tool for advanced technology. Since my laptop on the ubuntu system did not work well for some reason, I decided to use VMware to create a virtual machine to set up my Ubuntu system.

VMware Set Up Guide: https://www.vmware.com/support/ws5/doc/ws_newguest_setup_simple_steps.html

Ubuntu Practice:https://beginlinux.com/server_training/8-ubuntuadmin/6-ubmanual

Categories
CapstoneWeekly

Tough Week

Another busy week, I have two midterm exams this week, and another one next week. So I don’t spend too much time on the project, even though I have tried my best to rearrange my schedule. There seem to be some problems in the communication with another team. They seem to be unfamiliar with the tasks they are assigned, and the project owner says that the Neural Network for this web app is ready. Before deploying it, they hope we can have a demo for prototype 1 at the meeting next week, but the task of another team is an indispensable part of this prototype.

Our project encountered some obstacles this week. When Deloy generates static input preview page function for users. I find that the flask web framework is not easy to handle static HTML files. But the result of my current deployed cfd3_input_generator.py is to generate a static HTML file. So I am trying to deconstruct this library and redeploy it in server.py, and change the results to the image file to append to templates.

But the other parts of the project are not bad. I have complete the single input form to store the input data into the database function and also complete a draft of the output page. This simple database is implemented by SQLAlchemy, which has many very convenient encapsulated functions in python. So far this database is just a simple replacement for the global value, but it will play a big role in subsequent output saving.

SQLAlchemy: https://www.sqlalchemy.org/

Categories
CapstoneWeekly

Milestone

This week is still a busy week, but both other courses and projects have been halfway through. Certain results can be seen in many ways. Fortunately, the accomplishment of my study plan and project plan is not bad. In ECE and math courses, I got good grades in assignments and quiz, and I have a solid grasp of them. For the Capstone project, we have achieved many prototype-compliant results in many aspects. Only a few function implementation tasks are left and the beginning of Neural Network’s deployment is close. In general, although I felt very tiring, the results I saw greatly increased my motivation.

Since the last stand-up meeting, our team has held a meeting with another team to exchange the details of the next integration and the remaining functional implementation tasks. Due to the reduction in our team members, these tasks were assigned to our two groups. At the meeting, I divided it into three main task blocks: input page, geometry preview generation, and output page. I also subdivided these tasks on the Kanban task board, and concrete them into subtasks. We have completed the prototype of the input page and output page. Before the next stand-up meeting, we will complete the task of importing parameters into the geometry preview page and generating the geometry preview page.

Of course, we have also encountered many problems. For example, the problem we are facing now is to turn multiple inputs into multiple buttons for users to select different sets of data to generate geometrical previews. And in the next task, we need to store the output page. This seems to require us to start a new learning curve.