concept method in category machine learning

appears as: method, methods, methods, The method, method, The methods
Machine Learning with TensorFlow, Second Edition

This is an excerpt from Manning's book Machine Learning with TensorFlow, Second Edition.

Finally, let’s define a method called train to run the algorithm, as shown in listing 7.12. First, you must set up the session and run the global_variables_initializer op. Next, you loop num_iters a certain number of times to update weights using the input data one by one. After the loop ends, you record the final node weights and their locations.

  • Labeled data is already out there, you just need methods for setting it up as a machine learning problem using Hidden Markov Models.
  • Human-in-the-Loop Machine Learning

    This is an excerpt from Manning's book Human-in-the-Loop Machine Learning.

    While Active Learning can be self-correcting, can you see any evidence where it didn’t self-correct some bias? Common examples would be over sampling extra long or extra short sentences. The Computer Vision equivalent would be over sampling images that are extra large/small or hi/low resolution. Your choice of outlier strategy and Machine Learning model might over sample based on features like this which are not core to your goal. You might consider applying the methods in this chapter to different buckets of data, in that case: lowest confident short sentences, lowest confident medium sentences, and lowest confident long sentences.

    Figure 3.14: A comparison highlighting the differences between the methods. The left four show that a lot of the uncertainty space for Margin of Confidence and Ratio of Confidence is between two of the labels, which is ignored entirely by Entropy because it is not ambiguous for the third label. The right four images show that especially in more complicated tasks, the items that will be sampled by different Uncertainty Sampling algorithms will be very different.[4]
    def get_validation_rankings(self, model, validation_data, feature_method):
        """Get model outliers from unlabeled data
     
        Keyword arguments:
            model -- current Machine Learning model for this task
            unlabeled_data -- data that does not yet have a label
            validation_data -- held out data drawn from the same distribution as the training data
            feature_method -- the method to create features from the raw text
            number -- number of items to sample
            limit -- sample from only this many items for faster sampling (-1 = no limit)
     
        An outlier is defined as
        unlabeled_data with the lowest average from rank order of logits
        where rank order is defined by validation data inference
     
        """
               
        validation_rankings = [] # 2D array, every neuron by ordered list of output on validation data per neuron   
     
        # Get per-neuron scores from validation data
        if self.verbose:
            print("Getting neuron activation scores from validation data")
     
        with torch.no_grad():
            v=0
            for item in validation_data:
                textid = item[0]
                text = item[1]
                
                feature_vector = feature_method(text)
                hidden, logits, log_probs = model(feature_vector, return_all_layers=True) #A
       
                neuron_outputs = logits.data.tolist()[0] #logits
               
                # initialize array if we haven't yet
                if len(validation_rankings) == 0:
                    for output in neuron_outputs:
                        validation_rankings.append([0.0] * len(validation_data))
                           
                n=0
                for output in neuron_outputs:
                    validation_rankings[n][v] = output  #B
                    n += 1
                           
                v += 1
       
        # Rank-order the validation scores
        v=0
        for validation in validation_rankings:
            validation.sort()                         #C
            validation_rankings[v] = validation
            v += 1
         
        return validation_rankings  
     

    The solution is better sampling for real-word diversity: ensuring that the contexts are as diverse as possible across all the labels and objects that you care about. If you are worried about this problem with your model, here is how to diagnose it: use a method to find out which pixels are important features for your predictions (like LIME, the method in the huskies/wolves paper, or the Captum interpretability library which is in PyTorch as of October 2019) and then measure what percentage of the pixels fall outside the bounding boxes on your validation data. The images with the highest scores are the most likely to be problematic: look at these and see if there are patterns in what is being focused on outside of your bounding boxes.

    Real-World Machine Learning

    This is an excerpt from Manning's book Real-World Machine Learning.

    People use a variety of methods involving shapes, colors, textures, proportions, and other features to learn, and to generalize, from examples. Machine learning also employs a variety of strategies, in various combinations, depending on the problem at hand.