G検定 · LESSON 2
Overview of machine learning7%(当サイト設定) · 4 topics
Learn representative methods of supervised, unsupervised and reinforcement learning, and model selection and evaluation.
2.1Supervised learning
Supervised learning (regression and classification, linear regression, logistic regression, decision trees, random forests, gradient boosting, SVM, AR models)
Concept
Supervised learning learns prediction rules from pairs of inputs and correct answers. Regression predicts numbers; classification predicts categories. Linear regression predicts numbers with a line (plane); logistic regression is a “classification” method that outputs probabilities with the sigmoid function. Decision trees predict by branching on conditions; random forests take a majority vote of many decision trees (bagging), and gradient boosting has each tree make up for the previous tree's errors (boosting). SVMs maximize the margin (distance from the boundary to the nearest data) and also classify nonlinearly with kernel methods. AR models are time-series models predicting future values from past ones.
How it works / steps
- Check whether you want to predict a number (regression) or a category (classification)
- Distinguish bagging (parallel, majority vote) from boosting (sequential, correcting errors)
- Weigh the trade-off between interpretability (decision trees, linear regression) and accuracy (ensembles)
Workplace example
Try logistic regression and gradient boosting to predict customer churn, using gradient boosting for accuracy and logistic regression for ease of explanation.
Common confusions and exam tips
- Logistic regression has “regression” in its name but is a classification method
- Random forests use bagging; gradient boosting uses boosting
- SVM's kernel trick works without directly computing the mapping to high dimensions
Mini quiz
Q1. You are choosing the type of machine learning problem. Splitting customers with similar buying tendencies into several groups without correct labels is which?
- Dimensionality reduction
- Clustering
- Classification
- Regression
Show answer and explanation
Answer: B Clustering
Clustering is unsupervised learning, e.g., k-means and Ward's method. (Deciding point: grouping without labels.)
Q2. You are choosing the type of machine learning problem. Summarizing answers to a 100-item survey onto two axes for a chart while keeping as much information as possible is which?
- Dimensionality reduction
- Regression
- Clustering
- Classification
Show answer and explanation
Answer: A Dimensionality reduction
Dimensionality reduction is unsupervised learning, e.g., PCA and t-SNE. (Deciding point: reducing the number of features while keeping information.)
Reference links
2.2Unsupervised learning
Unsupervised learning (k-means, Ward's method, principal component analysis, t-SNE, collaborative filtering, topic models)
Concept
Unsupervised learning finds structure in data without answers. k-means splits data into k clusters fixed in advance; Ward's method merges clusters hierarchically (shown as a dendrogram). Principal component analysis (PCA) reduces dimensions while losing as little information as possible; t-SNE visualizes high-dimensional data in 2 or 3 dimensions. Collaborative filtering recommends based on similar users' behavior; topic models (LDA etc.) estimate the latent topics of documents.
How it works / steps
- Choose whether to fix the number of clusters in advance (k-means) or view hierarchically (Ward's method)
- Use PCA or t-SNE depending on the purpose of dimensionality reduction (preprocessing or visualization)
- For recommendations, understand the difference between collaborative filtering and content-based methods
Workplace example
An e-commerce site recommends items bought by users with similar purchase histories (collaborative filtering). New items have no history, so they're recommended by item attributes (content-based).
Common confusions and exam tips
- k-means results vary with the initial values
- Collaborative filtering is weak for new users and items (the cold start problem)
- t-SNE is mainly for visualization and not suited to transforming new data
Mini quiz
Q1. Which best describes t-SNE?
- A classical linear method that finds a layout preserving distances as much as possible from a matrix of distances between points
- A method for inferring latent topics from word occurrence tendencies in documents
- A linear dimensionality reduction method that finds directions of maximum variance in order and condenses data onto a few axes
- A nonlinear method that maps high-dimensional data to 2–3 dimensions for visualization while preserving neighborhood relationships
Show answer and explanation
Answer: D A nonlinear method that maps high-dimensional data to 2–3 dimensions for visualization while preserving neighborhood relationships
t-SNE is a nonlinear method often used for visualization. [Other options] Linear variance maximization is PCA, inferring topics is topic models (LDA), and layout from a distance matrix is multidimensional scaling (MDS).
Q2. You are choosing an unsupervised learning method. You want to split store data into five groups decided in advance. Which fits best?
- Collaborative filtering
- Principal component analysis (PCA)
- Ward's method
- k-means
Show answer and explanation
Answer: D k-means
k-means places k centroids and repeats assigning points to the nearest centroid and updating centroids (non-hierarchical clustering).
Reference links
2.3Reinforcement learning
Reinforcement learning (Markov decision processes, discount rate, ε-greedy, Q-learning, SARSA, policy gradient methods, Actor-Critic)
Concept
In reinforcement learning, an agent acts in an environment and learns a policy maximizing the total reward it gets. A Markov decision process is the framework where the next state depends only on the current state and action. The discount rate sets how much future rewards count; ε-greedy acts randomly with probability ε to explore and otherwise picks the action thought best. Q-learning learns action values (Q values), updating with the maximum Q value of the next state (off-policy); SARSA updates with the Q value of the next action actually chosen (on-policy). Policy gradient methods optimize the policy directly; Actor-Critic learns both the policy (Actor) and the value (Critic).
How it works / steps
- Organize the relations among state, action, reward and policy
- Understand the exploration-exploitation trade-off (ε-greedy)
- Check the difference between the Q-learning and SARSA updates
Workplace example
In learning warehouse robot routes, start with a large ε to explore many routes, then shrink ε as learning progresses to use good routes.
Common confusions and exam tips
- Q-learning is off-policy; SARSA is on-policy
- A discount rate near 0 values only immediate rewards
- Policy gradient methods work well even in continuous action spaces
Mini quiz
Q1. Which best describes the basic elements of reinforcement learning?
- Reusing a trained model for another task to raise performance with little data
- Using labeled data to learn a function predicting output from input
- Observing the environment's state, acting, and learning a policy that maximizes total reward
- Finding groups of similar items or data structure from data without correct answers
Show answer and explanation
Answer: C Observing the environment's state, acting, and learning a policy that maximizes total reward
Reinforcement learning learns a policy of action through trial and error, guided by rewards. State transitions are often modeled as a Markov decision process.
Q2. Checking reinforcement learning terms. What is the coefficient between 0 and 1 applied when converting future rewards to present value?
- Discount rate
- ε-greedy policy
- Policy gradient method
- Q-learning
Show answer and explanation
Answer: A Discount rate
The smaller the discount rate γ, the more immediate rewards are stressed; the closer to 1, the more future rewards count too.
Reference links
2.4Model selection and evaluation
Model selection and evaluation (cross-validation, confusion matrix, precision/recall/F1, ROC curve and AUC, MSE/RMSE/MAE, AIC/BIC, overfitting)
Concept
A model's generalization performance is evaluated on data not used for training. Cross-validation (k-fold) splits data into k parts, rotates the evaluation part and averages. Classification is evaluated from the confusion matrix: accuracy, precision (share correct among predicted positives), recall (share of actual positives caught), F1 (the harmonic mean of precision and recall), and the ROC curve and AUC. Regression is evaluated with MSE, RMSE and MAE. AIC and BIC choose models by balancing fit and complexity. Overfitting is fitting the training data too closely.
How it works / steps
- Understand the difference between the holdout method and cross-validation
- Choose a metric suited to the goal (recall to avoid misses)
- Compare training and test error to check for overfitting
Workplace example
For a cancer screening model, emphasize recall to reduce misses (false negatives), and confirm false alarms with follow-up detailed exams.
Common confusions and exam tips
- Precision and recall tend to trade off
- On imbalanced data, high accuracy may still be useless
- MAE is less affected by outliers; RMSE weighs large errors heavily
Mini quiz
Q1. In 100 data points, 15 of the 20 predicted positive were actually positive, and there were 30 actual positives in total. Which is the correct pair of precision and recall?
- Precision 15%, recall 50%
- Precision 75%, recall 50%
- Precision 50%, recall 75%
- Precision 75%, recall 15%
Show answer and explanation
Answer: B Precision 75%, recall 50%
Precision = 15/20 = 75%; recall = 15/30 = 50%.
Q2. You have only 500 records, and holdout results vary a lot with the split. Which method estimates generalization most stably?
- k-fold cross-validation: use one of k parts for validation, evaluate k times and average
- Use early stopping when validation performance starts to drop
- Split once into training and validation with a fixed random seed
- Train several models on bootstrap samples from the training data and vote
Show answer and explanation
Answer: A k-fold cross-validation: use one of k parts for validation, evaluate k times and average
It estimates generalization stably when data is scarce. Splitting only once is the holdout method. [Other options] A fixed seed gives reproducibility but keeps split bias. Bootstrap with voting is bagging. Early stopping counters overfitting and isn't an estimation method.
Reference links
Lessons are written by this site based on public information and do not guarantee exam content. Product specifications change, so check the latest information at the reference links.
Notes (unofficial, original questions, no pass guarantee)
- The questions on this site are original practice questions written by this site based on publicly available skills outlines and exam guides. They are not actual exam questions.
- This site is not affiliated with or endorsed by GUGA, JDLA or other exam providers. Exam and organization names may be trademarks of their respective owners.
- This content is a study aid and does not guarantee a pass. Exam content, format and prerequisites may change without notice; always check the latest information on the official page before taking the exam.
- Your accuracy on the mock exam cannot be converted to the official (scaled) score and does not predict a pass or fail.
- Progress is saved only in this browser (localStorage) unless you sign in with Google to sync it. You can delete it from the Cookie & storage settings page (Japanese).