Course 3: Structured Machine Learning Project (Week 1) - Machine Learning Strategies (1)

1. Machine Learning Strategies

How to improve the performance of the model?

  • collect more data
  • Training set diversity (eg, identifying cats, collecting cats in various poses, and counterexamples)
  • longer training time
  • Try different optimization algorithms (like Adam optimization)
  • Try a larger/smaller neural network
  • Try DropOut regularization
  • Try adding L2 regularization
  • Design a new network structure (modify the activation function, the number of hidden units)

All of the above methods can change the performance of the model, but it is necessary to judge which ones are effective and which ones can be safely discarded .

2. Orthogonalization

It is best to have no coupling relationship between the adjusted variables.
insert image description here
Locate the performance bottleneck of the model and use the corresponding method to improve it.

Early stopping is a less orthogonal method.
Stopping prematurely affects the accuracy of the training set. At the same time, it can improve the accuracy of the development set.
It affects two things at the same time. Try to use other orthogonal control methods.

3. Single Numerical Evaluation Metrics

insert image description here
Precision , recall, F1 value (average of the first two) :
F 1 = 2 1 precision + 1 recall = 2 ∗ precison ∗ recall precison + recall = TPTP + FN + FP 2 F 1=\frac{2}{ \frac{1}{\text { precision }}+\frac{1}{\text { recall }}}=2 * \frac{\text { precison } * \text { recall }}{\text { precison } +\text { recall }}=\frac{TP}{T P+\frac{F N+FP}{2}}F 1= precision 1+ recall 12=2 precison + recall  precison  recall =TP+2FN+FPTP

Having a single real number evaluation metric can improve the efficiency of your decision making.

4. Meet and optimize metrics

insert image description here
Considering N metrics, sometimes it is reasonable to choose one of them as the optimization metric .

Try to optimize that metric, and then the remaining N-1 metrics are all satisfying metrics , which means that as long as they reach a certain threshold, you no longer care about the size of the metric within the threshold.

5. Train/dev/test set division

insert image description here
Example: The data of the first 4 regions is used as the development set, and the last 4 regions are used as the test set

Very bad , they most likely come from different distributions ; all data
should be shuffled randomly and repartitioned.

6. Size of Dev and Test Sets

insert image description here

7. When to change dev/test sets and metrics

insert image description here
Change the test index:
 Error: 1 ∑ w ( i ) ∑ i = 1 m dev w ( i ) L { ( y ^ ( i ) ≠ y ( i ) ) } w ( i ) = { 1 if x ( i ) true or false Erotic image 10 if x ( i ) is an erotic image\begin{aligned} &\text {error}: \frac{1}{\sum w^{(i)}} \sum_{i=1}^{m_{ \text {dev }}} w^{(i)} \mathcal{L}\left\{\left(\hat{y}^{(i)} \neq y^{(i)}\right)\ right\} \\\\ &w^{(i)}=\left\{\begin{array}{cl} 1 & \text { if } x^{(i)} \text { is a non-pornographic image} \\ 10 & \text { if } x^{(i)} \text { is a pornographic image} \end{array}\right. \end{aligned} error :w(i)1i=1mdev w(i)L{ (y^(i)=y(i))}w(i)={ 110 if x( i ) is a non-pornographic image   if x( i ) is an erotic   image
For the above method, you have to go through the data yourself and mark the pornographic images.


Another example: your development/test set are all clear professional pictures, and the final launch of the application is for unprofessional pictures (blur, bad angle, etc.), then you need to change the development/test set and add unprofessional pictures as training data.

8. Human Performance Levels

It is natural to compare the level of machine learning to that of humans. We want machines to do better than humans

insert image description here

For tasks that humans are good at, when machine learning algorithms are worse than humans , people can help you label the data, so that more data can be fed to the learning algorithm to improve the algorithm.

9. Bias can be avoided

insert image description here

10. Understand human performance

insert image description here
insert image description here

11. Beyond human performance

insert image description here
Scenario B: Beyond the 0.5% threshold (lower error than the best doctors), there are no clear options and way forward to further optimize your machine learning problem

12. Improve the performance of your model

Summarize:

The above method is an improved idea of ​​orthogonalization.

insert image description here

  • Gap between training set error and Bayesian estimation error: avoidable bias
  • Gap between training set error and dev set error: variance

Improve Bias:

  • Larger scale model
  • Longer training and more iterations
  • Better optimization algorithms (Momentum, RMSprop, Adam)
  • Better new neural network architecture
  • better hyperparameters
  • Change the activation function, the number of network layers, the number of hidden units
  • Other models (recurrent NN, convolutional NN)

Improved variance:

  • Collect more data to train
  • Regularization (L2 regularization, dropout regularization, data augmentation)
  • Better new neural network architecture
  • better hyperparameters

Guess you like

Origin blog.csdn.net/qq_42859149/article/details/119608357