Posts

Showing posts from February, 2024

Java: How to Make a Sudoku Game without Graphical User Interface (GUI)

Image
What's sudoku? Sudoku is a logic-based number-placement puzzle. The objective is to fill an n×n grid with n distinct digits from 1 to n, so that each column, each row, and each of the subgrids that compose the grid contains all of the digits from 1 to n without repetition. Usually, when we talk about sudoku, we refer to the common case n=9, which is an 9x9 sudoku. In fact, sudoku is closely related to mathematics, and there is a complicated mathematical principle behind it. Here I would like to share my Java assignment. The task is to create a simple sudoku game without a graphical user interface (GUI). In fact, Java is not my main language, so I'm not very proficient in it. I took Java as an elective course just because I was curious about Java programming. When I started learning Java, sometimes I got confused about the syntax of Java, because it is similar to both C++ and Python. To me, Java syntax seems like a combination of Python and C++. Sometimes, I get confused about w...

How to Predict Stock Prices with a Multilayer Perceptron (MLP) Neural Network

Image
Predicting stock prices is one of the simple applications of AI in finance. Here I'm using Keras, which is a high-level deep learning API in TensorFlow. I have attempted to predict the future stock price of Padini, a fashion company in Malaysia, and the following graph shows the results of my prediction: It's tiring to train an AI, since you need to test the model with different parameters and settings. I have spent a few hours to adjust the model and find its best settings. It really requires a good intuition. But when you done it, you will feel excited! Disclaimer: This AI model's prediction results are not completely accurate, please do not invest according to the prediction results, otherwise you would lose money and I will not be responsible. Here I will explain the mathematical algorithms behind the MLP Model and provide the Python code in Jupyter to train the AI. Model Updated: The number of neurons in the input layer is reduced to 150. Also, the number of hidden lay...

AI Explained: The Most Common Questions and Answers for Newbies

As a self-taught AI learner, I have been studying AI for a while and I would like to share my experience of learning AI to help others who are interested in learning AI. Here I have summarized some common questions to help answer those who are interested in AI and want to learn AI. Also, i f I think of more questions in the future, I will update this article. Q1: Is mathematics necessary for learning AI? Can I just skip mathematics and dive right in to learn AI? A1: It's not recommended that you skip mathematics when learning AI, otherwise you will have no idea what you’re doing. That is not a good way to learn AI. In fact, mathematics is the core of AI, and AI is actually a complex mathematical model. Almost all the AI courses will require you to learn mathematics first, especially vector calculus, linear algebra, and advanced statistics. As I said earlier, AI = Coding + Math, and they cannot be separated. The best way to learn AI is to know how it works. Q2: I have heard about ma...

The Role of Mathematics in Artificial Intelligence

Image
Many people think that AI is only about coding, but mathematics is actually a fundamental part of AI. AI = Math + Coding, and they are both essential. AI is impossible without math or coding. However, training AI does not necessarily require a lot of mathematical knowledge. Most people train AI without fully understanding the mathematical algorithms behind it. But it is better if you know how AI works with mathematical algorithms. In fact, AI is based on a mathematical model. Some mathematical functions and algorithms are used in the model. It sounds abstract, but you can basically imagine it as using calculus to optimize something. So, how do we train an AI? First, we use advanced mathematics to model an AI, then we use coding to train the AI because the process of training AI is tedious, so we let our computer handle all the training stuff. That is why learning mathematics can help you understand AI more deeply, not just coding. Linear algebra, vector calculus, and advanced statistic...