concept feature in category deep learning

appears as: features, features, feature, A feature, feature
Deep Learning with Structured Data

This is an excerpt from Manning's book Deep Learning with Structured Data.

  • Tolerance of the model having imperfect transparency. That is, compared to classic, non-deep learning machine learning, it can be difficult to spell out why the model is making the predictions it is making. In particular, if a model is trained on a set of features (such as customer ID, transaction date, transaction time, etc) it can be difficult to determine which features contribute most to the ability of the model to predict an outcome.
  • Figure 5.2 shows the features that are available for you to choose from in the dataset about sold houses.

    Deep Learning for Vision Systems

    This is an excerpt from Manning's book Deep Learning for Vision Systems.

  • Next, we extract features. Features are what help us define certain objects, and they are usually information about object shape or color. For example, some features that distinguish a motorcycle is shape of the wheel, headlights, mudguards, and many more. The output of this process is a features vector that is a list of unique shapes that identify the object.
  • Finally, these features are fed into a classification model! This step looks at the features vector from the previous step and predicts the class of the image. Pretend that you are the classifier model for a few minutes and let’s go through the classification process: You look at the list of features in the vector feature one-by-one and try to know what’s in the image.
    • a. First you see a feature of a wheel - could this be a car, motorcycle or a dog? Clearly it is not a dog because dogs don’t have wheels (at least normal dogs not robots!). Then, this is could be an image of a car or a motorcycle
    • b. Then you move on to the next feature “the headlights”. There is a higher probability that this is a motorcycle than a usual car
    • c. The next feature is “rear mudguard” - again, there is a higher probability it is a motorcycle
    • d. The object has only two wheels, hmm, this is closer to a motorcycle
    • e. And you keep going though all the features like the body shape, pedal, etc. until you have created a better guess of the object in the image
  • “In transfer learning, we first train a base network on a base dataset and task, and then we repurpose the learned features, or transfer them to a second target network to be trained on a target dataset and task. This process will tend to work if the features are general, meaning suitable to both base and target tasks, instead of specific to the base task.”

  • What is the relationship between features and weights? A feature map is the result of passing the weights filter on the input image during the convolution process. See figure 6.4.
  • Figure 6.4
  • So, what is really being transferred from one network to another? To transfer features, we download the optimized weights of the pretrained network. These weights are then re-used as the starting point for the training process and retrained to adapt to the new problem.
  • # a dictionary that maps layer names to layer instances
    layer_dict = dict([(layer.name, layer) for layer in model.layers])
     
    # define the loss by adding layer contributions to this scalar variable.
    loss = K.variable(0.)
     
    for layer_name in layer_contributions:
    coeff = layer_contributions[layer_name]
    activation = layer_dict[layer_name].output
    scaling = K.prod(K.cast(K.shape(activation), 'float32'))
    # Adds the L2 norm of the features of a layer to the loss.
    # You avoid border artifacts by only involving non-border pixels in the loss.
    loss += coeff * K.sum(K.square(activation[:, 2: -2, 2: -2, :])) / scaling
    Deep Learning with JavaScript: Neural networks in TensorFlow.js

    This is an excerpt from Manning's book Deep Learning with JavaScript: Neural networks in TensorFlow.js.

    This opened the door to a new programming paradigm (figure 1.2). To give an example of the machine-learning paradigm, let’s suppose you are working on a web app that handles photos uploaded by users. A feature you want in the app is automatic classification of photos into ones that contain human faces and ones that don’t. The app will take different actions on face images and no-face images. To this end, you want to create a program to output a binary face/no-face answer given any input image (made of an array of pixels).

    model.fitDataset() accepts a dataset as its first argument, but the dataset must meet a certain pattern to work. Specifically, the dataset must yield objects with two properties. The first property is named xs and has a value of type Tensor, representing the features for a batch of examples; this is similar to the xs argument to model.fit(), but the dataset yields elements one batch at a time rather than the whole array at once. The second required property is named ys and contains the corresponding target tensor.[7] Compared to model.fit(), model.fitDataset() provides a number of advantages. Foremost, we don’t need to write code to manage and orchestrate the downloading of pieces of our dataset—this is handled for us in an efficient, as-needed streaming manner. Caching structures built into the dataset allow for prefetching data that is anticipated to be needed, making efficient use of our computational resources. This API call is also more powerful, allowing us to train on much larger datasets than can fit on our GPU. In fact, the size of the dataset we can train on is now limited only by how much time we have because we can continue to train for as long as we are able to get new training examples. This behavior is illustrated in the data-generator example in the tfjs-examples repository.

    As with outliers, there are many ways to address the problem of missing data, and data scientists have different opinions about which techniques are appropriate in which situations. Which technique is best depends on a few considerations, including whether the likelihood of the feature to be missing depends on the value of the feature itself, or whether the “missingness” can be predicted from other features in the sample. Info box 6.3 outlines a glossary of categories of missing data.

    Listing 6.23. Adding a feature to indicate missingness
    function addMissingness(row, featureName)) {          #1
      const x = row[featureName];
      const isMissing = (x == null) ? 1 : 0;
      return {...row, [featureName + '_isMissing']: isMissing};
    }
    
    const rawDataset tf.data.csv(csvFilename);
    const datasetWithIndicator = rawDataset.map(
          (row) => addMissingness(row, featureName);      #2

    Earlier in this chapter, we described the concept of skew, a difference in distribution from one dataset to another. It is one of the major problems machine-learning practitioners face when deploying trained models to production. Detecting skew involves modeling the distributions of the datasets and comparing them to see if they match. A simple way to quickly look at the statistics of your dataset is to use a tool like Facets (https://pair-code.github.io/facets/). See figure 6.5 for a screenshot. Facets will analyze and summarize your datasets to allow you to look at per-feature distributions, which will help you to quickly suss out problems with different distributions between your datasets.

    Figure 6.5. A screenshot of Facets showing per-feature value distributions for the training and test split of the UC Irvine Census Income datasets (see http://archive.ics.uci.edu/ml/datasets/Census+Income). This dataset is the default loaded at https://pair-code.github.io/facets/, but you can navigate to the site and upload your own CSVs to compare. This view is known as Facets Overview.