๐ค Computer Science/Artificial Intelligence
Introduction to Artificial Intelligence
yesolz
2024. 5. 1. 18:24
728x90
1. Basic
- ์ธ๊ณต์ง๋ฅ > ๊ธฐ๊ณํ์ต > ๋ฅ๋ฌ๋ > ํธ๋์คํฌ๋จธ
- Machine Learning
- Supervised Learning (Data-label)
- classification: ํน์ ํด๋์ค ์์ธก
- regression: ์์น ์์ธก
- Unsupervised Learning (unlabled data)
- clustering - ํน์ง ๊ณ ๋ คํด์ ๋ฌถ์
- Reinforcement Learning: ๋ ๊ฐ์ง ์ ํ
- Exploration: ์๋ก์ด ํ๋
- Exploitation: ๊ธฐ์กด ํ๋ ์ค ๊ฐ์ฅ ๋ง์กฑ๋ ๋์ ๊ฒ ์ ํ
- Supervised Learning (Data-label)
2. Machine Learning(๊ฐ๋ )๊ณผ Data(์ข ๋ฅ, ๋ชจ์)
- Dataset
- training data
- validation data
- test data
- Target
- Prediction
- model parameter
- model hyperparameter
- Machine Learning Process
- Problem Identification
- Data Collection
- Data Pre-processing (filtering, transformation, integration)
- Model Selection, Hyper-parameter Configuration
- Model Training: Hyper-parameter tuning
- Evaluation
- ์ ํvs๋น์ ํ ๋ฐ์ดํฐ
- ์ ํ ๋ฐ์ดํฐ (structured data): ๊ตฌ์กฐ O. ex) ํ, json
- ๋น์ ํ data (unstructured data): ๊ตฌ์กฐ X. ex) ๋ฌธ์, page, ์ฌ์ง, ์์, ์๋ฆฌ
- Data ํํ
- 1์ฐจ์ ๋ฐ์ดํฐ: ๋ฌธ์์ด, ๋จ์ผ ์์ฑ
- 2์ฐจ์ ๋ฐ์ดํฐ: ๋ค์ฑ๋ ์์ฑ (Left/Right)
- 3์ฐจ์ ๋ฐ์ดํฐ: ์ด๋ฏธ์ง (RGB)
- Data cleaning (์ ์ ):
- ๊ฒฐ์ธก์น (missing data)
- ํ๋ฆฐ ๊ฐ (invalid data)
- ์ด์์น (outlier)
- Data transformation
- ๋ฒ์ฃผํ์ผ๋ก
- ์ผ๋ฐ ์ ๊ทํ(normalization): data ๋ฒ์ ๊ฐ๊ฒ ๋ณํ ex) 10์ ๋ง์ , 50์ ๋ง์ ํต์ผ
- z-score ์ ๊ทํ: ํ๊ท 0, ํ์คํธ์ฐจ 1 ๋๋๋ก. z = x-ํ๊ท /ํ์คํธ์ฐจ
- log ๋ณํ: ๊ฐ์ด ๋๋ฌด ํฐ ๊ฒฝ์ฐ / ์ฆ๊ฐ๋ฅผ ๊ณฑ์ ์ผ๋ก ์ฒ๋ฆฌํ๋ ๊ฒ ๋ ํธํ ๋
- EDA(Exploratory Data Analysis)
- Data ํ์ - visualization(๊ฐ์ํ), ํต๊ณ์ ์์
- Discrete vs Continuous
- expectation(๊ธฐ๋๊ฐ), variance(๋ถ์ฐ), standard Deviation(ํ์คํธ์ฐจ)
- Kurtosis(์ฒจ๋) - outlier ์ ๋ ํ๋จ
- Skewness(์๋) - ๋ถํฌ์ ๋น๋์นญ ์ ๋ ํ๋จ
- Data reduction (์ถ์)
- Sampling - ๋ถ์์ ํ์ํ data๋ง ์ทจํจ
- Feature selection - ์ ์ฉํ๊ฒ ์ฌ์ฉ๋ ํน์ง๋ง ์ ํ
3. Naive Bayes Classifier (๋์ด๋ธ ๋ฒ ์ด์ฆ ๋ถ๋ฅ๊ธฐ)
- Machine Learning Model ํ๊ฐ ์งํ (binary classification)
- Accuracy : ์ฌ๋ฐ๋ฅธ / ์ ์ฒด ๋ฐ์ดํฐ
- Recall : TruePositive / TruePosi + FalseNega
- Precision: TruePosi /TruePosi + FlasePosi
- F1 score: 2 * recall * precision / (recall + precision)
- ์กฐ๊ฑด๋ถ ํ๋ฅ (conditional probability)
- ์กฐ๊ฑด๋ถ ํ๋ฅ ์ ์ฐ์๋ฒ์น (chain rule of conditional probability)
- ํต๊ณ์ ์ถ๋ก (์ถ๋ก ํต๊ณํ)
- ๋น๋์ฃผ์ ์ถ๋ก (Frequentist inference)
- ๋ฒ ์ด์ฆ ์ถ๋ก (Bayesian inference)
- Bayes Theorem : P(A|B)๋ฅผ ์ ๋ P(B|A)๋ฅผ ์ ์ ์๋ค
- P(H|E) = P(E|H) * P(H) / P(E)
- Naive Bayes Classifier
- ์ฅ์ : ๊ฐ๋จ, ๋น ๋ฆ. ๋ ๋ฆฝ์ ์ด๋ผ ๊ฐ์ -> ์ดํด ํด์ ์ฌ์, ๋ค์ค ํด๋์ค ๋ถ๋ฅ ๊ฐ๋ฅ
- ๋จ์ : ๋ ๋ฆฝ์ -> ๋นํ์ค์ . ๋ฒ์ฃผํ ๋ฐ์ดํฐ ์๋ ์ฐ์์ ๋ฐ์ดํฐ. ํด๋์ค ๋ถ๊ท ํ
- (์์ฐ์ด์ฒ๋ฆฌ) Tokenization
- ๋จ์ด ๊ธฐ๋ฐ ํ ํฐํ (word-based Tokenization) -> ๋จ์ : Dog vs Dogs ๋ค๋ฅด๊ฒ ์ธ์
- ๋ฌธ์ ๊ธฐ๋ฐ ํ ํฐํ (character-based Tokenization) -> ๋จ์ : ์ฐ์ฐ๋ ๋ง์์ง
- ํ์ ๋จ์ด ํ ํฐํ (Subword Tokenization) -> ์ ๊ฒ ์ฐ๋ ๊ฑด ๋ถํ ! ex) token/ization
4. Decision Tree, Tree search Algorithms
์ค์ ๊ฐ๋ : decision tree, state space, game tree(max-min์๋ฆฌ), A* algorithm(goal state ๊ณ ๋ ค heuristic ์ ์ฉ, Monte-Carlo Tree Search algorithm(MCTS)
- Decision Tree
- Regression tree
- Classification tree - feature๋ฝ์์ ๋ถ๋ฅ
- Tree Search algorithm - DFS, min-max tree, MCTS
- State space: set of all possible configurations of a system.
- Search problem: state, state space, starting state, goal state, actions, solution, cost function(๋ชจ๋ ์ก์ ์ cost value ํ ๋น -> cost-optimal solution)
- Types of search
- uninformed search (brute force): DFS, BFS, uniformed cost search
- informed search: greedy search, A* search. graph search
- Adversarial search: game tree, minimax algorithm, alpha-beta pruning
- Minimax Search algorithm
- max node: child node์ evaluation ๊ฐ ์ค ๊ฐ์ฅ ํฐ ๊ฐ(alpha)๋ก ์ด๋
- min node: child node์ evaluation ๊ฐ ์ค ๊ฐ์ฅ ์์ ๊ฐ(beta)๋ก ์ด๋
- A* algorithm - 3๊ฐ์ ํ๋ผ๋ฏธํฐ
- g: ์์~ํ์ฌ๋ ธ๋ ์ค์ ๋น์ฉ
- h: ํด๋ฆฌ์คํฑ ๊ฐ. ํ์ฌ~๋ชฉํ๋ ธ๋ ์ถ์ ๊ฒฝ๋ก ๋น์ฉ. (h(n) <= ์ค์ ๊ฒฝ๋ก ๋น์ฉ)
- f: g+h. ํ์ฌ ๋ ธ๋์ ์ ์ฒด ์์ ๋น์ฉ -> A* ์๊ณ ๋ฆฌ์ฆ์ f ๊ฐ์ด ์์ ๋ ธ๋ ์ฐ์ ํ์
- Monte Carlo Tree Search (MCTS): ๊ฐ๋ฅํ ๋ชจ๋ ํ๋์ ํ์ํ๊ณ , ๊ฐ ํ๋์ ์ฑ๋ฅ์ ํ๊ฐํ์ฌ ๊ฐ์ฅ ์ ๋งํ ํ๋์ ์ ํ
- AlphaGo Zero: MCTS + ์ ๊ฒฝ๋ง(๊ฐํํ์ต). ์ธ๊ฐ๋ฐ์ดํฐx, ๋ ๋ฐ์ด๋ ์ฑ๋ฅ
- 4๋จ๊ณ : selection -> expansion -> simulation -> backpropagation
5. Nearest Neighbors
์ค์ ๊ฐ๋ : Data distance, K-nearest neighbors, Collaborative filtering
- Instance-based learning : ๋ชจ๋ธ ํ์ต ์์ด ๊ฐ๊น์ด ๋ฐ์ดํฐ ์ด์ฉํด ๋ถ๋ฅ/์์ธก cf. Model-vased learning
- Data distance
- Euclidean distance : ์ง์ ๊ฑฐ๋ฆฌ
- Manhattan distance : ์ง๊ฐ ๊ฑฐ๋ฆฌ
- Jaccard distance : ๋ ์งํฉ ์ฌ์ด ์ ์ฌ๋
- Hamming distance : XOR ํด์ ์ป์ 1์ ๊ฐ์ (๋ค๋ฅธ ๊ฐ์)
- Cosine similarity : -1~1์ ๊ฐ, 1์ ๊ฐ๊น์ธ์๋ก ์ ์ฌ
- K-NN (K-Nearest Neighbors): supervised learning - classification.
- K๊ฐ์ ์ด์์ด ๊ฐ์ง ๊ฐ ์ฐธ๊ณ -> target value ์ค์ .
- learning ์๊ฐ x, answering.
- ๋ช๋ช ์ ์ด์์ผ๋ก ํ๋จํด์ผํ๋์ง์ ๋ฌธ์
- Weighted nearest classifier (K-NN์ ๋ณํ, ๊ฐ์ค์น ๋ถ์ฌ)
- ๊ฑฐ๋ฆฌ ๊ธฐ๋ฐ์ผ๋ก weight ๋ถ์ฌ.
- k๊ฐ nearest neighbor๋ค์ class ๋ณ weight sum์ด ๊ฐ์ฅ ํฐ class๋ก ๊ฒฐ์
- Collaborative filtering - ์ถ์ฒ์์คํ
: ๋์ ์ฑํฅ์ด ๋น์ทํ ์ฌ๋๋ค์ด ์ฌ์ฉํ ์์ดํ
์ถ์ฒ
- -> Cosine similarity ์ฌ์ฉ! - (๊ฒฝํฅ์ฑ์ ๋น๊ตํ๊ธฐ ์ํด์๋ Cosine similarity๋ฅผ ์ฌ์ฉํ๋ค.)
6. Clustering
clustering - unsupervised learning
์ค์ ๊ฐ๋ : k-means algorithm, association analysis(apriori algorithm)
- k-means algorithm
- k๊ฐ์ ์ค์ฌ์ (centroid) ๋ฐฐ์น
- ๊ฐ data๋ค ๊ฐ๊น์ด centroid์ ํ ๋น (cluster ํ์ฑ)
- cluster ์ data ๊ธฐ๋ฐ์ผ๋ก centroid ๋ณ๊ฒฝ
- centroid ๋ณ๊ฒฝ ์์ ๋๊น์ง 2, 3 ๋ฐ๋ณต
- k-means algorithm ๋ฌธ์ ์ : 1์์ ํ๋ฒ์ k๊ฐ centroid random ์ ํ -> k-means++
- k-means ++ : ์ด๊ธฐ ์ค์ฌ ์ค์ ๋ฐฉ๋ฒ!
- ๋ฌด์์ 1๊ฐ ์ ํ - ์ฒซ๋ฒ์งธ centroid
- ๋๋จธ์ง data์ centroid ๊ฑฐ๋ฆฌ ๊ณ์ฐ
- 2์์ ๊ณ์ฐํ ๊ฑฐ๋ฆฌ ๋น๋กํ์ฌ ์๋ก์ด ์ค์ฌ ์ ํ (๋ฉ๋ฆฌ ๋จ์ด์ง ๊ฑฐ ์ ํ)
- k๊ฐ ๊ณ ๋ฅผ ๋๊น์ง 2, 3 ๋ฐ๋ณต
- k ๊ฐ ์ ํํ๊ธฐ
- Elbow ๋ฐฉ๋ฒ: ์ ๊ณฑ์ค์ฐจํฉ ๊ทธ๋ํ -> ๊ธฐ์ธ๊ธฐ ๊ธ๊ฒฉํ ๊ฐ์ํ๋ ์ง์
- Silhouette analysis: ์ค๋ฃจ์ฃ ๊ณ์์ ํ๊ท ๊ฐ
- Association analysis : ๋ฐ์ดํฐ ์งํฉ ์์ดํ ๋ค ๊ฐ ๊ด๊ณ - Apriori algorithm
- Apriori algorithm
- Frequent item ์ ์ (๋น๋ minimum support ์ด์)
- Frequent item set ํ์ฅ (์ด์ ์ ํ ์์ดํ ์งํฉ -> ํฐ ์์ดํ ์งํฉ)
- ๋ ์ด์ ์๋ก์ด frequent item set ์์ฑํ ์ ์์ ๋๊น์ง 2.
- Apriori algorithm ๊ด๋ จ ๊ฐ๋
- confidence(์ ๋ขฐ๋)
- lift(ํฅ์๋): ๋ ์์ดํ ์งํฉ ๊ฐ ๊ด๋ จ์ฑ ์ธก์ . 1์ ๊ธฐ์ค์ผ๋ก 1๋ณด๋ค ํฌ๋ฉด ๊ธ์ / ๊ฐ์ผ๋ฉด ์ํฅx/ ์์ผ๋ฉด ๋ถ์ ์ํฅ์ผ๋ก ํ๋จ
7. Perceptron
perceptron -> supervised learning
์ค์ ๊ฐ๋ : Artificial neural network model, Perceptron, Multilayer perceptron, CNN, RNN
- ์์ฃผ ์ฐ๋ Activation function
- Sigmoid: ๊ธฐ์ธ๊ธฐ ์ค์ด๋ฆ. output scale ์ ํ
- ReLU
- tanh
- Multi-layer perceptron
- input layer - hidden layer - output layer
- Softmax Function: ๋ค์ค ํด๋์ค ๋ถ๋ฅ - ์ถ๋ ฅ ์ธต์ ํ์ฑํ ํจ์
- ๋ชจ๋ ํด๋์ค์ ํ๋ฅ ์ ํฉ์ด 1์ด ๋๋๋ก ๋ง๋ ๋ค
- Prediction Error: ์ผ๋ง๋ ์ ์์ธกํ๋์ง ์ธก์
- Error backpropagation
- epoch(์ํฌํฌ): ์ ๊ฒฝ๋ง์ด ์ ์ฒด ํ์ต ๋ฐ์ดํฐ์ ํ๋ฒ ํต๊ณผ
- batch: ์ ์ฒด ๋ฐ์ดํฐ์
์ ์ผ์ ํฌ๊ธฐ๋ก ๋๋
- iteration: ๊ฐ ๋ฐฐ์น์ ๋ํด ํ์ต๊ณผ์ ํ๋ฒ ํต๊ณผ
- backpropagation์ ๊ฐ ๋ฐฐ์น์ ๋ํด ์ํ
- Gradient Decent algorithm
- ANN(artificial neural network) learning process
- ANN ๋ด์ weight ๊ฐฑ์
- ๊ฐ batch ๋ง์น ์์ ์ ์งํ
- ํ๋์ epoch - batch ๊ฐ์๋งํผ weight update
- ํ ์๋ก์ด batch feedforward
- CNN(Convolutional Neural Network)
- RNN (Recurrent Neural Network)
- Word embedding: ๋จ์ด๋ฅผ vector space์ vector๋ก ๋งคํ
- One hot encoding: ์ด์ง ๋ฒกํฐ. ์ด๋ค ๋จ์ด ์๋ ์์น์๋ง 1, ๋๋จธ์ง 0
- Customized encoding: ์ฌ์ฉ์๊ฐ ์ ์ฌ์ฑ ๊ณ ๋ คํด ์ง์ ๋จ์ด ๋งคํ
- Word2Vec: ๋จ์ด๋ฅผ ๊ณ ์ ๊ธธ์ด ์ค์๋ก ๋งคํ
8. Deep Learning
์ค์ ๊ฐ๋ :์ธ๊ณต์ ๊ฒฝ๋ง/Deep Learning, Application - Object Detection/Image Generation, GAN(Generative Adversarial Networks), CycleGAN
- Alexnet: ๋ฅ๋ฌ๋ ํซํ๊ฒ ๋ง๋ ! GPU ์ด์ฉ, ์ฌ๋ฌ์ธต
- Gradient Vanishing Problem (๊น์ ์ธต์ผ๋ก ๊ฐ์๋ก ๊ทธ๋๋์ธํธ ์์ค, ๊ฐ์ค์น ์
๋ฐ์ดํธ ์ X)
- -> ํด๊ฒฐ ์ํด, AlexNet์ ReLU ์ด์ฉ! ReLU: max(0, x)
- Dropout: ๋๋ค์ผ๋ก drop์ํด. -> training data์ overfitting ๋ฐฉ์ง
- ์์ฉ - Computer Vision - Object Detection: ์๋๋ ์์น, ๋ถ๋ฅ ๋๋จ๊ณ. -> 'YOLO' ๋ชจ๋ธ์ ํ ๊ณผ์ ์ผ๋ก ์ํ
- Generative Adversarial Network(GAN): ์์ฑ๋ชจ๋ธ ์ฑ๋ฅ ์ฌ๋ฆผ
- Generative Models: ์ค์ ๋ฐ์ดํฐ ํ์ต -> ๊ฐ์ง ๋ฐ์ดํฐ ์์ฑ
- Generator ์ Discriminator ์กด์ฌ, Adversarial Traning(์ ๋์ ํ์ต). ๋์ด ๊ฒฝ์!
- Backpropagation ์, Discrimator ์ ๋ฐ์ดํธ ์ ํ๊ณ Generator ๋ง ์ ๋ฐ์ดํธ ํ๋ ์์ผ๋ก ์๋ ด ์๋ ๋ง์ถค
- ์์ฉ) Image Generation
- Pix2Pix
- Imate-to-Image Translation
- dataset: {Edge, Photo}
- Edge์ด๋ฏธ์ง -> Generator -> ์์ฑ
- L1 Loss: ์ค์ ์ด๋ฏธ์ง์ ์์ฑ ์ด๋ฏธ์ง Pixel ์ฐจ -> Error
- Cycle GAN
- paired dataset ๊ตฌ์ถ ํ๊ณ, unpaired dataset ๋ฐ๋ก ๊ตฌ์ถํ๋ ๊ฒ ๋ ํธํจ
- Unpaired Image-to-Image Translation
- 2๊ฐ์ generator ์ด์ฉ -> Cycle-consistency -> Adversarial Training
'์ธ๊ณต์ง๋ฅ์ ๋ฌธ' ์์ ํ์ต ๋ด์ฉ์ ์ค์ค๋ก ์ ๋ฆฌํ์์ต๋๋ค.
728x90