index.js
/**
     * Returns an object of objects with the weight of each feature-label pair.
     */
Returns an object of objects with the weight of each feature-label pair.
Returns an object of objects with the weight of each feature - label pair .
weights() {
      const iterations = i || 1;
      const averagedWeights = {};
      for (const feature in weights) {
        const classes = weights[feature];
        const accumulatedClasses = accumulatedWeights[feature] || {};
        const averagedClasses = {};
        averagedWeights[feature] = averagedClasses;
        for (const label in classes) {
          const weight = classes[label];
          const [total = 0, timestamp = 0] = accumulatedClasses[label] || [];
          const newTotal = total + weight * (iterations - timestamp);
          averagedClasses[label] = newTotal / iterations;
        }
      }
      return averagedWeights;
    }
weights ( ) { const iterations = i || 1 ; const averagedWeights = { } ; for ( const feature in weights ) { const classes = weights [ feature ] ; const accumulatedClasses = accumulatedWeights [ feature ] || { } ; const averagedClasses = { } ; averagedWeights [ feature ] = averagedClasses ; for ( const label in classes ) { const weight = classes [ label ] ; const [ total = 0 , timestamp = 0 ] = accumulatedClasses [ label ] || [ ] ; const newTotal = total + weight * ( iterations - timestamp ) ; averagedClasses [ label ] = newTotal / iterations ; } } return averagedWeights ; }
Returns an object of objects with the weight of each feature-label pair.
Returns an object of objects with the weight of each feature - label pair .