#머신러닝의 정의
머신 러닝(Machine Learning, ML)은 경험을 통해 자동으로 개선하는 컴퓨터 알고리즘을 연구하는 인공지능의 한 분야입니다. 데이터 세트에 대한 알고리즘을 학습시켜 패턴 식별이나 객체 인식과 같은 예상 결과를 달성하는 방식으로 작동합니다.
머신 러닝의 특징은 다음과 같습니다.
방대한 데이터를 분석해 미래를 예측하는 기술입니다.
모델을 최적화하여 학습 데이터 샘플을 기반으로 올바른 응답을 예측할 수 있습니다.
레이블이 지정된 데이터를 통해 시스템이 학습을 시작하여 학습 속도와 정확성을 개선합니다.
머신 러닝의 종류에는 다음과 같은 것들이 있습니다. 지도 학습(supervised learning), 비지도 학습(unsupervised learning), 강화 학습(reinforcement learning).
----------------------------------
중요한 것은
1) 알고리즘의 강화 --> 정해진 알고리즘에서 계수와 상수를 최적화 해서 답을 잘 낼 수 있도록 강화한다. 이 과정이 포함된 알고리즘이 사용된다.
즉 없는 알고리즘을 새롭게 창조해 내는 것이 아니다.
2) 분류와 회귀
우리가 스터디할 머신러닝의 해답 방법은 아주 간단히 보면 둘 중 하나인데 바로 분류(Categorization)와 회귀(Regression)다.
분류- 어디에 속하는 것인지 분류해 낸다.
회귀- 어떤 값에 수렴할 지 추정치를 낸다.
--------------------------------
https://www.kaggle.com/code/dansbecker/how-models-work
How Models Work
Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sources
www.kaggle.com
We'll start with an overview of how machine learning models work and how they are used. This may feel basic if you've done statistical modeling or machine learning before. Don't worry, we will progress to building powerful models soon.
우리는 머신러닝이 어떻게 동작하고 어떻게 사용할 수 있는지에 대해 간단히 리뷰할 것이다.
만약 통계적 모델링에 대한 경험이나 머신 러닝을 경험한 적이 있다면 매우 기초적으로 느껴질 것이다.
This course will have you build models as you go through following scenario:
이 코스는 다음과 같은 시나리오 기반에서 모델을 작성할 것이다.
Your cousin has made millions of dollars speculating on real estate. He's offered to become business partners with you because of your interest in data science. He'll supply the money, and you'll supply models that predict how much various houses are worth.
당신의 사촌은 부동산에 수백만 달러를 투자해왔다. 그 사촌은 당신이 데이터 분석에 관심이 있다는 걸 알고는 사업 파트너 제안을 했다. 그는 자금을 대고 당신은 다양한 부동산이 어떤 가치를 지니고 있는지 예측하는 모델을 만들어 제공할 계획이다.
You ask your cousin how he's predicted real estate values in the past, and he says it is just intuition. But more questioning reveals that he's identified price patterns from houses he has seen in the past, and he uses those patterns to make predictions for new houses he is considering.
당신은 사촌에게 과거에는 어떻게 부동산 가치를 측정해 왔냐고 물었고 사촌은 단순히 직감에 의존해 왔다고 대답했다.
그러나 질문을 계속해나가자, 사촌은 부동산의 가치를 고려할대 몇가지 패턴을 가지고 있었음을 알아냈다.
Machine learning works the same way. We'll start with a model called the Decision Tree. There are fancier models that give more accurate predictions. But decision trees are easy to understand, and they are the basic building block for some of the best models in data science.
머신러닝은 같은 방식으로 작용한다.
우리는 Decision Tree(의사 결정 나무)라는 모델을 이용할 계획인데, 물론 이보다 더 복잡하고 정확한 결과를 줄 모델들이 있겠지만 Decition Tree는 직관적인 이해가 가능하고, 데이터 사이언스에서 사용되는 가장 기초적인 모델 중 하나다.
For simplicity, we'll start with the simplest possible decision tree.
우선 가장 간단한 모델에서 시작해 보면,
First Decision Trees
It divides houses into only two categories. The predicted price for any house under consideration is the historical average price of houses in the same category.
이 모델은 집을 두가지 카테고리로 나눈다. 예상 가격은 같은 카테고리 상에 있는 집 가격의 그간 평균 가격을 고려하여 결정된다.
We use data to decide how to break the houses into two groups, and then again to determine the predicted price in each group. This step of capturing patterns from data is called fitting or training the model. The data used to fit the model is called the training data.
우리는 여러 집을 이 두가지 그룹에 어떻게 나눠 넣을 것인지 결정하기 위해 데이터를 사용하고 나중에 각 그룹의 예상 가격을 결정할 것이다.
데이터로 부터 특정 패턴을 잡아 내는 과정을 우리는 fitting 또는 training이라고 한다.
(모델 피팅, 모델 트레이닝 ---모델을 맞춰나간다.)
그리고 이렇게 모델 피팅에 사용되는 데이터를 training data (트레이닝 데이터) 라고 한다.
The details of how the model is fit (e.g. how to split up the data) is complex enough that we will save it for later. After the model has been fit, you can apply it to new data to predict prices of additional homes.
모델이 어떻게 학습되는가는 매우 복잡한 수학적 과정을 거치고 여기서는 생략한다.
모델이 일단 학습된(피팅된) 다음에는 새로운 부동산 데이터를 모델에 넣어서 그 부동산의 가격을 예측(predict)할 것이다.
Which of the following two decision trees is more likely to result from fitting the real estate training data?
아래 두개의 decision tree 중에 어느쪽이 부동산 모델을 피팅하는데 적합하겠는가?
First Decision Trees
The decision tree on the left (Decision Tree 1) probably makes more sense, because it captures the reality that houses with more bedrooms tend to sell at higher prices than houses with fewer bedrooms. The biggest shortcoming of this model is that it doesn't capture most factors affecting home price, like number of bathrooms, lot size, location, etc.
Decision Tree1이 좀더 합리적인 것으로 보인다. 왜냐하면 집에 더 많은 침실이 있는 부동산이 그렇지 않은 것보다 비싸게 팔린다는 것이 현실적이기 때문이다. 하지만 가장 큰 단점은 주택 가격에 영향을 미치는 다른 부분 예를 들면 화장실 수, 대지 면적, 위치 등등을 포함하고 있지 않다는 점이다.
You can capture more factors using a tree that has more "splits." These are called "deeper" trees. A decision tree that also considers the total size of each house's lot might look like this:Depth 2 Tree
이러한 요소들을 반영해서 추가적으로 트리를 분기(split)할 수도 있다. 이러한 분기를 #심화(deeper) 트리라고 부를 수 있다.
#심화된다는 것은 추가적인 계층 구조를 가지는 것을 의미하고 계층을 깊이로 비유하여 epth가 2라면 2개의 계층을 지닌다는 의미로 보면 된다.
Decision Tree는 각 주택의 전체 면적을 고려하여 추가적인 분기를 만들 수 있다. (depth 2 트리)
You predict the price of any house by tracing through the decision tree, always picking the path corresponding to that house's characteristics. The predicted price for the house is at the bottom of the tree. The point at the bottom where we make a prediction is called a leaf.
우리가 어떤 집의 가격을 예측할때마다 이 decision tree의 모델에서 주택의 특징에 따라 분기를 선택하면서 가격을 결정하게 된다.
예측된 가격은 분기의 가장 바닥에 위치한다. 이렇게 Decision Tree의 가장 바닥(bottom)이면서 우리가 예측하고자 하는 값이 되는 것을 종단값(leaf)라고 부른다.
The splits and values at the leaves will be determined by the data, so it's time for you to check out the data you will be working with.
leaf에서 나뉘는 값들은 데이터에 의해 결정된다. 이제 데이터를 살펴볼 차례다.
(데이터처리로 계속)
[머신러닝 기초] Your First ML Model (0) | 2025.01.10 |
---|---|
[머신러닝기초]Basic Data Exploration (0) | 2025.01.08 |
[파이썬8강] Gemini 2.0 (0) | 2025.01.06 |
[파이썬7강] Working with External Libraries (0) | 2025.01.06 |
[파이썬 6강] 스트링과 딕셔너리 (0) | 2025.01.03 |