Blog

Machine Learning Practice: Learning Taiwan Stock Index Trends with Scikit (Part 1) – Machine Learning 101

Machine learning is a statistical analysis method. Put simply, the problems it can handle fall roughly into four categories: classification, regression, clustering, and rule extraction.

Learning Taiwan stock index trends with Scikit

Don’t worry! This one is all substance, no fluff—and no more Ctrl + C stuff, I promise.

Close-up of rows of comma-separated numbers, representing tabular input data before machine learning analysis.

‍

Machine learning is a statistical analysis method. The core idea: we give it a pile of data and ask it to give us a result.

That result might be the exact answer we want (for example, turn left or turn right), or it might be some abstract concept that we then use to classify things.

Put simply, the problems machine learning can handle fall roughly into four categories: classification, regression, clustering, and rule extraction.

1. Classification:

We train the machine learning model on a set of data with known answers, for example:

X = [0,2,3,3,4,5,6,7,8] Y = Taipei
X = [0,7,3,3,4,5,6,7,8] Y = Kaohsiung
X = [0,4,3,3,4,5,6,7,8] Y = Taichung
X = ...

We feed it tons of phone numbers, and the answers are their area codes.

We expect the model to learn to tell which city a phone number belongs to just by looking at it. That’s a classification problem.

Once the model is trained, we feed it X = [0,2,1,2,3,4,5,6,7,8]

If the model answers Taipei, it has learned successfully!

2. Regression: We train the machine learning model on a set of data with known answers, for example:

X = [0,1,2,3] Y = 12
X = [0,3,4,2] Y = 22
X = [0,1,1,1] Y = 23
X = ...

We feed it tons of random number strings, and the answer is the sum of each string.

We expect the model to learn to return a number whenever it sees a string of random numbers.

To explain: the biggest difference from classification is the prediction. When the prediction is continuous, it’s a regression problem. When the prediction is discrete, it’s a classification problem (or something else).

For a real-world regression example, click this link: it uses river water levels and rainfall from the past six hours to predict the water level two hours later.

3. Clustering: Give the machine learning model a pile of data with no known answers, plus some grouping logic (such as point-to-point distance), and let it sort the data into groups.

EX: Facebook face recognition

4. Rule Extraction

This one is more abstract. It’s like using analysis to discover rules.

Say you throw in 10,000 photos, and after clustering you notice you and your sister always end up in the same group. Then you could reasonably suspect that you and your sister have the same dad and mom.

Photo recognition -> blood relation. I’d say that’s roughly what rule extraction is!

If that sounds like nonsense, no problem. Suppose you run regression forecasts on sales of 10,000 products and discover that beer and diapers follow the same purchase cycle. Then you could reasonably suspect that people are more likely to have babies after drinking, sales forecast -> drinking leads to babies.

At this point, we basically understand what kinds of problems machine learning can solve.

But the real question is: how does it solve them?

Usually we pick one algorithm, or a combination of several, to tackle the problem at hand. Any algorithm whose results converge is worth a try.

So what algorithms are out there?

‍

1. Regression Algorithms

This is the regression method. The water level forecast was solved this way.

Of course, there are many specialized regression methods, but we won’t go into them here.

2. Instance-based Algorithms

These take facts that have already happened and infer what will happen when a certain sign appears in the future.

3. Clustering Algorithms

Grouping: scatter a bunch of points in a space of any number of dimensions, define a Euclidean distance yourself, and whatever clusters together belongs together.

Representative algorithms include k-Means and k-Median.

4. Kernel Algorithms

Before the big data era, this was the most powerful family of algorithms in machine learning. The best known is the support vector machine (Supported Vector Machine, SVM).

The idea is to map the original data into higher dimensions and then classify it. After all, some degree of polynomial function will always split the data perfectly.

5. Ensemble Algorithms

I’m quite fond of this one. It learns from the results of various already-trained machines and computes a result once more. Think of it like AlphaGo: it needs to know the state of the board now, the state after the move you just made, and how things will play out after its next move, and uses all of that to decide where to play.

6. Neural Network Algorithms

These mimic our nerve cells: feed a pile of data into the neurons, and the neurons respond nonlinearly.

7. Deep Learning

This is a kind of mutant variant of neural networks, and it’s the main method we’ll cover next. Picture lots of neurons sending signals into and out of each other, until the whole nervous system outputs a single signal or a category.

Of course, there are many other kinds of algorithms. Basically, just look up the papers when you need them.

Here are some references for anyone who wants to dig deeper.

[1] Practical Machine Learning Problem

[2] A Visual Introduction to Machine Learning (Chinese edition)

[3] Coursera — Machine Leanring

[4] A tour of machine learning algorithms

[5] Deep Learning Book

You might also like

Identify neritic squid, bigfin reef squid, cuttlefish, and squid in one second with Google Vision API
2019-04-06

[Tech Talk] Tell Neritic Squid, Bigfin Reef Squid, Cuttlefish, and Squid Apart in One Second with Google Vision API — No More Getting Ripped Off at the Market

This time I want to use Google Vision API to build an image recognition model that tells neritic squid, bigfin reef squid, cuttlefish, and squid apart. It's perfect for moms who don't know much about machine learning but still need to shop at the wet market. Vision API is a Google service that lets people who can't build their own machine learning models easily create an image classifier.

Khan LeeCTO
[Tech Talk] Python 101

[Tech Talk] Python 101

When it comes to coding, most people spend the first five minutes learning print(“hello world!”). It seems fun, but it's actually useless. So why does every software engineer teach it this way? Simple: they don't want you learning to code and stealing their jobs. I'm different — I'm going to reveal the ultimate secret to becoming a software engineer.

Khan LeeCTO
LINE MINI App: The Last Moat for Taiwanese Brands Building Private Traffic
2026-05-28

LINE MINI App: The Last Moat for Taiwanese Brands Building Private Traffic

A LINE MINI App is a lightweight app that runs right inside LINE with no download, giving brands their own service entry point on the messaging platform where users spend the most time. In October 2025, LINE opened the platform to all, adding in-app payments and ad revenue sharing and kicking off a new phase of private traffic competition in Taiwan. For brands still relying on paid ads to buy traffic, this window is closing — and integrating a Social CRM is what turns a MINI App from an entry point into a flywheel.

MarketingTeam
Contact us

Start your AI transformation today.

They chose OakMega